public void CanBeUpdated() { var store = new AzureCollectionStore<TestCollectionEntity>(ConnectionString); var id = Guid.NewGuid().ToString("N"); var t = new TestCollectionEntity() { Id = id, Name = "Tommy Shooter" }; store.InsertAsync(t).Wait(); t.Name = "The Fall"; store.UpsertAsync(t).Wait(); var t2 = store.GetAsync(id).Result; Assert.Equal("The Fall", t2.Name); }
public void CanBeUpdated() { var store = new AzureCollectionStore <TestCollectionEntity>(ConnectionString); var id = Guid.NewGuid().ToString("N"); var t = new TestCollectionEntity() { Id = id, Name = "Tommy Shooter" }; store.InsertAsync(t).Wait(); t.Name = "The Fall"; store.UpsertAsync(t).Wait(); var t2 = store.GetAsync(id).Result; Assert.Equal("The Fall", t2.Name); }
public void CannotBeUpdatedForConcurrencyAwareWhenETagInConflict() { var store = new AzureCollectionStore <TestCollectionEntityConcurrencyAware>(ConnectionString); var id = Guid.NewGuid().ToString("N"); var t = new TestCollectionEntityConcurrencyAware() { Id = id, Name = "Tommy Shooter", ETag = "\"1234\"", LastModofied = DateTimeOffset.UtcNow }; store.InsertAsync(t).Wait(); t.Name = "The Fall"; t.ETag = "\"8998\""; Assert.Throws <AggregateException>(() => store.UpsertAsync(t).Wait()); }
public void CanBeUpdatedForConcurrencyAware() { var store = new AzureCollectionStore <TestCollectionEntityConcurrencyAware>(ConnectionString); var id = Guid.NewGuid().ToString("N"); var t = new TestCollectionEntityConcurrencyAware() { Id = id, Name = "Tommy Shooter", ETag = "\"1234\"", LastModofied = DateTimeOffset.UtcNow }; store.InsertAsync(t).Wait(); t.Name = "The Fall"; store.UpsertAsync(t).Wait(); var t2 = store.GetAsync(id).Result; Assert.Equal("The Fall", t2.Name); }
public async Task CanBeUpdatedForConcurrencyAware() { var store = new AzureCollectionStore <TestCollectionEntityConcurrencyAware>(ConnectionString); var id = Guid.NewGuid().ToString("N"); var t = new TestCollectionEntityConcurrencyAware() { Id = id, Name = "Tommy Shooter", ETag = "W/\"1234798h88787\"", LastModified = DateTimeOffset.UtcNow }; await store.InsertAsync(t); t.Name = "The Fall"; var tr = await store.GetAsync(id); await store.UpsertAsync(tr); var t2 = await store.GetAsync(id); Assert.Equal("The Fall", t2.Name); }
public void CanBeUpdatedForConcurrencyAware() { var store = new AzureCollectionStore<TestCollectionEntityConcurrencyAware>(ConnectionString); var id = Guid.NewGuid().ToString("N"); var t = new TestCollectionEntityConcurrencyAware() { Id = id, Name = "Tommy Shooter", ETag = "\"1234\"", LastModofied = DateTimeOffset.UtcNow }; store.InsertAsync(t).Wait(); t.Name = "The Fall"; store.UpsertAsync(t).Wait(); var t2 = store.GetAsync(id).Result; Assert.Equal("The Fall", t2.Name); }
public void CannotBeUpdatedForConcurrencyAwareWhenETagInConflict() { var store = new AzureCollectionStore<TestCollectionEntityConcurrencyAware>(ConnectionString); var id = Guid.NewGuid().ToString("N"); var t = new TestCollectionEntityConcurrencyAware() { Id = id, Name = "Tommy Shooter", ETag = "\"1234\"", LastModofied = DateTimeOffset.UtcNow }; store.InsertAsync(t).Wait(); t.Name = "The Fall"; t.ETag = "\"8998\""; Assert.Throws<AggregateException>(() => store.UpsertAsync(t).Wait()); }