public void CreateModulusParameters_PassAccountDetailsNotInWeightingTable_AlwaysReturnsZero(string sortCode, string accountNo) { // Arrange var modulusWeightingDigit = new ModulusWeightingDigit(1); var bankDetails = new BankDetails(sortCode, accountNo); var modulusParametersFactory = new ModulusParametersFactory(ModulusTestHelper.CreateSingleRangeWeightingTableModulusTenPass()); // Act var modulusParameters = modulusParametersFactory.CreateModulusParameters(bankDetails); // Assert Assert.AreEqual(-1, modulusParameters.GetWeighting(modulusWeightingDigit, bankDetails.VerificationValue)); }
public void CreateModulusParameters_PassAccountDetails_ReturnsCorrectWeightingValues(int digit, int expectedValue) { // Arrange var modulusWeightingDigit = new ModulusWeightingDigit(digit); var bankDetails = new BankDetails("089999", "66374958"); var modulusParametersFactory = new ModulusParametersFactory(ModulusTestHelper.CreateSingleRangeWeightingTableModulusTenPass()); // Act var modulusParameters = modulusParametersFactory.CreateModulusParameters(bankDetails); // Assert Assert.AreEqual(expectedValue, modulusParameters.GetWeighting(modulusWeightingDigit, bankDetails.VerificationValue)); }
public static ModulusWeightingTable CreateStandardWeightingTable(ModulusCheckingMethod checkingMethod) { if (checkingMethod == ModulusCheckingMethod.StandardTen) { return(ModulusTestHelper.CreateSingleRangeWeightingTableModulusTenPass()); } else if (checkingMethod == ModulusCheckingMethod.StandardEleven) { return(ModulusTestHelper.CreateSingleRangeWeightingTableModulusElevenPass()); } else if (checkingMethod == ModulusCheckingMethod.AlternateDouble) { return(ModulusTestHelper.CreateSingleRangeWeightingTableModulusAlternateDouble()); } return(new ModulusWeightingTable(new List <ModulusWeightingDetails>())); }