Пример #1
0
        /// <summary>
        /// Test that when the AppyPromotionRule called, the <c>Product</c> properties are updated appropriately
        /// with the given <c>IPromotionPricingRule</c> properties
        /// is null
        /// </summary>
        public void TestAppyPromotionRuleUpdatesProductWithRuleProperties( )
        {
            var product   = new StockKeepingUnit("A", 5);
            var promoRule = new SpecialPricingRule("Test", 20, 0, 0);

            product.AppyPromotionRule(promoRule);

            Assert.AreEqual(20, product.Price);
            Assert.IsTrue(product.IsPromoProduct);
            Assert.IsTrue(product.Name.Equals("A"));
            Assert.IsNotNull(product.CurrentPromoPricingRule);
        }
Пример #2
0
        /// <summary>
        /// Test that when the EndPromo called, the <c>Product</c> properties are re-initialised with the given price
        /// with the given <c>IPromotionPricingRule</c> properties
        /// is null
        /// </summary>
        public void TestEndPromoReinitialisedProductWithGivenPrice( )
        {
            var product   = new StockKeepingUnit("A", 5);
            var promoRule = new SpecialPricingRule("Test", 40, 0, 0);

            product.AppyPromotionRule(promoRule);

            // Now end the promo
            product.EndPromo(6);

            Assert.AreEqual(6, product.Price);
            Assert.IsFalse(product.IsPromoProduct);
            Assert.IsTrue(product.Name.Equals("A"));
            Assert.IsNull(product.CurrentPromoPricingRule);
        }
Пример #3
0
        public void TestApplyPromoThrowsIfRuleIsNull( )
        {
            var product = new StockKeepingUnit("A", 5);

            product.AppyPromotionRule(null);
        }