public IEnumerable <IErrorMessageParameter> BuildMessageParametersFor(ILearnerEmploymentStatus theEmployment) => new[]
 {
     BuildErrorMessageParameter(PropertyNameConstants.DateEmpStatApp, theEmployment.DateEmpStatApp)
 };
 public bool IsNotValid(ILearnerEmploymentStatus employmentStatus) =>
 IsQualifyingPeriod(employmentStatus) && IsQualifyingEmployment(employmentStatus) && !HasQualifyingIndicator(employmentStatus);
Пример #3
0
 /// <summary>
 /// Determines whether [is not valid] [the specified employment status].
 /// </summary>
 /// <param name="employmentStatus">The employment status.</param>
 /// <param name="lastViabledate">The last viabledate.</param>
 /// <returns>
 ///   <c>true</c> if [is not valid] [the specified employment status]; otherwise, <c>false</c>.
 /// </returns>
 public bool IsNotValid(ILearnerEmploymentStatus employmentStatus, DateTime?lastViabledate) =>
 It.Has(lastViabledate) &&
 _check.HasQualifyingStart(employmentStatus, FirstViableDate, lastViabledate) &&
 IsQualifyingEmployment(employmentStatus) &&
 !HasQualifyingIndicator(employmentStatus);
 public bool IsNotValid(ILearningDelivery thisDelivery, ILearnerEmploymentStatus thisEmployment) =>
 !IsExcluded(thisDelivery) &&
 HasQualifyingFunding(thisDelivery) &&
 HasQualifyingStart(thisDelivery) &&
 !HasQualifyingEmployment(thisEmployment);
 public bool IsQualifyingPeriod(ILearnerEmploymentStatus employmentStatus) =>
 employmentStatus.DateEmpStatApp > LastInviableDate;
