예제 #1
0
        public void ChangeProductCount_SetNegativeCount_ThrowArgumentException()
        {
            var cartManager = new ShoppingCartManager(new CommandManager());

            var product = new VanilaCandy(1, "buble", 2M, 10);

            cartManager.AddProduct(product);
            cartManager.ChangeProductCount(product, 15);

            Assert.Throws <ArgumentException>(() => cartManager.ChangeProductCount(product, -5));
        }
예제 #2
0
        public void ChangeProductCount_SetCorrectCount_SetNewCount()
        {
            var cartManager = new ShoppingCartManager(new CommandManager());

            var product = new VanilaCandy(1, "buble", 2M, 10);

            cartManager.AddProduct(product);
            cartManager.ChangeProductCount(product, 15);

            Assert.IsTrue(product.Count == 15);
        }