public int GetWeighting(ModulusWeightingDigit modulusWeightingDigit, string accountDetailsValue) { if (_modulusWeightingDetails == null) { return(-1); } else { return(_modulusWeightingDetails.GetScore(modulusWeightingDigit, accountDetailsValue)); } }
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)); }