Beispiel #1
0
        public async Task GetSingleAsync_No_Such_Item_Should_Return_Null()
        {
            using (var context = await InMemoryDbContext.GetContext().SeedDabase(TestSeed.GetItemsForTesting()))
            {
                //arrange
                var repository = new ToDoItemRepository(context);

                //act
                var result = await repository.GetSingleAsync(Guid.NewGuid());

                //assert
                result.Should().BeNull();
            }
        }
Beispiel #2
0
        public async Task GetSingleAsync_Should_Return_Signle_Item()
        {
            using (var context = await InMemoryDbContext.GetContext().SeedDabase(TestSeed.GetItemsForTesting()))
            {
                //arrange
                var repository = new ToDoItemRepository(context);

                //act
                var itemToFind = await context.ToDoItems.FirstAsync();

                var result = await repository.GetSingleAsync(itemToFind.Id);

                //assert
                result.Should().NotBeNull();
                result.Should().BeEquivalentTo(itemToFind);
            }
        }