public void Make_Beverage_When_The_Minimum_Amount_Is_Set(string orderType, int sugarCount, decimal amount, bool extraHot, string expected) { // Arrange Command order; if (orderType == "T") { order = new TeaCommand(sugarCount, sugarCount > 0, extraHot); } else if (orderType == "C") { order = new CoffeeCommand(sugarCount, sugarCount > 0, extraHot); } else if (orderType == "H") { order = new ChocolateCommand(sugarCount, sugarCount > 0, extraHot); } else if (orderType == "H") { order = new ChocolateCommand(sugarCount, sugarCount > 0, extraHot); } else //if (orderType == "O") { order = new OrangeCommand(); } // Act string actual = _coffeeMachine.Instruct(order, amount); // Assert Assert.Equal(expected, actual); }
public void Notify_User_About_A_Orange_Shortage_And_Send_An_Email() { // Arrange _mockedBeverageQuantityChecker .Setup(x => x.IsEmpty(It.IsAny <string>())) .Returns(true); string expectedMessage = "M:There's a shortage with 'Orange'. A notification was sent to our customer service."; // Act BeverageCommand command = new OrangeCommand(); string instruction = _coffeeMachine.Instruct(command, command.Price); // Assert Assert.Equal(instruction, expectedMessage); _mockedEmailNotifier.Verify(x => x.NotifyMissingDrink("O"), Times.Once); }