public void IsExceptionThreeAndCanSkipSecondCheck(string sortCode, string accountNumber, int exception, int[] initialWeightMapping, bool expected) { var target = new BankAccountDetails(sortCode, accountNumber) { WeightMappings = BuildMappingList(sortCode, initialWeightMapping, exception, 2) }; Assert.AreEqual(expected, target.IsExceptionThreeAndCanSkipSecondCheck()); }
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 ModulusCheckOutcome Process(BankAccountDetails bankAccountDetails) => bankAccountDetails.IsExceptionThreeAndCanSkipSecondCheck() ? new ModulusCheckOutcome("IsExceptionThreeAndCanSkipSecondCheck") : _nextStep.Process(bankAccountDetails);