コード例 #1
0
        public void DoDiscountCategoryPriceTest(double price, int discountValue, Category discountCategory,
                                                Category productCategory)
        {
            var product = new Product()
            {
                BasePrice = price, ResultPrice = price, Type = productCategory
            };

            var discount = new PercentDiscount()
            {
                DiscountValue = discountValue, CategoryOfProduct = discountCategory
            };

            discount.DoDiscount(product);

            if (discount.CategoryOfProduct == product.Type || discount.CategoryOfProduct == Category.All)
            {
                Assert.That(() => product.ResultPrice, Is.EqualTo(price * (1 - (discountValue * 0.01))));
            }
        }