public void WhenEnteredInvalidInput_RejectOrder() { const string input = "Morning,a,b,c"; var expectedResult = "Invalid order string. Please use the pattern: {period},{dishtypenumber}"; var unitOfWork = CreateMockUnitOfWork(new List<MenuItem>()); var attendantService = new ConsoleAttendantService(unitOfWork); var orderResponse = attendantService.GetOrder(input); Assert.AreEqual(expectedResult, orderResponse); }
public void WhenEnteredAfternoon_InformValidPeriods() { const string dishName = "eggs"; const string expectedResult = "Invalid period. Valid periods are: Morning"; const string input = "Afternoon,1"; var unitOfWork = CreateMockUnitOfWork(new List<MenuItem> { CreateMenuItem(dishName, PeriodOfDay.Morning) }); var attendantService = new ConsoleAttendantService(unitOfWork); var orderResponse = attendantService.GetOrder(input); Assert.AreEqual(expectedResult, orderResponse); }
public void WhenEnteredInvalidOrder_ShowValidSelectionsUpToError() { const string expectedResult = "I'm sorry, I could understand that you want: Steak as Entree, Potato as Side, Cake as Dessert. But I had these problems: 5 is an invalid dish type"; const string input = "night,1,2,5,4"; var unitOfWork = CreateMockUnitOfWork(new List<MenuItem> { CreateMenuItem("Steak", PeriodOfDay.Night), CreateMenuItem("Potato", PeriodOfDay.Night, DishType.Side), CreateMenuItem("Wine", PeriodOfDay.Night, DishType.Drink), CreateMenuItem("Cake", PeriodOfDay.Night, DishType.Dessert), }); var attendantService = new ConsoleAttendantService(unitOfWork); var orderResponse = attendantService.GetOrder(input); Assert.AreEqual(expectedResult, orderResponse); }
public void WhenEnteredDessertForMorningMeals_RejectOrder() { const string expectedResult = "I'm sorry, I could understand that you want: Eggs as Entree, Toast as Side, Coffee as Drink. But I had these problems: Dessert is not available in this period"; const string input = "morning,1,2,3,4"; var unitOfWork = CreateMockUnitOfWork(new List<MenuItem> { CreateMenuItem("Eggs", PeriodOfDay.Morning), CreateMenuItem("Toast", PeriodOfDay.Morning, DishType.Side), CreateMenuItem("Coffee", PeriodOfDay.Morning, DishType.Drink), }); var attendantService = new ConsoleAttendantService(unitOfWork); var orderResponse = attendantService.GetOrder(input); Assert.AreEqual(expectedResult, orderResponse); }
public void WhenEnteredListOfDishesWithValidSelection_ShowInOrderEntreeSideDrinkDessert() { const string expectedResult = "Steak,Potato,Wine,Cake"; const string input = "night,1,2,3,4"; var unitOfWork = CreateMockUnitOfWork(new List<MenuItem> { CreateMenuItem("Steak", PeriodOfDay.Night), CreateMenuItem("Potato", PeriodOfDay.Night, DishType.Side), CreateMenuItem("Wine", PeriodOfDay.Night, DishType.Drink), CreateMenuItem("Cake", PeriodOfDay.Night, DishType.Dessert), }); var attendantService = new ConsoleAttendantService(unitOfWork); var orderResponse = attendantService.GetOrder(input); Assert.AreEqual(expectedResult, orderResponse); }
public void WhenEnteredValidOrderWithPeriodOfDayInDifferentCase_AcceptOrder() { const string dishName = "eggs"; const string input = "MoRnInG,1"; var unitOfWork = CreateMockUnitOfWork(new List<MenuItem> { CreateMenuItem(dishName, PeriodOfDay.Morning) }); var attendantService = new ConsoleAttendantService(unitOfWork); var orderResponse = attendantService.GetOrder(input); Assert.AreEqual(dishName, orderResponse); }
public void WhenEnteredOneDishOnInvalidNumberCombination_RejectOrder() { const string expectedResult = "I'm sorry. But I had these problems: You cannot order more than 1 Steak"; const string input = "night,1,1,1,1"; var unitOfWork = CreateMockUnitOfWork(new List<MenuItem> { CreateMenuItem("Steak", PeriodOfDay.Night) }); var attendantService = new ConsoleAttendantService(unitOfWork); var orderResponse = attendantService.GetOrder(input); Assert.AreEqual(expectedResult, orderResponse); }
public void WhenEnteredNight_AcceptOrder() { const string dishName = "eggs"; const string input = "Night,1"; var unitOfWork = CreateMockUnitOfWork(new List<MenuItem> { CreateMenuItem(dishName, PeriodOfDay.Night) }); var attendantService = new ConsoleAttendantService(unitOfWork); var orderResponse = attendantService.GetOrder(input); Assert.AreEqual(dishName, orderResponse); }
public void WhenEnteredMoreThanOnePotatoInTheNight_AcceptOrder() { const string expectedResult = "Steak,Potato(x4),Wine,Cake"; const string input = "night,1,2,2,2,2,3,4"; var unitOfWork = CreateMockUnitOfWork(new List<MenuItem> { CreateMenuItem("Steak", PeriodOfDay.Night), CreateMenuItem("Potato", PeriodOfDay.Night, DishType.Side,5), CreateMenuItem("Wine", PeriodOfDay.Night, DishType.Drink), CreateMenuItem("Cake", PeriodOfDay.Night, DishType.Dessert), }); var attendantService = new ConsoleAttendantService(unitOfWork); var orderResponse = attendantService.GetOrder(input); Assert.AreEqual(expectedResult, orderResponse); }
public void WhenEnteredMoreThanOneDishOnInvalidPeriodDishCombination_RejectOrder() { const string expectedResult = "I'm sorry, I could understand that you want: Potato as Side, Wine as Drink, Cake as Dessert. But I had these problems: You cannot order more than 1 Steak"; const string input = "night,1,1,2,3,4"; var unitOfWork = CreateMockUnitOfWork(new List<MenuItem> { CreateMenuItem("Steak", PeriodOfDay.Night), CreateMenuItem("Potato", PeriodOfDay.Night, DishType.Side), CreateMenuItem("Wine", PeriodOfDay.Night, DishType.Drink), CreateMenuItem("Cake", PeriodOfDay.Night, DishType.Dessert), }); var attendantService = new ConsoleAttendantService(unitOfWork); var orderResponse = attendantService.GetOrder(input); Assert.AreEqual(expectedResult, orderResponse); }
public void WhenEnteredMoreThanOneCoffeeInTheMorning_AcceptOrder() { const string expectedResult = "Eggs,Toast,Coffee(x4)"; const string input = "morning,1,2,3,3,3,3"; var unitOfWork = CreateMockUnitOfWork(new List<MenuItem> { CreateMenuItem("Eggs", PeriodOfDay.Morning), CreateMenuItem("Toast", PeriodOfDay.Morning, DishType.Side), CreateMenuItem("Coffee", PeriodOfDay.Morning, DishType.Drink,5) }); var attendantService = new ConsoleAttendantService(unitOfWork); var orderResponse = attendantService.GetOrder(input); Assert.AreEqual(expectedResult, orderResponse); }
public void WhenEnteredListOfDishTypesWithNoSelection_ShowAvaiableDishTypes() { const string dishName = "eggs"; const string expectedResult = "Please select at least one dish. Avaiable dishes: 1 - Entree - eggs"; const string input = "morning"; var unitOfWork = CreateMockUnitOfWork(new List<MenuItem> { CreateMenuItem(dishName, PeriodOfDay.Morning) }); var attendantService = new ConsoleAttendantService(unitOfWork); var orderResponse = attendantService.GetOrder(input); Assert.AreEqual(expectedResult, orderResponse); }
public void WhenEnteredListOfDishTypesWithAtLeastOneSelection_AcceptOrder() { const string dishName = "eggs"; const string expectedResult = "eggs"; const string input = "morning,1"; var unitOfWork = CreateMockUnitOfWork(new List<MenuItem> { CreateMenuItem(dishName, PeriodOfDay.Morning) }); var attendantService = new ConsoleAttendantService(unitOfWork); var orderResponse = attendantService.GetOrder(input); Assert.AreEqual(expectedResult, orderResponse); }