public virtual bool Process(BankAccountDetails bankAccountDetails) { bankAccountDetails.FirstResult = _firstStepRouter.GetModulusCalculation(bankAccountDetails); if (bankAccountDetails.RequiresCouttsAccountCheck()) { return ExceptionFourteenForCouttsAccounts(bankAccountDetails); } if (bankAccountDetails.WeightMappings.Count() == 1 || !bankAccountDetails.IsSecondCheckRequired()) { return bankAccountDetails.FirstResult; } if (bankAccountDetails.IsExceptionTwoAndFirstCheckPassed()) return true; return bankAccountDetails.IsExceptionThreeAndCanSkipSecondCheck() ? bankAccountDetails.FirstResult : _secondModulusCalculatorStep.Process(bankAccountDetails); }
public void CanIdentifyIfSecondCheckIsRequired(string sc, string an, int desiredMappings, int exception, bool expected) { var target = new BankAccountDetails(sc, an) { WeightMappings = BuildMappingList(sc, desiredMappings, exception) }; Assert.AreEqual(expected, target.IsSecondCheckRequired()); }