Exemplo n.º 1
0
        public void T12_English_Burger_Should_Cost_25()
        {
            // Given
            var cook         = new Cook();
            var burger       = cook.Create(new EnglishBurgerMaker());
            var cashRegister = new CashRegister();
            // When
            var price = cashRegister.HowMuch(burger);

            // Then
            Assert.AreEqual(price, 25);
        }
Exemplo n.º 2
0
        public void T10_Cheap_Burger_Should_Cost_0()
        {
            // Given
            var cook         = new Cook();
            var cheepBurger  = cook.Create(null);
            var cashRegister = new CashRegister();
            // When
            var price = cashRegister.HowMuch(cheepBurger);

            // Then
            Assert.AreEqual(price, 0);
        }
Exemplo n.º 3
0
        public void T11_Vege_Burger_Should_Cost_5()
        {
            // Given
            var cook         = new Cook();
            var burger       = cook.Create(new VegeBurgerMaker());
            var cashRegister = new CashRegister();
            // When
            var price = cashRegister.HowMuch(burger);

            // Then
            Assert.AreEqual(price, 5);
        }
Exemplo n.º 4
0
        public void T10_Double_Cheese_Burger_Should_Cost_20()
        {
            // Given
            var cook         = new Cook();
            var burger       = cook.Create(new DoubleCheeseburgerMaker());
            var cashRegister = new CashRegister();
            // When
            var price = cashRegister.HowMuch(burger);

            // Then
            Assert.AreEqual(price, 20);
        }
Exemplo n.º 5
0
        public void T05_None_BurgerMaker_ShouldReturn_None_Burger()
        {
            // Given
            var cook = new Cook();
            // When
            var burger  = cook.Create(null);
            var burger2 = burger;

            // Then
            Assert.AreEqual(burger.Meet.Type, MeetType.None);
            Assert.AreEqual(burger.Cheeseness, Cheeseness.None);
            Assert.AreEqual(burger.Addons.Contains(AddonType.None), true);
        }
Exemplo n.º 6
0
        public void T08_VegeBurgerMaker_Should_Create_Perfect_VegeSomething()
        {
            // Given
            var cook        = new Cook();
            var burgerMaker = new VegeBurgerMaker();
            // When
            var burger = cook.Create(burgerMaker);

            // Then
            Assert.AreEqual(burger.Meet.Type, MeetType.None);
            Assert.AreEqual(burger.Cheeseness, Cheeseness.Single);
            Assert.AreEqual(burger.Addons.Contains(AddonType.None), true);
        }
Exemplo n.º 7
0
        public void T07_DoubleCheesburgerMaker_Should_Create_Perfect_Double_Cheesburger()
        {
            // Given
            var cook        = new Cook();
            var burgerMaker = new DoubleCheeseburgerMaker();
            // When
            var burger = cook.Create(burgerMaker);

            // Then
            Assert.AreEqual(burger.Meet.Type, MeetType.Medium);
            Assert.AreEqual(burger.Cheeseness, Cheeseness.Double);
            Assert.AreEqual(burger.Addons.Contains(AddonType.None), true);
        }
Exemplo n.º 8
0
        public void T13_Cheap_Burger_On_11_11_2019_Should_Cost_Minus_15()
        {
            // Given
            var cook         = new Cook();
            var burger       = cook.Create(null);
            var cashRegister = new CashRegister(new TodayIs1111DiscountCalculator());
            // When
            var price = cashRegister.HowMuch(burger);

            // Then
            Assert.AreEqual(price, -15);
            //Your task is to tell me why this is alway (almost) red.
        }
Exemplo n.º 9
0
        public void T09_EnglishBurgerMaker_Should_Create_Perfect_English_Burger()
        {
            // Given
            var cook        = new Cook();
            var burgerMaker = new EnglishBurgerMaker();
            // When
            var burger = cook.Create(burgerMaker);

            // Then
            Assert.AreEqual(burger.Meet.Type, MeetType.Full);
            Assert.AreEqual(burger.Addons.Contains(AddonType.Halapenio), true);
            Assert.AreEqual(burger.Addons.Contains(AddonType.Egg), true);
            Assert.AreEqual(burger.Cheeseness, Cheeseness.Single);
        }
Exemplo n.º 10
0
        public void T13_Bis_Cheap_Burger_On_11_11_2019_Should_Cost_Minus_15()
        {
            var mock = new Mock <IDiscountCalculator>();

            mock.Setup(x => x.ChanceForWin()).Returns(1);
            mock.SetupGet(x => x.discountDateTime).Returns()
            // Given
            var cook = new Cook();
            var burger       = cook.Create(null);
            var cashRegister = new CashRegister(new TodayIs1111DiscountCalculator());
            // When
            var price = cashRegister.HowMuch(burger);

            // Then
            Assert.AreEqual(price, -15);
        }
Exemplo n.º 11
0
        public void T15_IF_burger_have_50percent_discount_you_dont_win_discount()
        {
            var mock = new Mock <IDiscountCalculator>();

            mock.Setup(x => x.ChanceForWin()).Returns(0);
            mock.Setup(x => x.Calculate()).Returns(-10);
            // Given
            var cook         = new Cook();
            var burger       = cook.Create(new DoubleCheeseburgerMaker());
            var cashRegister = new CashRegister(mock.Object);
            // When
            var price = cashRegister.HowMuch(burger);

            // Then
            Assert.AreEqual(price, 10);
        }
Exemplo n.º 12
0
        public void T14_Bis_Cheap_Burger_50percent_Chanse_that_Win_next_discount()
        {
            var mock = new Mock <IDiscountCalculator>();

            mock.Setup(x => x.ChanceForWin()).Returns(1);
            mock.Setup(x => x.Calculate()).Returns(-10);
            // Given
            var cook         = new Cook();
            var burger       = cook.Create(new DoubleCheeseburgerMaker());
            var cashRegister = new CashRegister(mock.Object);
            // When
            var price = cashRegister.HowMuch(burger);

            // Then
            Assert.AreEqual(price, 5);
        }