public void IsApplication_Should_Return_False_For_Other_Product() { var rule = new UpgradeProductRule(); var product = new Product { Type = ProductType.Membership }; rule.IsApplicable(product).Should().BeFalse(); }
public void IsApplication_Should_Return_True_For_Upgrade_Product() { var rule = new UpgradeProductRule(); var product = new Product { Type = ProductType.Upgrade }; rule.IsApplicable(product).Should().BeTrue(); rule.Apply().Should().Be("Applying the upgrade"); }
public void Upgrade_Product_Rule_Test() { IBussinessRuleEngine businessEngine = new BusinessRuleEngine(); var rule = new UpgradeProductRule(); businessEngine.AddRule(rule); var agent = new Agent { Name = "Test" }; var product = new Product { Attribute = ProductAttribute.NONPHYSICAL, Id = 1, Type = ProductType.Upgrade, Name = "Upgrade to Premium" }; var orderEngine = new OrderProcessor(businessEngine, agent); orderEngine.Add(new OrderLine(product, 1)); orderEngine.Process().Single().Should().Be("Applying the upgrade"); }