public void DrinkMakerTest_Coffe() { var coffeMachineService = new CoffeMachine(); var drinkMaker = new DrinkMaker(0.6M, new Coffe(2), coffeMachineService); Assert.True(0.0M == drinkMaker.Deliver()); }
public void DrinkMakerTest_CreditoSenzaResto() { var coffeMachineService = new CoffeMachine(); var drinkMaker = new DrinkMaker(0.5M, new Chocolate(2), coffeMachineService); Assert.True(0.0M == drinkMaker.Deliver()); }
public void DrinkMakerTest_CreditoInsufficiente() { var coffeMachineService = new CoffeMachine(); var drinkMaker = new DrinkMaker(0.3M, new Chocolate(2), coffeMachineService); Assert.Equal(null, drinkMaker.Deliver()); }
public void DrinkMakerTest_1_Tea_1_Sugar_1_Stick() { DrinkMaker d = new DrinkMaker("T:1:0"); Assert.Equal(DrinkType.Tea, d.DrinkType); Assert.Equal(1, d.Sugar); Assert.True(d.IsStickPresent); }
public void DrinkMakerTest_M_Message() { DrinkMaker d = new DrinkMaker("M:message-content"); Assert.Equal(DrinkType.Service, d.DrinkType); Assert.Equal(0, d.Sugar); Assert.False(d.IsStickPresent); }
public void DrinkMakerTest_1_Coffe_2_Sugar_1_Stick() { DrinkMaker d = new DrinkMaker("C:2:0"); Assert.Equal(DrinkType.Coffe, d.DrinkType); Assert.Equal(2, d.Sugar); Assert.True(d.IsStickPresent); }
public void DrinkMakerTest_1_Chocolate_1_Sugar_1_Stick() { DrinkMaker d = new DrinkMaker("H::"); Assert.Equal(DrinkType.Chocolate, d.DrinkType); Assert.Equal(0, d.Sugar); Assert.False(d.IsStickPresent); }
public void FailsGivenInvalidCommandCode() { var drinkMaker = new DrinkMaker(_dummyMoneyModule, _dummyEmailNotifier, _dummyBeverageQuantityChecker); const string invalidCommand = "Z"; var wasCommandExecuted = drinkMaker.TryExecuteCommand(invalidCommand); var drink = drinkMaker.Drink; Assert.False(wasCommandExecuted); Assert.Null(drink); }
public void TestBuildingDrink() { MockDrinkBuilder testBuilder = new MockDrinkBuilder(); DrinkMaker drinkMaker = new DrinkMaker(testBuilder); drinkMaker.BuildDrink(); Drink drink = drinkMaker.GetDrink(); Assert.AreEqual(1, drink.Id); Assert.AreEqual("Test Drink", drink.Name); Assert.AreEqual(100, drink.Cost); }
public void SendMessageToConsoleIfDrinkShortage() { var mockBeverageQuantityChecker = Mock.Of <IBeverageQuantityChecker>(b => b.IsEmpty(It.IsAny <DrinkType>())); var drinkMaker = new DrinkMaker(_dummyMoneyModule, _dummyEmailNotifier, mockBeverageQuantityChecker); drinkMaker.TryExecuteCommand("C::"); Mock.Get(_dummyEmailNotifier).Verify(e => e.NotifyMissingDrink(It.IsAny <DrinkType>()), Times.Once); Assert.Equal("There is not enough water or milk", drinkMaker.Message); }
public void RequestPaymentIfMoneyModuleUsed() { var mockMoneyModule = Mock.Of <IMoneyModule>(m => m.GetOrderTotalMessage() == "M:Order Total: $0.60" && m.AmountPaid == 0.60m); var drinkMaker = new DrinkMaker(mockMoneyModule, _dummyEmailNotifier, _dummyBeverageQuantityChecker); const string drinkCommand = "C:2:0"; drinkMaker.TryExecuteCommand(drinkCommand); Mock.Get(mockMoneyModule).Verify(m => m.GetOrderTotalMessage(), Times.Once); }
public void ForwardMessageReceived() { var drinkMaker = new DrinkMaker(_dummyMoneyModule, _dummyEmailNotifier, _dummyBeverageQuantityChecker); const string messageCommand = "M:message-content"; const string expectedMessage = "message-content"; var wasCommandExecuted = drinkMaker.TryExecuteCommand(messageCommand); var drink = drinkMaker.Drink; var message = drinkMaker.Message; Assert.True(wasCommandExecuted); Assert.Null(drink); Assert.Equal(expectedMessage, message); }
public void CreateDifferentDrinksGivenDrinkCommand(string drinkCommand, DrinkType expectedDrinkType, int expectedSugars, bool expectedStick) { var stubMoneyModule = Mock.Of <IMoneyModule>(m => m.GetOrderTotalMessage() == "M:" && m.IsOrderPaid()); var drinkMaker = new DrinkMaker(stubMoneyModule, _dummyEmailNotifier, _dummyBeverageQuantityChecker); var wasCommandExecuted = drinkMaker.TryExecuteCommand(drinkCommand); var drink = drinkMaker.Drink; Assert.True(wasCommandExecuted); Assert.Equal(expectedDrinkType, drink.DrinkType); Assert.Equal(expectedSugars, drink.Sugars); Assert.Equal(expectedStick, drink.HasStick()); }
public ActionResult Select(DrinkTypes type) { var drink = new DrinkMaker(); var messages = new List <string>(); messages.Add(drink.BoilWater()); messages.Add(drink.AddPowder(type)); messages.Add(drink.PourDrink(type)); messages.Add(drink.AddExtras(type)); var hotDrink = new HotDrink(); hotDrink.Label = type.ToString(); hotDrink.Messages = messages; return(View(hotDrink)); }