Пример #6
0
        public AppsIndicativeEarningsModel BuildModel(
            ILearner learner,
            ILearningDelivery learningDelivery,
            LearningDelivery fm36DeliveryAttribute,
            PriceEpisode fm36EpisodeAttribute,
            LarsLearningDelivery larsLearningDelivery,
            string notionalEndLevel,
            bool earliestEpisode,
            bool hasPriceEpisodes)
        {
            DateTime employmentStatusDate = learner.LearnerEmploymentStatuses?
                                            .Where(x => x.DateEmpStatApp <= learningDelivery.LearnStartDate).Select(x => x.DateEmpStatApp)
                                            .DefaultIfEmpty(DateTime.MinValue).Max() ?? DateTime.MinValue;
            ILearnerEmploymentStatus employmentStatus =
                learner.LearnerEmploymentStatuses?.SingleOrDefault(x => x.DateEmpStatApp == employmentStatusDate);

            LearningDeliveryFamSimple[] learningDeliveryFams = GetLearningDeliveryFams(learningDelivery);
            string fundingLineType = GetFundingType(fm36DeliveryAttribute?.LearningDeliveryValues, fm36EpisodeAttribute?.PriceEpisodeValues);
            var    ldms            = _stringUtilitiesService.GetArrayEntries(learningDelivery.LearningDeliveryFAMs?.Where(x => string.Equals(x.LearnDelFAMType, Constants.LearningDeliveryFAMCodeLDM, StringComparison.OrdinalIgnoreCase)), 4);

            var model = new AppsIndicativeEarningsModel
            {
                LearnRefNumber                      = learner.LearnRefNumber,
                UniqueLearnerNumber                 = learner.ULN,
                DateOfBirth                         = learner.DateOfBirthNullable?.ToString("dd/MM/yyyy"),
                PostcodePriorToEnrollment           = learner.PostcodePrior,
                CampusIdentifier                    = learner.CampId,
                ProviderSpecifiedLearnerMonitoringA = learner.ProviderSpecLearnerMonitorings
                                                      ?.SingleOrDefault(x => string.Equals(x.ProvSpecLearnMonOccur, "A", StringComparison.OrdinalIgnoreCase))?.ProvSpecLearnMon,
                ProviderSpecifiedLearnerMonitoringB = learner.ProviderSpecLearnerMonitorings
                                                      ?.SingleOrDefault(x => string.Equals(x.ProvSpecLearnMonOccur, "B", StringComparison.OrdinalIgnoreCase))?.ProvSpecLearnMon,
                AimSeqNumber                  = learningDelivery.AimSeqNumber,
                LearningAimReference          = learningDelivery.LearnAimRef,
                LearningAimTitle              = larsLearningDelivery?.LearningAimTitle,
                SoftwareSupplierAimIdentifier = learningDelivery.SWSupAimId,
                LARS1618FrameworkUplift       = fm36DeliveryAttribute?.LearningDeliveryValues
                                                ?.LearnDelApplicProv1618FrameworkUplift,
                NotionalNVQLevel         = larsLearningDelivery?.NotionalNvqLevel,
                StandardNotionalEndLevel = notionalEndLevel,
                Tier2SectorSubjectArea   = larsLearningDelivery?.Tier2SectorSubjectArea,
                ProgrammeType            = learningDelivery.ProgTypeNullable,
                StandardCode             = learningDelivery.StdCodeNullable,
                FrameworkCode            = learningDelivery.FworkCodeNullable,
                ApprenticeshipPathway    = learningDelivery.PwayCodeNullable,
                AimType                                       = learningDelivery.AimType,
                CommonComponentCode                           = larsLearningDelivery?.FrameworkCommonComponent,
                FundingModel                                  = learningDelivery.FundModel,
                OriginalLearningStartDate                     = learningDelivery.OrigLearnStartDateNullable?.ToString("dd/MM/yyyy"),
                LearningStartDate                             = learningDelivery.LearnStartDate.ToString("dd/MM/yyyy"),
                LearningPlannedEndDate                        = learningDelivery.LearnPlanEndDate.ToString("dd/MM/yyyy"),
                CompletionStatus                              = learningDelivery.CompStatus,
                LearningActualEndDate                         = learningDelivery.LearnActEndDateNullable?.ToString("dd/MM/yyyy"),
                Outcome                                       = learningDelivery.OutcomeNullable,
                FundingAdjustmentForPriorLearning             = learningDelivery.PriorLearnFundAdjNullable,
                OtherFundingAdjustment                        = learningDelivery.OtherFundAdjNullable,
                LearningDeliveryFAMTypeLearningSupportFunding = learningDeliveryFams.Select(x => x.Code).Max(),
                LearningDeliveryFAMTypeLSFDateAppliesFrom     =
                    learningDeliveryFams.Select(x => x.From).Min() == DateTime.MinValue ? string.Empty : learningDeliveryFams.Select(x => x.From).Min().ToString("dd/MM/yyyy"),
                LearningDeliveryFAMTypeLSFDateAppliesTo =
                    learningDeliveryFams.Select(x => x.To).Max() == DateTime.MinValue ? string.Empty : learningDeliveryFams.Select(x => x.To).Max().ToString("dd/MM/yyyy"),
                LearningDeliveryFAMTypeLearningDeliveryMonitoringA = ldms[0],
                LearningDeliveryFAMTypeLearningDeliveryMonitoringB = ldms[1],
                LearningDeliveryFAMTypeLearningDeliveryMonitoringC = ldms[2],
                LearningDeliveryFAMTypeLearningDeliveryMonitoringD = ldms[3],
                LearningDeliveryFAMRestartIndicator = learningDelivery.LearningDeliveryFAMs
                                                      ?.SingleOrDefault(x => string.Equals(x.LearnDelFAMType, Constants.LearningDeliveryFAMCodeRES, StringComparison.OrdinalIgnoreCase))?.LearnDelFAMCode,
                ProviderSpecifiedDeliveryMonitoringA = learningDelivery.ProviderSpecDeliveryMonitorings
                                                       ?.SingleOrDefault(x => string.Equals(x.ProvSpecDelMonOccur, "A", StringComparison.OrdinalIgnoreCase))?.ProvSpecDelMon,
                ProviderSpecifiedDeliveryMonitoringB = learningDelivery.ProviderSpecDeliveryMonitorings
                                                       ?.SingleOrDefault(x => string.Equals(x.ProvSpecDelMonOccur, "B", StringComparison.OrdinalIgnoreCase))?.ProvSpecDelMon,
                ProviderSpecifiedDeliveryMonitoringC = learningDelivery.ProviderSpecDeliveryMonitorings
                                                       ?.SingleOrDefault(x => string.Equals(x.ProvSpecDelMonOccur, "C", StringComparison.OrdinalIgnoreCase))?.ProvSpecDelMon,
                ProviderSpecifiedDeliveryMonitoringD = learningDelivery.ProviderSpecDeliveryMonitorings
                                                       ?.SingleOrDefault(x => string.Equals(x.ProvSpecDelMonOccur, "D", StringComparison.OrdinalIgnoreCase))?.ProvSpecDelMon,
                EndPointAssessmentOrganisation           = learningDelivery.EPAOrgID,
                PlannedNoOfOnProgrammeInstallmentsForAim =
                    fm36DeliveryAttribute?.LearningDeliveryValues?.PlannedNumOnProgInstalm,
                SubContractedOrPartnershipUKPRN = learningDelivery.PartnerUKPRNNullable,
                DeliveryLocationPostcode        = learningDelivery.DelLocPostCode,
                EmployerIdentifier               = employmentStatus?.EmpIdNullable,
                AgreementIdentifier              = fm36EpisodeAttribute?.PriceEpisodeValues?.PriceEpisodeAgreeId,
                EmploymentStatus                 = employmentStatus?.EmpStat,
                EmploymentStatusDate             = employmentStatus?.DateEmpStatApp.ToString("dd/MM/yyyy"),
                EmpStatusMonitoringSmallEmployer = employmentStatus?.EmploymentStatusMonitorings
                                                   ?.SingleOrDefault(x => string.Equals(x.ESMType, Constants.EmploymentStatusMonitoringTypeSEM, StringComparison.OrdinalIgnoreCase))?.ESMCode,
                PriceEpisodeStartDate =
                    fm36EpisodeAttribute?.PriceEpisodeValues?.EpisodeStartDate,
                PriceEpisodeActualEndDate =
                    fm36EpisodeAttribute?.PriceEpisodeValues?.PriceEpisodeActualEndDate?.ToString("dd/MM/yyyy"),
                FundingLineType = fundingLineType,
                TotalPriceApplicableToThisEpisode =
                    fm36EpisodeAttribute?.PriceEpisodeValues?.PriceEpisodeTotalTNPPrice,
                FundingBandUpperLimit            = fm36EpisodeAttribute?.PriceEpisodeValues?.PriceEpisodeUpperBandLimit,
                PriceAmountAboveFundingBandLimit =
                    fm36EpisodeAttribute?.PriceEpisodeValues?.PriceEpisodeUpperLimitAdjustment,
                PriceAmountRemainingStartOfEpisode = fm36EpisodeAttribute?.PriceEpisodeValues
                                                     ?.PriceEpisodeCappedRemainingTNPAmount,
                CompletionElement = fm36EpisodeAttribute?.PriceEpisodeValues?.PriceEpisodeCompletionElement
            };

            if (learningDelivery?.LearningDeliveryFAMs != null)
            {
                CalculateApprenticeshipContractTypeFields(
                    learningDelivery,
                    model,
                    fm36DeliveryAttribute,
                    fm36EpisodeAttribute,
                    hasPriceEpisodes);
            }

            if (earliestEpisode)
            {
                CalculateAppFinTotals(model, learningDelivery);
            }

            foreach (var command in _commands)
            {
                command.Execute(model, fm36DeliveryAttribute, fm36EpisodeAttribute);
            }

            GetTotals(model);

            return(model);
        }
