예제 #1
0
 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);
 }
예제 #2
0
        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);
        }
예제 #3
0
        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());
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }
예제 #7
0
        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());
        }