public void WhenAddingNullRuleThenExceptionIsThrown() { var pipeline = new TestPromotionPipeline(); Assert.Throws <ArgumentNullException>(() => { pipeline.AddRule(null); }); }
public void RulesAreExecutedInOrder() { var testContext = new TestContext(); var pipeline = new TestPromotionPipeline(); var ruleA = new PromotionRuleA(); var ruleB = new PromotionRuleB(); pipeline.AddRule(ruleA); pipeline.AddRule(ruleB); pipeline.Apply(testContext.CartFactory.Create()); Assert.True(pipeline.RunHistory.Any()); Assert.Equal(2, pipeline.RunHistory.Count); Assert.True((object)pipeline.RunHistory[0] == (object)ruleA); Assert.True((object)pipeline.RunHistory[1] == (object)ruleB); }