public void DeleteByRowMultiple() { var random = new Random(); var table = new AzureTable <EntityWithDataStore>(CloudStorageAccount.DevelopmentStorageAccount, new TestStoreValidator()); table.EnsureExist(); var partition = Guid.NewGuid().ToString(); var entity1 = new EntityWithDataStore() { RowKey = Guid.NewGuid().ToString(), PartitionKey = partition, ToTest = random.Next() }; table.AddEntity(entity1); var entity2 = new EntityWithDataStore() { RowKey = Guid.NewGuid().ToString(), PartitionKey = partition, ToTest = random.Next() }; table.AddEntity(entity2); var items = table.QueryByPartition(partition); Assert.IsNotNull(items); var list = items.ToList(); Assert.AreEqual <int>(2, list.Count()); table.DeleteByRow(entity1.RowKey); items = table.QueryByPartition(partition); Assert.IsNotNull(items); list = items.ToList(); Assert.AreEqual <int>(1, list.Count()); table.DeleteByRow(entity2.RowKey); items = table.QueryByPartition(partition); list = items.ToList(); Assert.AreEqual <int>(0, list.Count()); }
public void DeleteByRowSingle() { var random = new Random(); var table = new AzureTable <EntityWithDataStore>(CloudStorageAccount.DevelopmentStorageAccount, new TestStoreValidator()); table.EnsureExist(); var entity = new EntityWithDataStore() { RowKey = Guid.NewGuid().ToString(), PartitionKey = Guid.NewGuid().ToString(), ToTest = random.Next() }; table.AddOrUpdateEntity(entity); table.DeleteByRow(entity.RowKey); var returned = table.QueryByPartition(entity.PartitionKey); Assert.IsNotNull(returned); var list = returned.ToList(); Assert.AreEqual <int>(0, list.Count()); }
public void DeleteByRowInvalidRowKey() { var table = new AzureTable <EntityWithDataStore>(CloudStorageAccount.DevelopmentStorageAccount); table.DeleteByRow(StringHelper.NullEmptyWhiteSpace()); }