コード例 #1
0
        public void CalcOrderCostOneItem_ReturnsTotalCost_Cost()
        {
            // Arrange
            string flavor      = "Plain";
            int    orderNumber = 1;
            int    price       = 5;
            int    orderTotal  = 5;
            Bread  newBread    = new Bread(flavor, price);
            // Act
            double result = newBread.CalculateOrderCost(orderNumber);

            // Assert
            Assert.AreEqual(orderTotal, result);
        }
コード例 #2
0
        public void CalcOrderCostFiveItems_ReturnsTotalWithDiscount_Total()
        {
            // Arrange
            string flavor        = "Plain";
            int    orderQuantity = 5;
            int    price         = 5;
            int    orderTotal    = 20;
            Bread  newBread      = new Bread(flavor, price);
            // Act
            double result = newBread.CalculateOrderCost(orderQuantity);

            // Assert
            Assert.AreEqual(orderTotal, result);
        }
コード例 #3
0
        public void CalculateOrderCost_GetCostOfOrder_Int()
        {
            int numOfLoaves = 2;

            Bread fourthBreadOrder = new Bread(numOfLoaves);

            int totalCostForLoaves = fourthBreadOrder.CalculateLoafCost(numOfLoaves);

            int totalCostForPastries = 5;

            int totalOrderCost = totalCostForLoaves + totalCostForPastries;

            Assert.AreEqual(totalCostForLoaves, fourthBreadOrder.CalculateLoafCost(numOfLoaves));

            Assert.AreEqual(totalOrderCost, fourthBreadOrder.CalculateOrderCost(totalCostForLoaves, totalCostForPastries));
        }