public void IntegrationTestDeleteEntity()
 {
     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("Test16");
     bool insertSuccess = tableService.InsertEntity(
         "Test16",
         testTableEntity.SomeCharacterProperty.ToString(CultureInfo.CurrentCulture),
         testTableEntity.SomeStringProperty,
         testTableEntity);
     Assert.IsTrue(insertSuccess, "The entity was not successfully inserted as expected.");
     bool deleteSuccess = tableService.DeleteEntity(
         "Test16",
         testTableEntity.SomeCharacterProperty.ToString(CultureInfo.CurrentCulture),
         testTableEntity.SomeStringProperty);
     Assert.IsTrue(deleteSuccess);
     tableService.DeleteTable("Test16");
 }
 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.");
 }
        internal static TableDeleteForecastWorker[] GetTableDeleteForecastWorkers()
        {
            IConfigurationSource configurationSource = GetConfigurationSource();
            ArrayList list = new ArrayList();
            foreach (TableDeleteConfiguration tableDeleteConfiguration in configurationSource.GetWindowsAzureTableDeleteConfigurations())
            {
                TableService tableService = new TableService(tableDeleteConfiguration.StorageAccountName, tableDeleteConfiguration.StorageAccountKey);
                foreach (ScheduleDefinitionConfiguration scheduleDefinitionConfiguration in tableDeleteConfiguration.Schedules)
                {
                    ScheduleDay[] scheduleDays = GetScheduleDaysFromScheduleConfiguration(scheduleDefinitionConfiguration);
                    TableDeleteForecastWorker tableDeleteForecastWorker = new TableDeleteForecastWorker(
                        tableService,
                        tableDeleteConfiguration.StorageAccountName,
                        tableDeleteConfiguration.TableNames.ToArray(),
                        scheduleDays,
                        tableDeleteConfiguration.PollingIntervalInMinutes);
                    list.Add(tableDeleteForecastWorker);
                }
            }

            return (TableDeleteForecastWorker[])list.ToArray(typeof(TableDeleteForecastWorker));
        }
        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");
 }
 public void IntegrationTestListNamesWithRetries()
 {
     ITableService tableService = new TableService(StorageAccount.Name, StorageAccount.Key);
     Table[] tables = tableService.ListTables(2);
     Assert.IsTrue(tables.Length > 0, "The table list was empty when it was not expected to be so.");
     foreach (Table table in tables)
     {
         Console.WriteLine("Found table name - " + table.Name);
     }
 }