public void Repository_returns_correct_data(CannedFoodType cannedFoodType) { var repo = new CannedFoodRepository(); var items = repo.GetByType(cannedFoodType); var distinctReturnType = items.Select(x => x.Type).Distinct().ToList(); Assert.AreEqual(1, distinctReturnType.Count()); Assert.AreEqual(cannedFoodType, distinctReturnType.First()); }
public CannedFood(CannedFoodType type, string name, string description) { Description = description; Name = name; Type = type; }
public IEnumerable<CannedFood> GetByType(CannedFoodType cannedFoodType) { return Get().Where(x => x.Type == cannedFoodType); }
public IEnumerable<CannedFood> GetByType(CannedFoodType cannedFoodType) { var cannedFoods = Get(); return cannedFoods.Where(x => x.Type == cannedFoodType); }