public void GivenValidSfaContributionAndAmountDueShouldReturnValidPayment(decimal sfaContribution,
                                                                                  decimal amountDue,
                                                                                  decimal expectedAmount)
        {
            var message = new RequiredCoInvestedPayment
            {
                SfaContributionPercentage = sfaContribution,
                AmountDue = amountDue
            };

            validator = new Mock <IValidateRequiredPaymentEvent>();
            validator.Setup(o => o.Validate(message)).Returns(new List <RequiredCoInvestedPaymentValidationResult>());
            processor = new SfaCoInvestedPaymentProcessor(validator.Object);

            var payment = processor.Process(message);

            Assert.AreEqual(expectedAmount, payment.AmountDue);
        }
        public void ShouldThrowExceptionIfValidationResultIsNotNull()
        {
            var message = new RequiredCoInvestedPayment
            {
                SfaContributionPercentage = 0
            };

            var validationResults = new List <RequiredCoInvestedPaymentValidationResult>
            {
                new RequiredCoInvestedPaymentValidationResult
                {
                    RequiredCoInvestedPayment = message,
                    Rule = RequiredPaymentEventValidationRules.ZeroSfaContributionPercentage
                }
            };

            validator = new Mock <IValidateRequiredPaymentEvent>();
            validator.Setup(o => o.Validate(message)).Returns(validationResults);

            processor = new SfaCoInvestedPaymentProcessor(validator.Object);

            Assert.That(() => processor.Process(message), Throws.InstanceOf <FundingSourceRequiredPaymentValidationException>());
        }