Пример #7
0
 public LearnerEmploymentStatus BuildLearnerEmploymentStatus(int ukprn, ILearner learner, ILearnerEmploymentStatus learnerEmploymentStatus)
 {
     return(new LearnerEmploymentStatus
     {
         UKPRN = ukprn,
         LearnRefNumber = learner.LearnRefNumber,
         DateEmpStatApp = learnerEmploymentStatus.DateEmpStatApp,
         EmpId = learnerEmploymentStatus.EmpIdNullable,
         EmpStat = learnerEmploymentStatus.EmpStat
     });
 }
 /// <summary>
 /// Determines whether [has qualifying employment] [this employment].
 /// </summary>
 /// <param name="thisEmployment">this employment.</param>
 /// <returns>
 ///   <c>true</c> if [has qualifying employment] [this employment]; otherwise, <c>false</c>.
 /// </returns>
 public bool HasQualifyingEmployment(ILearnerEmploymentStatus thisEmployment) =>
 It.Has(thisEmployment);
 public bool IsNotValid(ILearnerEmploymentStatus employment) =>
 employment.EmpIdNullable.HasValue &&
 employment.EmpIdNullable != ValidationConstants.TemporaryEmployerId &&
 !HasValidChecksum(employment.EmpIdNullable.Value);
 public bool IsNotValid(ILearnerEmploymentStatus employmentStatus) =>
 employmentStatus.EmploymentStatusMonitorings.NullSafeAny(x => !InQualifyingPeriod(x, employmentStatus.DateEmpStatApp));
 public bool IsNotEmployed(ILearnerEmploymentStatus candidate) =>
 candidate?.EmpStat == EmploymentStatusEmpStats.NotEmployedNotSeekingOrNotAvailable ||
 candidate?.EmpStat == EmploymentStatusEmpStats.NotEmployedSeekingAndAvailable;
        public void InvalidItemRaisesValidationMessage()
        {
            const string LearnRefNumber = "123456789X";

            var testDate = DateTime.Parse("2013-08-01");

            var status = new Mock <ILearnerEmploymentStatus>();

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

            var mockDelivery = new Mock <ILearningDelivery>();

            mockDelivery
            .SetupGet(y => y.LearnStartDate)
            .Returns(testDate);
            mockDelivery
            .SetupGet(y => y.ProgTypeNullable)
            .Returns(25);
            mockDelivery
            .SetupGet(y => y.FundModel)
            .Returns(25);

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

            var mockLearner = new Mock <ILearner>();

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

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

            handler
            .Setup(x => x.Handle("EmpStat_06", LearnRefNumber, 0, It.IsAny <IEnumerable <IErrorMessageParameter> >()));
            handler
            .Setup(x => x.BuildErrorMessageParameter("DateEmpStatApp", null))
            .Returns(new Mock <IErrorMessageParameter>().Object);
            handler
            .Setup(x => x.BuildErrorMessageParameter("PlanLearnHours", null))
            .Returns(new Mock <IErrorMessageParameter>().Object);
            handler
            .Setup(x => x.BuildErrorMessageParameter("PlanEEPHours", null))
            .Returns(new Mock <IErrorMessageParameter>().Object);
            handler
            .Setup(x => x.BuildErrorMessageParameter("LearnStartDate", AbstractRule.AsRequiredCultureDate(testDate)))
            .Returns(new Mock <IErrorMessageParameter>().Object);

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

            dateTimeQS
            .Setup(x => x.IsDateBetween(mockDelivery.Object.LearnStartDate, EmpStat_06Rule.FirstViableDate, EmpStat_06Rule.LastViableDate, true))
            .Returns(true);

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

            lEmpQS
            .Setup(x => x.LearnerEmploymentStatusForDate(employmentStatuses, testDate))
            .Returns((ILearnerEmploymentStatus)null);

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

            sut.Validate(mockLearner.Object);

            handler.VerifyAll();
            dateTimeQS.VerifyAll();
        }
        public void ValidItemDoesNotRaiseValidationMessage(int candidate, params int[] eligibilities)
        {
            // arrange
            const string LearnRefNumber = "123456789X";
            const string conRefNumber   = "test-Con-Ref";

            var testDate = DateTime.Parse("2016-06-14");

            var deliveries = Collection.Empty <ILearningDelivery>();

            for (int i = -5; i < 1; i++)
            {
                deliveries.Add(GetTestDelivery(testDate.AddDays(i), conRefNumber, i));
            }

            var mockStatus = new Mock <ILearnerEmploymentStatus>();

            mockStatus
            .SetupGet(x => x.EmpStat)
            .Returns(candidate);

            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.AsSafeReadOnlyList());
            mockLearner
            .SetupGet(x => x.LearnerEmploymentStatuses)
            .Returns(statii);

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

            var employmentStatuses = Collection.Empty <IEsfEligibilityRuleEmploymentStatus>();

            eligibilities.ForEach(x => employmentStatuses.Add(GetEligibility(x)));

            var fcsData = new Mock <IFCSDataService>(MockBehavior.Strict);

            fcsData
            .Setup(x => x.GetEligibilityRuleEmploymentStatusesFor(conRefNumber))
            .Returns(employmentStatuses);

            var commonOps = new Mock <IProvideRuleCommonOperations>(MockBehavior.Strict);

            commonOps
            .Setup(x => x.GetEmploymentStatusOn(testDate, statii))
            .Returns(mockStatus.Object);

            var sut = new EmpStat_14Rule(handler.Object, fcsData.Object, commonOps.Object);

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

            // assert
            handler.VerifyAll();
            fcsData.VerifyAll();
        }
 /// <summary>
 /// Determines whether the specified employment status record has qualifying start date
 /// </summary>
 /// <param name="employment">The employment.</param>
 /// <param name="minStart">The minimum start.</param>
 /// <param name="maxStart">The maximum start (if null sets to today).</param>
 /// <returns>
 ///   <c>true</c> if [has qualifying start] [the specified employment]; otherwise, <c>false</c>.
 /// </returns>
 public bool HasQualifyingStart(ILearnerEmploymentStatus employment, DateTime minStart, DateTime?maxStart = null) =>
 It.Has(employment) &&
 It.IsBetween(employment.DateEmpStatApp, minStart, maxStart ?? DateTime.MaxValue);
