コード例 #1
0
        public async Task <bool> Cannot_create_same_object_twice()
        {
            using var db = new AzureTableStorageFixture();
            await db.OpenAsync();

            var instance = new SimpleObject {
                Id = 1
            };

            var store  = db.GetAppendStore();
            var result = await store.CreateAsync(instance);

            if (!result.Succeeded)
            {
                return(false);
            }

            result = await store.CreateAsync(instance);

            if (result.Succeeded)
            {
                return(false);
            }

            var counter = db.GetCountStore();
            var count   = await counter.CountAsync(typeof(SimpleObject));

            if (!count.Succeeded)
            {
                return(false);
            }

            return(count.Data == 1);
        }
コード例 #2
0
        public async Task <bool> Empty_database_has_no_objects()
        {
            using var db = new AzureTableStorageFixture();
            await db.OpenAsync();

            var store = db.GetCountStore();
            var count = await store.CountAsync(typeof(SimpleObject));

            return(count.Data == 0);
        }
コード例 #3
0
        public async Task <bool> Can_save_object_to_store()
        {
            using var db = new AzureTableStorageFixture();
            await db.OpenAsync();

            var store  = db.GetSaveStore();
            var result = await store.SaveAsync(new SimpleObject { Id = 1 });

            if (!result.Succeeded || result.Data != ObjectSave.Created)
            {
                return(false);
            }

            var counter = db.GetCountStore();
            var count   = await counter.CountAsync(typeof(SimpleObject));

            if (!count.Succeeded)
            {
                return(false);
            }

            return(count.Data == 1);
        }