Ejemplo n.º 1
0
        public void TestRuinedIceTea()
        {
            AcuCafe cafe = new AcuCafe(_drinkFactory, _drinkIngredientFactory, _baristaInformer, _logger);
            IDrink  d    = cafe.OrderDrink("IceTea", new[] { "milk" });

            Assert.IsFalse(d.IsValid);
        }
Ejemplo n.º 2
0
        public void TestOrderDrink()
        {
            AcuCafe cafe = new AcuCafe(_drinkFactory, _drinkIngredientFactory, _baristaInformer, _logger);
            IDrink  d    = cafe.OrderDrink("Espresso", new string[] { });

            Assert.IsTrue(d.IsValid);
        }
Ejemplo n.º 3
0
        public void TestGoodIceTea()
        {
            AcuCafe cafe = new AcuCafe(_drinkFactory, _drinkIngredientFactory, _baristaInformer, _logger);
            IDrink  d    = cafe.OrderDrink("IceTea", new[] { "sugar" });

            Assert.IsTrue(d.IsValid);
        }
Ejemplo n.º 4
0
        public void TestHavingTea()
        {
            AcuCafe cafe = new AcuCafe(_drinkFactory, _drinkIngredientFactory, _baristaInformer, _logger);
            IDrink  d    = cafe.OrderDrink("HotTea", new[] { "milk" });

            Assert.IsTrue(d.IsValid);
        }
Ejemplo n.º 5
0
        public void TestRuinedEspresso()
        {
            AcuCafe cafe = new AcuCafe(_drinkFactory, _drinkIngredientFactory, _baristaInformer, _logger);
            IDrink  d    = cafe.OrderDrink("Espresso", new[] { "milk", "sugar" });

            d.AddIngredient(new DrinkIngredient("coconut", 0.5));

            Assert.IsFalse(d.IsValid);
        }
Ejemplo n.º 6
0
        public void TestEspressoWithMilkAndSugar()
        {
            AcuCafe cafe = new AcuCafe(_drinkFactory, _drinkIngredientFactory, _baristaInformer, _logger);
            IDrink  d    = cafe.OrderDrink("Espresso", new[] { "milk", "sugar" });

            Assert.AreEqual(2.8, d.Cost());
            Assert.AreEqual("Espresso with milk with sugar without chocolate topping", d.Description);
            Assert.IsTrue(d.IsValid);
        }
Ejemplo n.º 7
0
        public void TestPlainEspresso()
        {
            AcuCafe cafe = new AcuCafe(_drinkFactory, _drinkIngredientFactory, _baristaInformer, _logger);
            IDrink  d    = cafe.OrderDrink("Espresso", new string[] { });

            Assert.AreEqual(1.8, d.Cost());
            Assert.AreEqual("Espresso without milk without sugar without chocolate topping", d.Description);
            Assert.IsTrue(d.IsValid);
        }
Ejemplo n.º 8
0
        public AcuCafeTests()
        {
            var informBaristaFake = A.Fake <IInformBarista>();

            _drinkPreparatorFake = A.Fake <IDrinkPreparator>();
            _acuCafe             = new AcuCafe(new List <IInformBarista>()
            {
                informBaristaFake
            }, _drinkPreparatorFake);
        }
Ejemplo n.º 9
0
        public void ExpressoTest()
        {
            var cafe = new AcuCafe();

            var expressoMilkAndSugar = (Expresso)cafe.OrderDrink(Enumerations.DrinkType.Expresso, true, true);

            Assert.AreEqual(expressoMilkAndSugar.HasMilk, true);
            Assert.AreEqual(expressoMilkAndSugar.HasSugar, true);
            Assert.AreEqual(expressoMilkAndSugar.ChocolateTopping, false);

            var expressoMilkNoSugar = (Expresso)cafe.OrderDrink(Enumerations.DrinkType.Expresso, true, false);

            Assert.AreEqual(expressoMilkNoSugar.HasMilk, true);
            Assert.AreEqual(expressoMilkNoSugar.HasSugar, false);
            Assert.AreEqual(expressoMilkNoSugar.ChocolateTopping, false);

            var expressoNoMilkAndSugar = (Expresso)cafe.OrderDrink(Enumerations.DrinkType.Expresso, false, true);

            Assert.AreEqual(expressoNoMilkAndSugar.HasMilk, false);
            Assert.AreEqual(expressoNoMilkAndSugar.HasSugar, true);
            Assert.AreEqual(expressoNoMilkAndSugar.ChocolateTopping, false);

            var expressoNoMilkOrSugar = (Expresso)cafe.OrderDrink(Enumerations.DrinkType.Expresso, false, false);

            Assert.AreEqual(expressoNoMilkOrSugar.HasMilk, false);
            Assert.AreEqual(expressoNoMilkOrSugar.HasSugar, false);
            Assert.AreEqual(expressoNoMilkOrSugar.ChocolateTopping, false);

            var expressoMilkAndSugarWithChocolate = (Expresso)cafe.OrderDrink(Enumerations.DrinkType.Expresso, true, true, true);

            Assert.AreEqual(expressoMilkAndSugarWithChocolate.HasMilk, true);
            Assert.AreEqual(expressoMilkAndSugarWithChocolate.HasSugar, true);
            Assert.AreEqual(expressoMilkAndSugarWithChocolate.ChocolateTopping, true);

            var expressoMilkNoSugarWithChocolate = (Expresso)cafe.OrderDrink(Enumerations.DrinkType.Expresso, true, false, true);

            Assert.AreEqual(expressoMilkNoSugarWithChocolate.HasMilk, true);
            Assert.AreEqual(expressoMilkNoSugarWithChocolate.HasSugar, false);
            Assert.AreEqual(expressoMilkNoSugarWithChocolate.ChocolateTopping, true);

            var expressoNoMilkAndSugarWithChocolate = (Expresso)cafe.OrderDrink(Enumerations.DrinkType.Expresso, false, true, true);

            Assert.AreEqual(expressoNoMilkAndSugarWithChocolate.HasMilk, false);
            Assert.AreEqual(expressoNoMilkAndSugarWithChocolate.HasSugar, true);
            Assert.AreEqual(expressoNoMilkAndSugarWithChocolate.ChocolateTopping, true);

            var expressoNoMilkOrSugarWithChocolate = (Expresso)cafe.OrderDrink(Enumerations.DrinkType.Expresso, false, false, true);

            Assert.AreEqual(expressoNoMilkOrSugarWithChocolate.HasMilk, false);
            Assert.AreEqual(expressoNoMilkOrSugarWithChocolate.HasSugar, false);
            Assert.AreEqual(expressoNoMilkOrSugarWithChocolate.ChocolateTopping, true);
        }