Пример #15
0
        public void ValidItemDoesNotRaiseValidationMessage()
        {
            const string LearnRefNumber = "123456789X";

            var testDate = DateTime.Parse("2013-08-01");

            var status = new Mock <ILearnerEmploymentStatus>();

            status
            .SetupGet(x => x.EmpIdNullable)
            .Returns(10004);
            status
            .SetupGet(x => x.EmpStat)
            .Returns(EmploymentStatusEmpStats.InPaidEmployment);

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

            var mockDelivery = new Mock <ILearningDelivery>();

            mockDelivery
            .SetupGet(y => y.LearnStartDate)
            .Returns(testDate);
            mockDelivery
            .SetupGet(y => y.AimType)
            .Returns(1);

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

            var mockLearner = new Mock <ILearner>();

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

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

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

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

            var dd07 = new Mock <IDerivedData_07Rule>(MockBehavior.Strict);

            dd07
            .Setup(dd => dd.IsApprenticeship(mockDelivery.Object.ProgTypeNullable)).Returns(true);

            var sut = new EmpId_10Rule(handler.Object, lEmpQS.Object, dd07.Object);

            sut.Validate(mockLearner.Object);

            handler.VerifyAll();
            lEmpQS.VerifyAll();
            dd07.VerifyAll();
        }
