public void TestWhereWhenExists() { var productList = new ProductsList().GetProducts(); Func <ProductsList.Product, bool> MyFunc = x => x.Ingredients.Contains(new ProductsList.Ingredient { Name = "Menta" }); var selectedIngredients = LinqFunctions.Where(productList, MyFunc); var enumerator = selectedIngredients.GetEnumerator(); int counter = 0; while (enumerator.MoveNext()) { counter++; } Assert.Equal(2, counter); }