public void SendOrder_Should_Return_Message_With_Insufficient_Money_in_Message(double drinkprice, double InsertedAmount, string expectedMessage) { // arrange var drinkorder = new Mock <IDrinkOrder>(); drinkorder.Setup(x => x.GetDrinkPrice()).Returns(drinkprice); var drinkMakerProtocol = new DrinkMakerProtocol(); var machineLogic = new MachineLogic(drinkMakerProtocol); machineLogic.InsertMoney(InsertedAmount); // act string sendededMessage = machineLogic.SendOrder(drinkorder.Object); // assert Assert.Equal(expectedMessage, sendededMessage); }
public void SendOrder_Should_Return_Empty_Message(string codeDrink) { // arrange var beverageQuantityChecker = new Mock <IBeverageQuantityChecker>(); beverageQuantityChecker.Setup(x => x.IsEmpty(codeDrink)).Returns(false); var emailNotifier = new Mock <IEmailNotifier>(); emailNotifier.Setup(x => x.NotifyMissingDrink(codeDrink)); var drinkmakerprotocol = new DrinkMakerProtocol(); var machinelogic = new MachineLogic(drinkmakerprotocol, beverageQuantityChecker.Object, emailNotifier.Object); var drinkorder = new Mock <IDrinkOrder>(); //act string command = machinelogic.SendOrder(drinkorder.Object); //assert Assert.Equal(string.Empty, command); }
public void sendOrder_Sould_Build_Message_For_Orange(string codeDrink, string expectedMessage) { // arrange var beverageQuantityChecker = new Mock <IBeverageQuantityChecker>(); beverageQuantityChecker.Setup(x => x.IsEmpty(codeDrink)).Returns(false); var emailNotifier = new Mock <IEmailNotifier>(); emailNotifier.Setup(x => x.NotifyMissingDrink(codeDrink)); var drink = new OrangeJuice(); var drinkOrder = new DrinkOrder(drink); var drinkMakerProtocol = new DrinkMakerProtocol(); var logicMachine = new MachineLogic(drinkMakerProtocol, beverageQuantityChecker.Object, emailNotifier.Object); logicMachine.InsertMoney(.60); // act string message = logicMachine.SendOrder(drinkOrder); // assert Assert.Equal(expectedMessage, message); }
public void SendOrder_Should_Return_Message_If_There_Shortage(string codeDrink, double drinkprice, string expectedMessage) { // arrange var beverageQuantityChecker = new Mock <IBeverageQuantityChecker>(); beverageQuantityChecker.Setup(x => x.IsEmpty(codeDrink)).Returns(true); var emailNotifier = new Mock <IEmailNotifier>(); emailNotifier.Setup(x => x.NotifyMissingDrink(codeDrink)); var drinkorder = new Mock <IDrinkOrder>(); drinkorder.Setup(x => x.GetDrinkCode()).Returns(codeDrink); var drinkMakerProtocol = new DrinkMakerProtocol(); var machineLogic = new MachineLogic(drinkMakerProtocol, beverageQuantityChecker.Object, emailNotifier.Object); machineLogic.InsertMoney(drinkprice); // act string sendededMessage = machineLogic.SendOrder(drinkorder.Object); // assert Assert.Equal(expectedMessage, sendededMessage); }