Пример #16
0
 /// <summary>
 /// Determines whether [has qualifying employment status] [the specified e status].
 /// </summary>
 /// <param name="eStatus">The e status.</param>
 /// <param name="learningStartDate">The learning start date.</param>
 /// <returns>
 ///   <c>true</c> if [has qualifying employment status] [the specified e status]; otherwise, <c>false</c>.
 /// </returns>
 public bool HasQualifyingEmploymentStatus(ILearnerEmploymentStatus eStatus, DateTime learningStartDate) =>
 eStatus.DateEmpStatApp <= learningStartDate;
Пример #17
0
        public void InvalidItemRaisesValidationMessage()
        {
            const string LearnRefNumber = "123456789X";

            var testDate = DateTime.Parse("2013-08-01");

            var status = new Mock <ILearnerEmploymentStatus>();

            status
            .SetupGet(x => x.DateEmpStatApp)
            .Returns(testDate);
            status
            .SetupGet(x => x.EmpStat)
            .Returns(EmploymentStatusEmpStats.InPaidEmployment);

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

            var mockDelivery = new Mock <ILearningDelivery>();

            mockDelivery
            .SetupGet(y => y.LearnStartDate)
            .Returns(testDate);
            mockDelivery
            .SetupGet(y => y.AimType)
            .Returns(1);

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

            var mockLearner = new Mock <ILearner>();

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

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

            handler
            .Setup(x => x.Handle("EmpId_10", LearnRefNumber, 0, It.IsAny <IEnumerable <IErrorMessageParameter> >()));
            handler
            .Setup(x => x.BuildErrorMessageParameter("EmpId", "(missing)"))
            .Returns(new Mock <IErrorMessageParameter>().Object);
            handler
            .Setup(x => x.BuildErrorMessageParameter("EmpStat", EmploymentStatusEmpStats.InPaidEmployment))
            .Returns(new Mock <IErrorMessageParameter>().Object);
            handler
            .Setup(x => x.BuildErrorMessageParameter("LearnStartDate", AbstractRule.AsRequiredCultureDate(testDate)))
            .Returns(new Mock <IErrorMessageParameter>().Object);

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

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

            var dd07 = new Mock <IDerivedData_07Rule>(MockBehavior.Strict);

            dd07
            .Setup(dd => dd.IsApprenticeship(mockDelivery.Object.ProgTypeNullable)).Returns(true);

            var sut = new EmpId_10Rule(handler.Object, lEmpQS.Object, dd07.Object);

            sut.Validate(mockLearner.Object);

            handler.VerifyAll();
            lEmpQS.VerifyAll();
            dd07.VerifyAll();
        }
        public void InvalidItemRaisesValidationMessage()
        {
            // arrange
            const string LearnRefNumber = "123456789X";

            var testDate = DateTime.Parse("2013-08-01");

            var status = new Mock <ILearnerEmploymentStatus>();

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

            var mockDelivery = new Mock <ILearningDelivery>();

            mockDelivery
            .SetupGet(y => y.LearnStartDate)
            .Returns(testDate);

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

            var mockLearner = new Mock <ILearner>();

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

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

            handler
            .Setup(x => x.Handle("EmpStat_06", LearnRefNumber, 0, It.IsAny <IEnumerable <IErrorMessageParameter> >()));
            handler
            .Setup(x => x.BuildErrorMessageParameter("DateEmpStatApp", null))
            .Returns(new Mock <IErrorMessageParameter>().Object);
            handler
            .Setup(x => x.BuildErrorMessageParameter("PlanLearnHours", null))
            .Returns(new Mock <IErrorMessageParameter>().Object);
            handler
            .Setup(x => x.BuildErrorMessageParameter("PlanEEPHours", null))
            .Returns(new Mock <IErrorMessageParameter>().Object);
            handler
            .Setup(x => x.BuildErrorMessageParameter("LearnStartDate", AbstractRule.AsRequiredCultureDate(testDate)))
            .Returns(new Mock <IErrorMessageParameter>().Object);

            var commonOps = new Mock <IProvideRuleCommonOperations>(MockBehavior.Strict);

            commonOps
            .Setup(x => x.GetEmploymentStatusOn(testDate, statii))
            .Returns((ILearnerEmploymentStatus)null);
            commonOps
            .Setup(x => x.HasQualifyingFunding(mockDelivery.Object, 25, 82))
            .Returns(true);
            commonOps
            .Setup(x => x.HasQualifyingStart(mockDelivery.Object, DateTime.Parse("2013-08-01"), DateTime.Parse("2014-07-31")))
            .Returns(true);
            commonOps
            .Setup(x => x.IsTraineeship(mockDelivery.Object))
            .Returns(false);

            var sut = new EmpStat_06Rule(handler.Object, commonOps.Object);

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

            // assert
            handler.VerifyAll();
            commonOps.VerifyAll();
        }
