public void IntegrationTestCreateTableAndDeleteTableWithRetries() { ITableService tableService = new TableService(StorageAccount.Name, StorageAccount.Key); bool createSuccess = tableService.CreateTable("Test2", 2); Assert.IsTrue(createSuccess, "The table was not created as expected."); bool deleteSuccess = tableService.DeleteTable("Test2", 2); Assert.IsTrue(deleteSuccess, "The table was not deleted as expected."); }
public void IntegrationTestDeleteEntityWithRetries() { TestTableEntity testTableEntity = new TestTableEntity { SomeBooleanProperty = true, SomeByteProperty = 1, SomeCharacterProperty = 'a', SomeDateTimeProperty = DateTime.Now, SomeDecimalProperty = 2.0m, SomeDoubleProperty = 3.0, SomeFloatProperty = 4.0f, SomeIntegerProperty = 5, SomeLongProperty = 6, SomeShortProperty = 7, SomeStringProperty = "abc" }; ITableService tableService = new TableService(StorageAccount.Name, StorageAccount.Key); tableService.CreateTable("Test17"); bool insertSuccess = tableService.InsertEntity( "Test17", testTableEntity.SomeCharacterProperty.ToString(CultureInfo.CurrentCulture), testTableEntity.SomeStringProperty, testTableEntity); Assert.IsTrue(insertSuccess, "The entity was not successfully inserted as expected."); bool deleteSuccess = tableService.DeleteEntity( "Test17", testTableEntity.SomeCharacterProperty.ToString(CultureInfo.CurrentCulture), testTableEntity.SomeStringProperty, 2); Assert.IsTrue(deleteSuccess); tableService.DeleteTable("Test17"); }
private static void CleanupTables() { ITableService tableService = new TableService(StorageAccount.Name, StorageAccount.Key); Table[] tables = tableService.ListTables(); bool failure = false; foreach (Table table in tables) { if (table.Name.StartsWith("Test", StringComparison.OrdinalIgnoreCase)) { bool deleteSuccess = tableService.DeleteTable(table.Name); if (!deleteSuccess) { Console.WriteLine("Failed to delete table named '{0}'.", table.Name); failure = true; } } } Assert.IsFalse(failure, "The clean-up failed to delete at least one table, see console output for more information."); }
public void IntegrationTestQueryEntitiesWithRetries() { TestTableEntity testTableEntity1 = new TestTableEntity { SomeBooleanProperty = true, SomeByteProperty = 1, SomeCharacterProperty = 'a', SomeDateTimeProperty = DateTime.Now, SomeDecimalProperty = 2.0m, SomeDoubleProperty = 3.0, SomeFloatProperty = 4.0f, SomeIntegerProperty = 5, SomeLongProperty = 6, SomeShortProperty = 7, SomeStringProperty = "abc" }; TestTableEntity testTableEntity2 = new TestTableEntity { SomeBooleanProperty = true, SomeByteProperty = 1, SomeCharacterProperty = 'a', SomeDateTimeProperty = DateTime.Now, SomeDecimalProperty = 2.0m, SomeDoubleProperty = 3.0, SomeFloatProperty = 4.0f, SomeIntegerProperty = 5, SomeLongProperty = 6, SomeShortProperty = 7, SomeStringProperty = "def" }; ITableService tableService = new TableService(StorageAccount.Name, StorageAccount.Key); tableService.CreateTable("Test11"); bool insertSuccess1 = tableService.InsertEntity( "Test11", testTableEntity1.SomeCharacterProperty.ToString(CultureInfo.CurrentCulture), testTableEntity1.SomeStringProperty, testTableEntity1); Assert.IsTrue(insertSuccess1, "The entity was not successfully inserted as expected."); bool insertSuccess2 = tableService.InsertEntity( "Test11", testTableEntity2.SomeCharacterProperty.ToString(CultureInfo.CurrentCulture), testTableEntity2.SomeStringProperty, testTableEntity2); Assert.IsTrue(insertSuccess2, "The entity was not successfully inserted as expected."); string entitiesXml = tableService.QueryEntities("Test11", "PartitionKey eq 'a'", 2); Assert.IsNotNull(entitiesXml); tableService.DeleteTable("Test11"); }