コード例 #1
0
        public void CalculateTotal_ReturnItemPrice_whenAddingOneItem(double price, int quantity, double expected)
        {
            //Fixture setup
            var            shoppingCart = GetShoppingCartWithItems(price, quantity);
            calculateTotal calTotal     = new calculateTotal(shoppingCart);
            //Exercise system
            var actual = calTotal.CalculateTotal();

            //verify outcome
            Assert.AreEqual(actual, expected);
        }
コード例 #2
0
        public void CalculateTotal_ReturnTotalPrice_WithManyItems(double[] prices, int[] quantities, double expected)
        {
            //Fixture setup
            var            shoppingCart = GetShoppingCartWithManyItems(prices, quantities);
            calculateTotal calTotal     = new calculateTotal(shoppingCart);
            //Exercise system
            var actual = calTotal.CalculateTotal();

            //verify outcome
            Assert.AreEqual(actual, expected);
        }
コード例 #3
0
        public void CalculateTotal_ReturnZero_WithEmptyCrat()
        {
            //Fixture setup
            var            shoppingCart = GetShoppingCartWithNoItems();
            calculateTotal calTotal     = new calculateTotal(shoppingCart);
            //Exercise system
            var actual = calTotal.CalculateTotal();

            //verify outcome
            Assert.AreEqual(actual, 0);
        }