Exemple #1
0
        public void CanExplainWhyItDoesNotCallSecondCheck()
        {
            var bankAccountDetails = BankDetailsTestMother.BankDetailsWithException(3);

            var modulusCheckOutcome = _isSecondCheckRequiredGate.Process(bankAccountDetails);

            Assert.AreEqual("first weight mapping exception does not require second check", modulusCheckOutcome.Explanation);
        }
Exemple #2
0
        public void DoesNotCallSecondCheckIfExceptionDoesNotRequireIt(int exception)
        {
            var bankAccountDetails = BankDetailsTestMother.BankDetailsWithException(exception);

            _isSecondCheckRequiredGate.Process(bankAccountDetails);

            _nextStep.Verify(ns => ns.Process(bankAccountDetails), Times.Never);
        }
Exemple #3
0
        public void ExceptionRequiresSecondCheckItCallsNext(int exception)
        {
            var bankAccountDetails = BankDetailsTestMother.BankDetailsWithException(exception);

            _isSecondCheckRequiredGate.Process(bankAccountDetails);

            _nextStep.Verify(ns => ns.Process(bankAccountDetails), Times.Once);
        }
Exemple #4
0
            public void ItExplainsThatItCallsTheExceptionCalculatorWhenTheFirstTestFails()
            {
                var details = BankDetailsTestMother.BankDetailsWithException(14);

                details.FirstResult = false;

                var modulusCheckOutcome = _exceptionFourteenGate.Process(details);

                Assert.AreEqual("StandardModulusExceptionFourteenCalculator", modulusCheckOutcome.Explanation);
            }
Exemple #5
0
            public void ItExplainsThatItReturnsFirstResultWhenThatPasses()
            {
                var details = BankDetailsTestMother.BankDetailsWithException(14);

                details.FirstResult = true;

                var modulusCheckOutcome = _exceptionFourteenGate.Process(details);

                Assert.AreEqual("Coutts Account with passing first check", modulusCheckOutcome.Explanation);
            }
Exemple #6
0
        public void CanCallNextStepWhenAccountDoesNotQualifyToSkip(int exception, bool firstCheck)
        {
            var details = BankDetailsTestMother.BankDetailsWithException(exception);

            details.FirstResult = firstCheck;

            _isExceptionTwoAndFirstCheckPassedGate.Process(details);

            _nextStep.Verify(ns => ns.Process(details), Times.Once);
        }
Exemple #7
0
        public void CanExplainSkippingSecondCheck()
        {
            var details = BankDetailsTestMother.BankDetailsWithException(2);

            details.FirstResult = true;

            var modulusCheckOutcome = _isExceptionTwoAndFirstCheckPassedGate.Process(details);

            Assert.AreEqual("IsExceptionTwoAndFirstCheckPassed", modulusCheckOutcome.Explanation);
        }
Exemple #8
0
        public void CanSkipSecondCheckForExceptionTwoWithPassedFirstCheck()
        {
            var details = BankDetailsTestMother.BankDetailsWithException(2);

            details.FirstResult = true;

            _isExceptionTwoAndFirstCheckPassedGate.Process(details);

            _nextStep.Verify(ns => ns.Process(details), Times.Never);
        }
Exemple #9
0
            public void ItCallsTheExceptionCalculatorWhenTheFirstTestFails()
            {
                var details = BankDetailsTestMother.BankDetailsWithException(14);

                details.FirstResult = false;

                _exceptionFourteenGate.Process(details);

                _nextStep.Verify(ns => ns.Process(details), Times.Never);
                _mockCalc.Verify(mc => mc.Process(details), Times.Once);
            }
Exemple #10
0
            public void ItReturnsFirstResultWhenThatPasses()
            {
                var details = BankDetailsTestMother.BankDetailsWithException(14);

                details.FirstResult = true;

                _exceptionFourteenGate.Process(details);

                _nextStep.Verify(ns => ns.Process(details), Times.Never);
                _mockCalc.Verify(mc => mc.Process(details), Times.Never);
            }
Exemple #11
0
            public void ItCallsTheNextStep()
            {
                var mockCalc = new Mock <StandardModulusExceptionFourteenCalculator>();
                var nextStep = new Mock <IProcessAStep>();
                var gate     = new ExceptionFourteenGate(mockCalc.Object, nextStep.Object);

                var details = BankDetailsTestMother.BankDetailsWithException(0);

                gate.Process(details);

                nextStep.Verify(ns => ns.Process(details), Times.Once);
                mockCalc.Verify(mc => mc.Process(details), Times.Never);
            }