コード例 #1
0
        public async Task CreateDeleteTable()
        {
            //create table
            string tableName = Recording.GenerateAssetName("testtable");
            Table  table1    = (await _tableContainer.CreateOrUpdateAsync(tableName)).Value;

            Assert.IsNotNull(table1);
            Assert.AreEqual(table1.Id.Name, tableName);

            //validate if created successfully
            Table table2 = await _tableContainer.GetAsync(tableName);

            AssertTableEqual(table1, table2);
            Assert.IsTrue(await _tableContainer.CheckIfExistsAsync(tableName));
            Assert.IsFalse(await _tableContainer.CheckIfExistsAsync(tableName + "1"));

            //delete table
            await table1.DeleteAsync();

            //validate if deleted successfully
            Assert.IsFalse(await _tableContainer.CheckIfExistsAsync(tableName));
            Table table3 = await _tableContainer.GetIfExistsAsync(tableName);

            Assert.IsNull(table3);
        }