The first step is to test if the given sort code can be found in the Modulus Weight Mappings. If not it is presumed to be valid
 public void Before()
 {
     var mappingSource = new Mock<IRuleMappingSource>();
     mappingSource.Setup(ms => ms.GetModulusWeightMappings)
         .Returns(new []
         {
             ModulusWeightMapping.From(
                 "010004 010006 MOD10 2 1 2 1 2  1 2 1 2 1 2 1 2 1"),
             ModulusWeightMapping.From(
                 "010004 010006 DBLAL 2 1 2 1 2  1 2 1 2 1 2 1 2 1"),
             ModulusWeightMapping.From(
                 "010007 010010 DBLAL  2 1 2 1 2  1 2 1 2 1 2 1 2 1"),
             ModulusWeightMapping.From(
                 "010011 010013 MOD11    2 1 2 1 2  1 2 1 2 1 2 1 2 1"),
             ModulusWeightMapping.From(
                 "010014 010014 MOD11    2 1 2 1 2  1 2 1 2 1 2 1 2 1 5")
         });
     _mockModulusWeightTable = new Mock<IModulusWeightTable>();
     _mockModulusWeightTable.Setup(mwt => mwt.GetRuleMappings(new SortCode("010004"))).Returns(
         new[]
         {
             ModulusWeightMapping.From(
                 "010004 010006 MOD10 2 1 2 1 2  1 2 1 2 1 2 1 2 1"),
             ModulusWeightMapping.From(
                 "010004 010006 DBLAL 2 1 2 1 2  1 2 1 2 1 2 1 2 1"),
         });
     _mockModulusWeightTable.Setup(mwt => mwt.GetRuleMappings(new SortCode("010009"))).Returns(
         new []
         {
             ModulusWeightMapping.From(
                 "010007 010010 DBLAL  2 1 2 1 2  1 2 1 2 1 2 1 2 1")
         });
     _firstModulusCalculatorStep = new Mock<FirstModulusCalculatorStep>();
     _firstModulusCalculatorStep.Setup(fmc => fmc.Process(It.IsAny<BankAccountDetails>())).
         Returns(false);
     _ruleStep = new ConfirmDetailsAreValidForModulusCheck(_firstModulusCalculatorStep.Object);
 }
Ejemplo n.º 2
0
 private static void ValidateModulusCalculator(string sc, string an, bool expectedResult)
 {
     var accountDetails = new BankAccountDetails(sc, an);
     accountDetails.WeightMappings = ModulusWeightTable.GetInstance.GetRuleMappings(accountDetails.SortCode);
     var result = new ConfirmDetailsAreValidForModulusCheck().Process(accountDetails);
     Assert.AreEqual(expectedResult, result);
 }