public async Task GetUnused_ShouldReturnCorrectCount() { var dbContext = WantoeatDbContextInMemoryFactory.InitializeContext(); await SeedData(dbContext); var ingredient = dbContext.Ingredients.First(); var recipe = new Recipe { Name = "Test", RecipeIngredient = new List <RecipeIngredient> { new RecipeIngredient { Ingredient = ingredient } } }; dbContext.Recipes.Add(recipe); await dbContext.SaveChangesAsync(); var service = new IngredientsService(dbContext); var expected = GetIngredients().Count(); var actual = service.GetAllUnused(recipe.Id).Count(); Assert.True(actual == (expected - 1)); }