public async Task SaveManyAndDeleteMany() { var azureTable = new AzureTable <TestRow>(account, TableName); var row1 = new TestRow { PartitionKey = "partition_key_SaveManyAndDeleteMany", RowKey = "row_key_1_SaveManyAndDeleteMany", ETag = "*" }; var row2 = new TestRow { PartitionKey = "partition_key_SaveManyAndDeleteMany", RowKey = "row_key_2_SaveManyAndDeleteMany", ETag = "*" }; await azureTable.DeleteAsync(new[] { row1, row2 }); var rowsToDelete = await azureTable.GetByPartitionKeyAsync("partition_key_SaveManyAndDeleteMany"); Assert.AreEqual(0, rowsToDelete.Count()); row1.ETag = string.Empty; row2.ETag = string.Empty; await azureTable.AddAsync(new[] { row1, row2 }); var insertedRows = await azureTable.GetByPartitionKeyAsync("partition_key_SaveManyAndDeleteMany"); Assert.AreEqual(2, insertedRows.Count()); await azureTable.DeleteAsync(new[] { row1, row2 }); var actualRows = await azureTable.GetByPartitionKeyAsync("partition_key_SaveManyAndDeleteMany"); Assert.AreEqual(0, actualRows.Count()); }
public async Task AddOrUpdateMany() { var azureTable = new AzureTable <TestRow>(account, TableName); var row1 = new TestRow { PartitionKey = "partition_key_AddOrUpdateMany", RowKey = "row_key_1_AddOrUpdateMany", Content = "content 1", ETag = "*" }; var row2 = new TestRow { PartitionKey = "partition_key_AddOrUpdateMany", RowKey = "row_key_2_AddOrUpdateMany", Content = "content 2", ETag = "*" }; await azureTable.DeleteAsync(new[] { row1, row2 }); var rowsToDelete = await azureTable.GetByPartitionKeyAsync("partition_key_AddOrUpdateMany"); Assert.AreEqual(0, rowsToDelete.Count()); await azureTable.AddAsync(row1); var actualRows = await azureTable.GetByPartitionKeyAsync("partition_key_AddOrUpdateMany"); Assert.AreEqual(1, actualRows.Count()); row1.Content = "content modified"; await azureTable.AddOrUpdateAsync(new[] { row1, row2 }); var insertedRows = await azureTable.GetByPartitionKeyAsync("partition_key_AddOrUpdateMany"); Assert.AreEqual(2, insertedRows.Count()); TestRow updatedRow = await azureTable.GetByPartitionRowKeyAsync("partition_key_AddOrUpdateMany", row1.RowKey); Assert.IsNotNull(updatedRow); Assert.AreEqual("content modified", updatedRow.Content); }
public async Task GetByPartitionKey_Returns_SpecificEntities() { var azureTable = new AzureTable <TestRow>(account, TableName); var row1 = new TestRow { PartitionKey = "partition_key_1_GetByPartitionKey_Returns_SpecificEntities", RowKey = "row_key_1_GetByPartitionKey_Returns_SpecificEntities", Content = "content 1", ETag = "*" }; var row2 = new TestRow { PartitionKey = "partition_key_2_GetByPartitionKey_Returns_SpecificEntities", RowKey = "row_key_2_GetByPartitionKey_Returns_SpecificEntities", Content = "content 2", ETag = "*" }; var row3 = new TestRow { PartitionKey = "partition_key_2_GetByPartitionKey_Returns_SpecificEntities", RowKey = "row_key_3_GetByPartitionKey_Returns_SpecificEntities", Content = "content 3", ETag = "*" }; await azureTable.DeleteAsync(row1); await azureTable.DeleteAsync(row2); await azureTable.DeleteAsync(row3); await azureTable.AddAsync(row1); await azureTable.AddAsync(row2); await azureTable.AddAsync(row3); var retrievedRows = await azureTable.GetByPartitionKeyAsync("partition_key_2_GetByPartitionKey_Returns_SpecificEntities"); Assert.AreEqual(2, retrievedRows.Count()); Assert.AreEqual(row2.Content, retrievedRows.ToList()[0].Content); }
public async Task GetByPartitionRowKey_Returns_SpecificEntity() { var azureTable = new AzureTable <TestRow>(account, TableName); var row1 = new TestRow { PartitionKey = "GetByPartitionRowKey_Returns_SpecificEntity", RowKey = "row_key_1_GetByPartitionRowKey_Returns_SpecificEntity", Content = "content 1", ETag = "*" }; var row2 = new TestRow { PartitionKey = "GetByPartitionRowKey_Returns_SpecificEntity", RowKey = "row_key_2_GetByPartitionRowKey_Returns_SpecificEntity", Content = "content 2", ETag = "*" }; var row3 = new TestRow { PartitionKey = "GetByPartitionRowKey_Returns_SpecificEntity", RowKey = "row_key_3_GetByPartitionRowKey_Returns_SpecificEntity", Content = "content 3", ETag = "*" }; await azureTable.DeleteAsync(new[] { row1, row2, row3 }); var rowsToDelete = await azureTable.GetByPartitionKeyAsync("GetByPartitionRowKey_Returns_SpecificEntity"); Assert.AreEqual(0, rowsToDelete.Count()); await azureTable.AddAsync(new[] { row1, row2, row3 }); var retrievedRow = await azureTable.GetByPartitionRowKeyAsync("GetByPartitionRowKey_Returns_SpecificEntity", "row_key_2_GetByPartitionRowKey_Returns_SpecificEntity"); Assert.AreEqual(row2.Content, retrievedRow.Content); }