using System;
using System.Diagnostics;
using System.Threading;
using AzureStorageMapper.TableStorage;
using AzureStorageMapper.TableStorage.Attributes;
using NUnit.Framework;

namespace AzureStorageMapper.Tests.TableStorage.TableEntityTests
{
    [TestFixture]
    public class CreateDeleteTableTests
    {
        [Test]
        public void CreateDelete()
        {
            Trace.TraceInformation("Creating table ...");
            SampleTableModel.CreateTable<SampleTableModel>();

            Trace.TraceInformation("Sleep for 15 seconds ...");
            Thread.Sleep(TimeSpan.FromSeconds(15));

            Trace.TraceInformation("Deleting table ...");
            SampleTableModel.DeleteTable<SampleTableModel>();
        }

        [TableModel(Name = "CreateDeleteTableTests")]
        internal class SampleTableModel : TableEntity
        {
            [TableColumn]
            public string ColumnOne { get; set; }

            [TableColumn(Name = "Column2")]
            public int ColumnTwo { get; set; }

            [TableColumn]
            public long ColumnThree { get; set; }

            public SampleTableModel(string partitionKey, string rowKey)
                : base(partitionKey, rowKey)
            {
            }
        }
    }
}

Last edited Dec 1, 2011 at 7:22 AM by shrimpy, version 1

Comments

No comments yet.