Пример #19
0
 public bool IsNotValid(ILearnerEmploymentStatus status) =>
 !_lookupDetails.Contains(TypeOfIntegerCodedLookup.EmpStat, status.EmpStat);
Пример #20
0
 /// <summary>
 /// Determines whether [is not employed] [the specified candidate].
 /// </summary>
 /// <param name="candidate">The candidate.</param>
 /// <returns>
 ///   <c>true</c> if [is not employed] [the specified candidate]; otherwise, <c>false</c>.
 /// </returns>
 public bool IsNotEmployed(ILearnerEmploymentStatus candidate) =>
 It.IsInRange(
     candidate?.EmpStat,
     TypeOfEmploymentStatus.NotEmployedNotSeekingOrNotAvailable,
     TypeOfEmploymentStatus.NotEmployedSeekingAndAvailable);
Пример #21
0
 public EmploymentStatusMonitoring BuildEmploymentStatusMonitoring(int ukprn, ILearner learner, ILearnerEmploymentStatus learnerEmploymentStatus, IEmploymentStatusMonitoring employmentStatusMonitoring)
 {
     return(new EmploymentStatusMonitoring
     {
         UKPRN = ukprn,
         LearnRefNumber = learner.LearnRefNumber,
         DateEmpStatApp = learnerEmploymentStatus.DateEmpStatApp,
         ESMCode = employmentStatusMonitoring.ESMCode,
         ESMType = employmentStatusMonitoring.ESMType
     });
 }
