Пример #1
0
        public void ReturnZero_WhenCalledWithNoProductsInTheCarProductsCollection()
        {
            // arrange
            var cart = new FakeShoppingCart();

            // act
            var totalPrice = cart.TotalPrice();

            // assert
            Assert.AreEqual(0, totalPrice);
        }
Пример #2
0
        public void ReturnTotalPriceOfAllProductsInTheProductCollection_WhenCalledWithPresenteProducts()
        {
            // arrange
            var cart        = new FakeShoppingCart();
            var productStub = new Mock <IProduct>();

            decimal price = 22;

            productStub.Setup(x => x.Price).Returns(price);

            cart.Products.Add(productStub.Object);

            // act
            var totalPrice = cart.TotalPrice();

            // assert
            Assert.AreEqual(price, totalPrice);
        }