public void ValidItemDoesNotRaiseValidationMessage(string candidate)
        {
            const string LearnRefNumber = "123456789X";
            const int    AimSeqNumber   = 1;

            var testDate = DateTime.Parse("2018-07-31");

            var mockDelivery = new Mock <ILearningDelivery>();

            mockDelivery
            .SetupGet(x => x.LearnStartDate)
            .Returns(testDate);
            mockDelivery
            .SetupGet(x => x.AimType)
            .Returns(AimTypes.ProgrammeAim);
            mockDelivery
            .SetupGet(x => x.ProgTypeNullable)
            .Returns(ProgTypes.Traineeship);
            mockDelivery
            .SetupGet(x => x.AimSeqNumber)
            .Returns(AimSeqNumber);

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

            var mockItem = new Mock <IEmploymentStatusMonitoring>(MockBehavior.Strict);

            mockItem
            .SetupGet(y => y.ESMType)
            .Returns(candidate.Substring(0, 3));
            mockItem
            .SetupGet(y => y.ESMCode)
            .Returns(int.Parse(candidate.Substring(3)));

            var monitors = new IEmploymentStatusMonitoring[] { mockItem.Object };

            var mockStatus = new Mock <ILearnerEmploymentStatus>();

            mockStatus
            .SetupGet(y => y.DateEmpStatApp)
            .Returns(testDate);
            mockStatus
            .SetupGet(y => y.EmpStat)
            .Returns(EmploymentStatusEmpStats.InPaidEmployment);
            mockStatus
            .SetupGet(y => y.EmploymentStatusMonitorings)
            .Returns(monitors);

            var employmentStatuses = new ILearnerEmploymentStatus[] { mockStatus.Object };

            var mockLearner = new Mock <ILearner>();

            mockLearner
            .SetupGet(x => x.LearnRefNumber)
            .Returns(LearnRefNumber);
            mockLearner
            .SetupGet(x => x.LearningDeliveries)
            .Returns(deliveries);
            mockLearner
            .SetupGet(x => x.LearnerEmploymentStatuses)
            .Returns(employmentStatuses);

            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(true);

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

            lEmpQS
            .Setup(x => x.LearnerEmploymentStatusForDate(employmentStatuses, testDate))
            .Returns(mockStatus.Object);

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

            sut.Validate(mockLearner.Object);

            handler.VerifyAll();
        }
Beispiel #2
0
 public bool HasDisqualifyingIndicator(IEmploymentStatusMonitoring monitor) =>
 monitor.ESMType.CaseInsensitiveEquals(Monitoring.EmploymentStatus.Types.LengthOfEmployment);
Beispiel #3
0
 /// <summary>
 /// In receipt of employment support.
 /// </summary>
 /// <param name="employmentMonitoring">The employment monitoring.</param>
 /// <returns>true if the condition is met</returns>
 public bool InReceiptOfEmploymentSupport(IEmploymentStatusMonitoring employmentMonitoring) =>
 It.IsInRange(
     $"{employmentMonitoring.ESMType}{employmentMonitoring.ESMCode}",
     Monitoring.EmploymentStatus.InReceiptOfJobSeekersAllowance,
     Monitoring.EmploymentStatus.InReceiptOfEmploymentAndSupportAllowance);
Beispiel #4
0
 /// <summary>
 /// In receipt of (other state) benefits / credits.
 /// </summary>
 /// <param name="employmentMonitoring">The employment monitoring.</param>
 /// <returns>true if the condition is met</returns>
 public bool InReceiptOfCredits(IEmploymentStatusMonitoring employmentMonitoring) =>
 It.IsInRange(
     $"{employmentMonitoring.ESMType}{employmentMonitoring.ESMCode}",
     Monitoring.EmploymentStatus.InReceiptOfAnotherStateBenefit,
     Monitoring.EmploymentStatus.InReceiptOfUniversalCredit);
 public void RaiseValidationMessage(string learnRefNumber, ILearningDelivery thisDelivery, IEmploymentStatusMonitoring thisMonitor)
 {
     HandleValidationError(learnRefNumber, thisDelivery.AimSeqNumber, BuildMessageParametersFor(thisMonitor));
 }
