public override DecisionOutcome GetCompanyDecision(Guid companyId, string clientCode, bool hasSubjectConsent) { var cDetails = this.GetCompanyDetails(companyId); var clientConf = this.GetClientConfiguration(clientCode); // If consent yes // If sole prop or single director // var iDetails = GetIndividualDetails(companyId); var rulesEngine = new CompanyDetailsRulesEngine(); var results = rulesEngine.ApplyRules(cDetails, hasSubjectConsent); // Check knockout // Check coverage // Check Decline (bracket then collective) // Check Refer (bracket then collective) // Check Approve (bracket then collective) // Check fall through action (else if none of the above) return(new DecisionOutcome { FailedRules = results.FailedRules, Outcome = DecisionType.Refer, ReferDescription = "Ädvance Risk Report" }); }
public void TestBusinessSuccess() { var companyToTest = new CompanyDetailsBuilder() .Tesla() .HealthyBusiness() .Build(); var rulesEngine = new CompanyDetailsRulesEngine(); var results = rulesEngine.ApplyRules(companyToTest, true); Assert.IsTrue(results.PercentageSucceeded > 0); }
public void TestBusinessSuccessWithWhitelistRules() { var companyToTest = new CompanyDetailsBuilder() .Tesla() .HealthyBusiness() .Build(); var rulesEngine = new CompanyDetailsRulesEngine(WhitelistRule); var results = rulesEngine.ApplyRules(companyToTest, true); Assert.IsTrue(results.TotalIgnoredRules > 0); }
public void TestMustHaveRules() { var companyToTest = new CompanyDetailsBuilder() .Tesla() .HealthyBusiness() .Build(); var rulesEngine = new CompanyDetailsRulesEngine(); var results = rulesEngine.ApplyRules(companyToTest, true); Assert.IsTrue(results.TotalApplicableRules > 0); }