public void IsQualifyingPrimaryLearningAimWithWrongAimTypeReturnsFalse()
        {
            var mockDelivery = new Mock <ILearningDelivery>();

            mockDelivery
            .SetupGet(x => x.AimType)
            .Returns(AimTypes.AimNotPartOfAProgramme);
            mockDelivery
            .SetupGet(x => x.ProgTypeNullable)
            .Returns(ProgTypes.Traineeship);

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

            dateTimeQS
            .Setup(x => x.IsDateBetween(mockDelivery.Object.LearnStartDate, DateTime.MinValue, DateTime.Parse("2018-07-31"), true))
            .Returns(true);

            var lEmpQS = new Mock <ILearnerEmploymentStatusQueryService>(MockBehavior.Strict);

            var sut = new EmpStat_18Rule(handler.Object, dateTimeQS.Object, lEmpQS.Object);

            var result = sut.IsQualifyingPrimaryLearningAim(mockDelivery.Object);

            Assert.False(result);

            handler.VerifyAll();
            dateTimeQS.VerifyAll();
        }
        public void IsQualifyingPrimaryLearningAimPassingChecksReturnsTrue()
        {
            // arrange
            var mockDelivery = new Mock <ILearningDelivery>();

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

            commonchecks
            .Setup(x => x.HasQualifyingStart(mockDelivery.Object, DateTime.MinValue, DateTime.Parse("2018-07-31")))     // EmpStat_18Rule.OldCodeMonitoringThresholdDate
            .Returns(true);
            commonchecks
            .Setup(x => x.IsTraineeship(mockDelivery.Object))
            .Returns(true);
            commonchecks
            .Setup(x => x.InAProgramme(mockDelivery.Object))
            .Returns(true);

            var sut = new EmpStat_18Rule(handler.Object, commonchecks.Object);

            // act
            var result = sut.IsQualifyingPrimaryLearningAim(mockDelivery.Object);

            // assert
            Assert.True(result);

            handler.VerifyAll();
            commonchecks.VerifyAll();
        }
        public void IsQualifyingPrimaryLearningAimWithInvalidDateReturnsFalse()
        {
            var mockDelivery = new Mock <ILearningDelivery>();

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

            dateTimeQS
            .Setup(x => x.IsDateBetween(mockDelivery.Object.LearnStartDate, DateTime.MinValue, EmpStat_18Rule.OldCodeMonitoringThresholdDate, true))
            .Returns(false);

            var lEmpQS = new Mock <ILearnerEmploymentStatusQueryService>(MockBehavior.Strict);

            var sut = new EmpStat_18Rule(handler.Object, dateTimeQS.Object, lEmpQS.Object);

            var result = sut.IsQualifyingPrimaryLearningAim(mockDelivery.Object);

            Assert.False(result);

            handler.VerifyAll();
            dateTimeQS.VerifyAll();
        }
        public void IsQualifyingPrimaryLearningAimWithInvalidDateReturnsFalse()
        {
            // arrange
            var mockDelivery = new Mock <ILearningDelivery>();

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

            commonchecks
            .Setup(x => x.HasQualifyingStart(mockDelivery.Object, DateTime.MinValue, EmpStat_18Rule.OldCodeMonitoringThresholdDate))
            .Returns(false);

            var sut = new EmpStat_18Rule(handler.Object, commonchecks.Object);

            // act
            var result = sut.IsQualifyingPrimaryLearningAim(mockDelivery.Object);

            // assert
            Assert.False(result);

            handler.VerifyAll();
            commonchecks.VerifyAll();
        }