Ejemplo n.º 10
0
        public void IceTeaTest()
        {
            var cafe = new AcuCafe();

            var iceTeaNoMilkAndSugar = cafe.OrderDrink(Enumerations.DrinkType.IceTea, false, true);

            Assert.AreEqual(iceTeaNoMilkAndSugar.HasMilk, false);
            Assert.AreEqual(iceTeaNoMilkAndSugar.HasSugar, true);

            var iceTeaNoMilkOrSugar = cafe.OrderDrink(Enumerations.DrinkType.IceTea, false, false);

            Assert.AreEqual(iceTeaNoMilkOrSugar.HasMilk, false);
            Assert.AreEqual(iceTeaNoMilkOrSugar.HasSugar, false);
        }
Ejemplo n.º 11
0
        public void IsDrinkCorrect()
        {//TODO => Add a test for each Drink type.
            var drinks = new string[]
            {
                "Expresso",
                "HotTea",
                "IceTea"
            };

            for (var i = 0; i < 3; i++)
            {
                var hasMilk  = i % 2 == 1;
                var hasSugar = i % 2 == 0;
                var result   = AcuCafe.OrderDrink(drinks[i], hasMilk, hasSugar);
                Assert.AreEqual(drinks[i], result.GetType().Name);
                Assert.AreEqual(hasMilk, result.Toppings.Any(t => t.Type == ToppingType.Milk));
                Assert.AreEqual(hasSugar, result.Toppings.Any(t => t.Type == ToppingType.Sugar));
                Assert.IsTrue(result.HasBeenPrepared);
            }
        }
Ejemplo n.º 12
0
        public void TestChocolateToppingOnEspresso()
        {
            AcuCafe cafe = new AcuCafe(_drinkFactory, _drinkIngredientFactory, _baristaInformer, _logger);
            IDrink  d    = cafe.OrderDrink("Espresso", new[] { "chocolate topping" });

            Assert.IsTrue(d.IsValid);
            Assert.AreEqual(1.8, d.Cost());

            // Now try with milk
            d = cafe.OrderDrink("Espresso", new[] { "milk", "chocolate topping" });
            Assert.IsTrue(d.IsValid);
            Assert.AreEqual(2.3, d.Cost());

            // Now try with sugar
            d = cafe.OrderDrink("Espresso", new[] { "sugar", "chocolate topping" });
            Assert.IsTrue(d.IsValid);
            Assert.AreEqual(2.3, d.Cost());

            // Now try with milk and sugar
            d = cafe.OrderDrink("Espresso", new[] { "milk", "sugar", "chocolate topping" });
            Assert.IsTrue(d.IsValid);
            Assert.AreEqual(2.8, d.Cost());
        }
Ejemplo n.º 13
0
        public void EnsureIceTeaCannotHaveMilk()
        {
            var result = AcuCafe.OrderDrink("IceTea", true, false);

            Assert.IsFalse(result.HasBeenPrepared);
        }
Ejemplo n.º 14
0
        public void EnsureExpressoCanHaveChocolate()
        {
            var result = AcuCafe.OrderDrink("Expresso", false, false, true);

            Assert.IsTrue(result.Toppings.Any(t => t.Type == ToppingType.Chocolate));
        }
Ejemplo n.º 15
0
 public void Setup()
 {
     cafe = new AcuCafe();
 }
Ejemplo n.º 16
0
        public void Container_Return_AcuCafeInstace()
        {
            AcuCafe acuCafe = _container.GetInstance <AcuCafe>();

            Assert.NotNull(acuCafe);
        }
Ejemplo n.º 17
0
 public void IceTeaMilkException2()
 {
     var cafe = new AcuCafe();
     var iceTeaMilkAndSugar = cafe.OrderDrink(Enumerations.DrinkType.IceTea, true, true);
 }