Beispiel #1
0
        public void GivenChocolateSelectionShouldGenerateChocolateOrder()
        {
            // Arrange
            _drinkBuilder.SelectDrink(new Chocolate());

            // Act
            string result = _drinkBuilder.GetOrder();

            // Assert
            Assert.Equal("H::", result);
        }
Beispiel #2
0
        public void GivenAddOneSugarShouldHaveOneSugarPlusStick()
        {
            // Arrange
            _drinkBuilder.SelectDrink(new Coffee());
            _drinkBuilder.AddSugar();

            // Act
            var result = _drinkBuilder.GetOrder();

            // Assert
            Assert.Equal("C:1:0", result);
        }
Beispiel #3
0
        public void GivenChocolateSelectionShouldGenerateMessageToUI()
        {
            // Arrange
            _drinkBuilder.SelectDrink(new Chocolate());
            _drinkBuilder.InsertMoney(0.5);

            // Act
            string result = _drinkBuilder.SendMessageToUi();

            // Assert
            Assert.Equal("M:Drink maker makes 1 chocolate with no sugar and therefore no stick", result);
        }
Beispiel #4
0
        public void GivenBadAmountForChocolateShouldIndicateAmountIsInsufficient()
        {
            // Arrange
            var drinkBuilder = new DrinkBuilder(new SugarService(), new MoneyAmountService());

            drinkBuilder.SelectDrink(new Chocolate());
            drinkBuilder.InsertMoney(0.3);

            // Act
            bool result = drinkBuilder.IsAmountIsEnough;

            // Assert
            Assert.False(result);
        }
Beispiel #5
0
        public void GivenBadAmountForChocolateShouldGetMissingAMountMessage()
        {
            // Arrange
            var drinkBuilder = new DrinkBuilder(new SugarService(), new MoneyAmountService());

            drinkBuilder.SelectDrink(new Chocolate());
            drinkBuilder.InsertMoney(0.3);

            // Act
            string result = drinkBuilder.SendMessageToUi();

            // Assert
            Assert.False(drinkBuilder.IsAmountIsEnough);
            Assert.Equal("0,2€ missing", result);
        }