public void IsApplication_Should_Return_False_For_Other_Product() { var rule = new MembershipProductRule(); var product = new Product { Type = ProductType.Upgrade }; rule.IsApplicable(product).Should().BeFalse(); }
public void IsApplication_Should_Return_True_For_Membership_Product() { var rule = new MembershipProductRule(); var product = new Product { Type = ProductType.Membership }; rule.IsApplicable(product).Should().BeTrue(); rule.Apply().Should().Be("Activating membership"); }
public void Membership_Product_Rule_Test() { IBussinessRuleEngine businessEngine = new BusinessRuleEngine(); var rule = new MembershipProductRule(); businessEngine.AddRule(rule); var agent = new Agent { Name = "Test" }; var product = new Product { Attribute = ProductAttribute.NONPHYSICAL, Id = 1, Type = ProductType.Membership, Name = "5 months subscription" }; var orderEngine = new OrderProcessor(businessEngine, agent); orderEngine.Add(new OrderLine(product, 1)); orderEngine.Process().Single().Should().Be("Activating membership"); }