Пример #22
0
 /// <summary>
 /// Determines whether [in receipt of benefits] [the specified learner employment status].
 /// </summary>
 /// <param name="learnerEmploymentStatus">The learner employment status.</param>
 /// <returns>
 ///   <c>true</c> if [in receipt of benefits] [the specified learner employment status]; otherwise, <c>false</c>.
 /// </returns>
 public bool InReceiptOfBenefits(ILearnerEmploymentStatus learnerEmploymentStatus) =>
 learnerEmploymentStatus.EmploymentStatusMonitorings.SafeAny(InReceiptOfAnotherBenefit);
 public bool HasQualifyingEmployment(ILearnerEmploymentStatus thisEmployment) =>
 thisEmployment != null;
Пример #24
0
 /// <summary>
 /// Determines whether [in receipt of universal credits] [the specified learner employment status].
 /// </summary>
 /// <param name="learnerEmploymentStatus">The learner employment status.</param>
 /// <returns>
 ///   <c>true</c> if [in receipt of credites] [the specified learner employment status]; otherwise, <c>false</c>.
 /// </returns>
 public bool InReceiptOfCredits(ILearnerEmploymentStatus learnerEmploymentStatus) =>
 learnerEmploymentStatus.EmploymentStatusMonitorings.SafeAny(InReceiptOfUniversalCredit);
 public bool IsQualifyingEmployment(ILearnerEmploymentStatus employmentStatus) =>
 employmentStatus.EmpStat == EmploymentStatusEmpStats.NotEmployedSeekingAndAvailable;
Пример #26
0
 public bool EmpStatusCondition(ILearnerEmploymentStatus employmentStatus, IEnumerable <ILearningDeliveryFAM> learningDeliveryFAMs)
 {
     return(ValidEmpstat(employmentStatus.EmpStat) &&
            EmpStatMonitoringCondition(employmentStatus, learningDeliveryFAMs));
 }
Пример #27
0
 /// <summary>
 /// Determines whether [has qualifying indicator] [the specified employment status].
 /// </summary>
 /// <param name="employmentStatus">The employment status.</param>
 /// <returns>
 ///   <c>true</c> if [has qualifying indicator] [the specified employment status]; otherwise, <c>false</c>.
 /// </returns>
 public bool HasQualifyingIndicator(ILearnerEmploymentStatus employmentStatus) =>
 employmentStatus.EmploymentStatusMonitorings.SafeAny(HasQualifyingIndicator);
Пример #28
0
 /// <summary>
 /// Determines whether [has qualifying employment status] [the specified employment status].
 /// </summary>
 /// <param name="eStatus">The employment status.</param>
 /// <param name="thresholdDate">The threshold date.</param>
 /// <returns>
 ///   <c>true</c> if [has qualifying employment status] [the specified employment status]; otherwise, <c>false</c>.
 /// </returns>
 public bool HasQualifyingEmploymentStatus(ILearnerEmploymentStatus eStatus, DateTime thresholdDate) =>
 eStatus.DateEmpStatApp.Year <= thresholdDate.Year;
Пример #29
0
 /// <summary>
 /// Determines whether [is qualifying employment] [the specified employment status].
 /// </summary>
 /// <param name="employmentStatus">The employment status.</param>
 /// <returns>
 ///   <c>true</c> if [is qualifying employment] [the specified employment status]; otherwise, <c>false</c>.
 /// </returns>
 public bool IsQualifyingEmployment(ILearnerEmploymentStatus employmentStatus) =>
 It.IsInRange(employmentStatus.EmpStat, TypeOfEmploymentStatus.InPaidEmployment);
 public void RaiseValidationMessage(string learnRefNumber, ILearnerEmploymentStatus theEmployment) =>
 HandleValidationError(learnRefNumber, null, BuildMessageParametersFor(theEmployment));