public AccountCheckResult Check(BankDetails bankDetails) { var modulusparametersFactory = new ModulusParametersFactory(_modulusWeightingTable); var modulusChecker = new StandardModulusCheck(modulusparametersFactory.CreateModulusParameters(bankDetails)); return(new AccountCheckResult(modulusChecker.IsValid(bankDetails))); }
public ModulusParameters CreateModulusParameters(BankDetails bankAccount) { var modulusWeighting = _modulusWeightingTable.Find(bankAccount); ModulusCheckingMethod modulusCheckingMethod; if (modulusWeighting == null) { modulusCheckingMethod = ModulusCheckingMethod.None; } else { modulusCheckingMethod = modulusWeighting.CheckingMethod; } return(new ModulusParameters(modulusCheckingMethod, modulusWeighting)); }
public ModulusWeightingDetails Find(BankDetails bankDetails) { return(_modulusWeightings.FirstOrDefault(m => String.Compare(bankDetails.SortCode, m.FromSortCode, StringComparison.Ordinal) >= 0 && String.Compare(bankDetails.SortCode, m.ToSortCode, StringComparison.Ordinal) <= 0)); }