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

                //act
                var result = await repository.FindByAsync(item => item.Name.Equals("Oh my God, Zombies!"));

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

                //act
                var result = await repository.FindByAsync(item => item.Completed);

                //assert
                result.Should().NotBeNull();
                result.Count.Should().Be(1);
            }
        }