Exemplo n.º 1
0
        public async Task can_store_and_retrieve_object()
        {
            var store = new InMemoryTicketStore();
            await store.StoreAsync <TypeOne, int>(new List <TypeOne> {
                new TypeOne {
                    _id = 10
                }
            });

            var loaded = await store.LoadAsync <TypeOne, int>(10);

            Assert.NotNull(loaded);
            Assert.Equal(10, loaded._id);
        }
Exemplo n.º 2
0
        public async Task can_store_and_delete_object()
        {
            var store = new InMemoryTicketStore();
            await store.StoreAsync <TypeOne, int>(new List <TypeOne> {
                new TypeOne {
                    _id = 10
                }
            });

            var loaded = await store.LoadAsync <TypeOne, int>(10);

            Assert.NotNull(loaded);
            Assert.Equal(10, loaded._id);
            await store.DeleteAsync <TypeOne, int>(new[] { 10 });

            await Assert.ThrowsAsync <ObjectNotFoundException <TypeOne, int> >(async() => await store.LoadAsync <TypeOne, int>(10));
        }
Exemplo n.º 3
0
 public async Task throws_when_object_not_found()
 {
     var store = new InMemoryTicketStore();
     await Assert.ThrowsAsync <ObjectNotFoundException <TypeOne, int> >(async() => await store.LoadAsync <TypeOne, int>(10));
 }