コード例 #1
0
        public void SugarCostTest()
        {
            CoffeeMachine coffee_machine = new Coffee();

            coffee_machine = new Sugar(coffee_machine);
            int expected = 52;
            int actual;

            actual = coffee_machine.GetCost();
            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        public void MultiplySugarWithCost()
        {
            //arrange
            Store  store                 = new Store();
            Sugar  sugar                 = new Sugar();
            int    sugarToBuy            = 20;
            double sugarCost             = sugar.GetCost();
            double priceOfPurchasedSugar = sugarToBuy * sugarCost;
            double result;

            //act
            result = store.NumberOfSugarPurchased(sugarToBuy);
            //assert
            Assert.AreEqual(priceOfPurchasedSugar, result);
        }