[InlineData("WPP", 1)] // Monitoring.Delivery.Types.WorkProgrammeParticipation
        public void InvalidItemRaisesValidationMessage(string famType, int dateOffset)
        {
            // arrange
            const string learnRefNumber = "123456789X";

            var testDate = DateTime.Parse("2017-12-30");

            var fam = new Mock <ILearningDeliveryFAM>();

            fam
            .SetupGet(x => x.LearnDelFAMType)
            .Returns(famType);
            fam
            .SetupGet(x => x.LearnDelFAMDateToNullable)
            .Returns(testDate.AddDays(dateOffset));

            var fams = new ILearningDeliveryFAM[] { fam.Object };

            var delivery = new Mock <ILearningDelivery>();

            delivery
            .SetupGet(x => x.LearnActEndDateNullable)
            .Returns(testDate);
            delivery
            .SetupGet(x => x.FundModel)
            .Returns(35);     // TypeOfFunding.AdultSkills
            delivery
            .SetupGet(x => x.LearningDeliveryFAMs)
            .Returns(fams);

            var deliveries = new ILearningDelivery[] { delivery.Object };

            var learner = new Mock <ILearner>();

            learner
            .SetupGet(x => x.LearnRefNumber)
            .Returns(learnRefNumber);
            learner
            .SetupGet(x => x.LearningDeliveries)
            .Returns(deliveries);

            var handler = new Mock <IValidationErrorHandler>(MockBehavior.Strict);

            handler
            .Setup(x => x.Handle(RuleNameConstants.LearnDelFAMDateTo_03, learnRefNumber, 0, It.IsAny <IEnumerable <IErrorMessageParameter> >()));
            handler
            .Setup(x => x.BuildErrorMessageParameter("LearnActEndDate", AbstractRule.AsRequiredCultureDate(testDate)))
            .Returns(new Mock <IErrorMessageParameter>().Object);
            handler
            .Setup(x => x.BuildErrorMessageParameter("LearnDelFAMDateTo", AbstractRule.AsRequiredCultureDate(testDate.AddDays(dateOffset))))
            .Returns(new Mock <IErrorMessageParameter>().Object);

            var sut = new LearnDelFAMDateTo_03Rule(handler.Object);

            // act
            sut.Validate(learner.Object);

            // assert
            handler.VerifyAll();
        }
        [InlineData("WPP", 0)] // Monitoring.Delivery.Types.WorkProgrammeParticipation
        public void ValidItemDoesNotRaiseValidationMessage(string famType, int dateOffset)
        {
            // arrange
            const string learnRefNumber = "123456789X";

            var testDate = DateTime.Parse("2017-12-30");

            var fam = new Mock <ILearningDeliveryFAM>();

            fam
            .SetupGet(x => x.LearnDelFAMType)
            .Returns(famType);
            fam
            .SetupGet(x => x.LearnDelFAMDateToNullable)
            .Returns(testDate.AddDays(dateOffset));

            var fams = new ILearningDeliveryFAM[] { fam.Object };

            var delivery = new Mock <ILearningDelivery>();

            delivery
            .SetupGet(x => x.LearnActEndDateNullable)
            .Returns(testDate);
            delivery
            .SetupGet(x => x.FundModel)
            .Returns(35);     // TypeOfFunding.AdultSkills
            delivery
            .SetupGet(x => x.LearningDeliveryFAMs)
            .Returns(fams);

            var deliveries = new ILearningDelivery[] { delivery.Object };

            var learner = new Mock <ILearner>();

            learner
            .SetupGet(x => x.LearnRefNumber)
            .Returns(learnRefNumber);
            learner
            .SetupGet(x => x.LearningDeliveries)
            .Returns(deliveries);

            var handler = new Mock <IValidationErrorHandler>(MockBehavior.Strict);

            var sut = new LearnDelFAMDateTo_03Rule(handler.Object);

            // act
            sut.Validate(learner.Object);

            // assert
            handler.VerifyAll();
        }
        public void HasQualifyingFundingMeetsExpectation(int fundModel, bool expectation)
        {
            // arrange
            var delivery = new Mock <ILearningDelivery>();

            delivery
            .SetupGet(y => y.FundModel)
            .Returns(fundModel);

            var handler = new Mock <IValidationErrorHandler>(MockBehavior.Strict);

            var sut = new LearnDelFAMDateTo_03Rule(handler.Object);

            // act
            var result = sut.HasQualifyingFunding(delivery.Object);

            // assert
            Assert.Equal(expectation, result);
            handler.VerifyAll();
        }