Beispiel #6
0
 /// <summary>
 /// Determines whether [is working short hours] [the specified monitor].
 /// </summary>
 /// <param name="monitor">The monitor.</param>
 /// <returns>
 ///   <c>true</c> if [is working short hours] [the specified monitor]; otherwise, <c>false</c>.
 /// </returns>
 public bool IsWorkingShortHours(IEmploymentStatusMonitoring monitor) =>
 It.IsInRange(
     $"{monitor.ESMType}{monitor.ESMCode}",
     Monitoring.EmploymentStatus.EmployedForLessThan16HoursPW,
     Monitoring.EmploymentStatus.EmployedFor0To10HourPW,
     Monitoring.EmploymentStatus.EmployedFor11To20HoursPW);
        public void ValidItemDoesNotRaiseValidationMessage(string candidate)
        {
            // arrange
            const string LearnRefNumber = "123456789X";
            const int    AimSeqNumber   = 1;

            var testDate = DateTime.Parse("2018-07-31");

            var mockDelivery = new Mock <ILearningDelivery>();

            mockDelivery
            .SetupGet(x => x.LearnStartDate)
            .Returns(testDate);
            mockDelivery
            .SetupGet(x => x.AimType)
            .Returns(TypeOfAim.ProgrammeAim);
            mockDelivery
            .SetupGet(x => x.ProgTypeNullable)
            .Returns(TypeOfLearningProgramme.Traineeship);
            mockDelivery
            .SetupGet(x => x.AimSeqNumber)
            .Returns(AimSeqNumber);

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

            var mockItem = new Mock <IEmploymentStatusMonitoring>(MockBehavior.Strict);

            mockItem
            .SetupGet(y => y.ESMType)
            .Returns(candidate.Substring(0, 3));
            mockItem
            .SetupGet(y => y.ESMCode)
            .Returns(int.Parse(candidate.Substring(3)));

            var monitors = new IEmploymentStatusMonitoring[] { mockItem.Object };

            var mockStatus = new Mock <ILearnerEmploymentStatus>();

            mockStatus
            .SetupGet(y => y.DateEmpStatApp)
            .Returns(testDate);
            mockStatus
            .SetupGet(y => y.EmpStat)
            .Returns(TypeOfEmploymentStatus.InPaidEmployment);
            mockStatus
            .SetupGet(y => y.EmploymentStatusMonitorings)
            .Returns(monitors);

            var statii = new ILearnerEmploymentStatus[] { mockStatus.Object };

            var mockLearner = new Mock <ILearner>();

            mockLearner
            .SetupGet(x => x.LearnRefNumber)
            .Returns(LearnRefNumber);
            mockLearner
            .SetupGet(x => x.LearningDeliveries)
            .Returns(deliveries);
            mockLearner
            .SetupGet(x => x.LearnerEmploymentStatuses)
            .Returns(statii);

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

            commonchecks
            .Setup(x => x.GetEmploymentStatusOn(testDate, statii))
            .Returns(mockStatus.Object);
            commonchecks
            .Setup(x => x.HasQualifyingStart(mockDelivery.Object, DateTime.MinValue, 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
            sut.Validate(mockLearner.Object);

            // assert
            handler.VerifyAll();
        }
 public bool HasDisqualifyingMonitor(IEmploymentStatusMonitoring thisMonitor) =>
 thisMonitor.ESMType.CaseInsensitiveEquals(Monitoring.EmploymentStatus.Types.EmploymentIntensityIndicator) &&
 !Monitoring.EmploymentStatus.EmployedForLessThan16HoursPW.CaseInsensitiveEquals($"{thisMonitor.ESMType}{thisMonitor.ESMCode}");
Beispiel #9
0
 public bool HasQualifyingIndicator(IEmploymentStatusMonitoring monitor) =>
 monitor.ESMType.CaseInsensitiveEquals(Monitoring.EmploymentStatus.Types.EmploymentIntensityIndicator);
 /// <summary>
 /// Determines whether [has qualifying indicator] [the specified monitor].
 /// </summary>
 /// <param name="monitor">The monitor.</param>
 /// <returns>
 ///   <c>true</c> if [has qualifying indicator] [the specified monitor]; otherwise, <c>false</c>.
 /// </returns>
 public bool HasQualifyingIndicator(IEmploymentStatusMonitoring monitor) =>
 It.IsInRange(monitor.ESMType, Monitoring.EmploymentStatus.Types.EmploymentIntensityIndicator);
 private void PopulateEmploymentStatusMonitoring(int ukprn, ILearner learner, ILearnerEmploymentStatus learnerEmploymentStatus, IEmploymentStatusMonitoring employmentStatusMonitoring, ValidLearnerData validLearnerData)
 {
     validLearnerData.RecordsValidEmploymentStatusMonitorings.Add(EmploymentStatusMonitoringBuilder.BuildValidEmploymentStatusMonitoring(ukprn, learner, learnerEmploymentStatus, employmentStatusMonitoring));
 }
Beispiel #12
0
 /// <summary>
 /// Determines whether [in qualifying period] [the specified monitor].
 /// </summary>
 /// <param name="monitor">The monitor.</param>
 /// <param name="candidate">The candidate.</param>
 /// <returns>
 ///   <c>true</c> if [is qualifying period] [the specified monitor]; otherwise, <c>false</c>.
 /// </returns>
 public bool InQualifyingPeriod(IEmploymentStatusMonitoring monitor, DateTime candidate) =>
 _lookups.IsCurrent(TypeOfLimitedLifeLookup.EmploymentStatusMonitoring, $"{monitor.ESMType}{monitor.ESMCode}", candidate);
Beispiel #13
0
 public bool HasQualifyingIndicator(IEmploymentStatusMonitoring monitor) =>
 $"{monitor.ESMType}{monitor.ESMCode}".CaseInsensitiveEquals(Monitoring.EmploymentStatus.SelfEmployed);