public ManualFoodCourseEntity ToManualFoodCourse(NormalFoodCourseEntity normalCourse, ManualBillEntity bill = null, ManualMealEntity meal = null) { if (normalCourse == null) { throw new ArgumentNullException("normalCourse"); } if (bill != null && normalCourse.BillId != bill.BillId) { throw new ArgumentOutOfRangeException("bill"); } if (meal != null && normalCourse.MealId != meal.MealId) { throw new ArgumentOutOfRangeException("meal"); } var manualCourse = new ManualFoodCourseEntity() { Bill = bill, BillId = normalCourse.BillId, Cost = normalCourse.Cost, FoodCourseId = normalCourse.FoodCourseId, LastUpdated = normalCourse.LastUpdated, Meal = meal, MealId = normalCourse.MealId, Name = normalCourse.Name, Timestamp = normalCourse.Timestamp, Type = normalCourse.Type }; return(manualCourse); }
public NormalContextTestValues() { Cereal1 = new NormalFoodCourseEntity() { Name = "Generic cereal with milk", Cost = 2.20M, Type = FoodCourseType.Starter, LastUpdated = DateTime.Now }; Cereal2 = new NormalFoodCourseEntity() { Name = "Generic cereal with soya milk", Cost = 2.20M, Type = FoodCourseType.Starter, LastUpdated = DateTime.Now }; FryUp = new NormalFoodCourseEntity() { Name = "Bacon, eggs, sausage, etc", Cost = 6.00M, Type = FoodCourseType.Main, LastUpdated = DateTime.Now }; CerealAndFryUpBreakfast = new NormalMealEntity() { Name = "Cereal and fry-up breakfast", LastUpdated = DateTime.Now }; CerealAndFryUpBreakfast.Courses.Add(Cereal1); CerealAndFryUpBreakfast.Courses.Add(FryUp); CerealOnlyBreakfast = new NormalMealEntity() { Name = "Cereal only breakfast", LastUpdated = DateTime.Now }; CerealOnlyBreakfast.Courses.Add(Cereal2); Bill = new NormalBillEntity() { LastUpdated = DateTime.Now }; Bill.Meals.Add(CerealAndFryUpBreakfast); Bill.Meals.Add(CerealOnlyBreakfast); CourseCount = Bill.Meals.SelectMany(x => x.Courses).Count(); MealCount = Bill.Meals.Count(); }