public bool RuleEvaluationReturnsExpectedResultWithoutOrRulesWhen(double profitFromFlight, double costOfFlight) { var rule = new RevenueExceedsCostRule(Enumerable.Empty <IRule>()); var ruleContext = new ScheduledFlightContext() { ScheduledFlightSummary = new ScheduledFlightSummary() { RevenueFromFlight = profitFromFlight, CostOfFlight = costOfFlight } }; var result = rule.Apply(ruleContext); return(result.IsSuccess); }
public bool RuleEvaluationReturnsExpectedResultWithOrRulesWhen(double profitFromFlight, double costOfFlight) { var orRule = Substitute.For <IRule>(); orRule.Apply(Arg.Any <ScheduledFlightContext>()).Returns(Result.Ok()); var rule = new RevenueExceedsCostRule(new List <IRule>() { orRule }); var ruleContext = new ScheduledFlightContext() { ScheduledFlightSummary = new ScheduledFlightSummary() { RevenueFromFlight = profitFromFlight, CostOfFlight = costOfFlight } }; var result = rule.Apply(ruleContext); return(result.IsSuccess); }