Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }