/// <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); }
/// <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); }
public void TestApplyPromoThrowsIfRuleIsNull( ) { var product = new StockKeepingUnit("A", 5); product.AppyPromotionRule(null); }