public void ReturnsExpectedResultForARuleSetThatReturnsSuccess() { var rules = new List <IRule> { AnyRuleThatReturns(Result.Ok()), AnyRuleThatReturns(Result.Ok()) }; _ruleSet.GetRules().Returns(rules); _ruleSetFactory.GetRuleSet(Arg.Any <RuleSetType>()).Returns(_ruleSet); var ruleSetProcessor = new RuleSetProcessor(_ruleSetFactory); var result = ruleSetProcessor.ApplyRuleSet(new ScheduledFlightContext()); result.IsSuccess.ShouldBeTrue(); }
private RuleSet ParseRuleSet(string source, params string[] otherSources) { var dir = Temp.CreateDirectory(); var file = dir.CreateFile("a.ruleset"); file.WriteAllText(source); for (int i = 1; i <= otherSources.Length; i++) { var newFile = dir.CreateFile("file" + i + ".ruleset"); newFile.WriteAllText(otherSources[i - 1]); } if (otherSources.Length != 0) { return(RuleSet.LoadEffectiveRuleSetFromFile(file.Path)); } return(RuleSetProcessor.LoadFromFile(file.Path)); }