public void LARSConditionMet_True() { string learnAimRef = "ZESF0002"; string conRefNumber = "ESF7890"; var esfEligibilityRuleSectorSubjectAreaLevels = new IEsfEligibilityRuleSectorSubjectAreaLevel[] { new EsfEligibilityRuleSectorSubjectAreaLevel() { TenderSpecReference = "tt_2976", LotReference = "01", SectorSubjectAreaCode = 13.2M, }, }; var learningDelivery = new Data.External.LARS.Model.LearningDelivery() { LearnAimRef = learnAimRef, SectorSubjectAreaTier1 = 14.2M, SectorSubjectAreaTier2 = 15.2M }; var fcsDataServiceMock = new Mock <IFCSDataService>(); var larsDataServiceMock = new Mock <ILARSDataService>(); fcsDataServiceMock.Setup(m => m.GetEligibilityRuleSectorSubjectAreaLevelsFor(conRefNumber)).Returns(esfEligibilityRuleSectorSubjectAreaLevels); larsDataServiceMock.Setup(l => l.GetDeliveryFor(learnAimRef)).Returns(learningDelivery); NewRule( fCSDataService: fcsDataServiceMock.Object, lARSDataService: larsDataServiceMock.Object) .LARSConditionMet(conRefNumber, learnAimRef).Should().BeTrue(); }
public void Validate_NoError() { string learnAimRef = "ZESF0002"; string conRefNumber = "ESF7890"; var testLearner = new TestLearner() { LearningDeliveries = new TestLearningDelivery[] { new TestLearningDelivery() { LearnAimRef = learnAimRef, ConRefNumber = conRefNumber, FundModel = TypeOfFunding.AdultSkills } } }; var esfEligibilityRuleSectorSubjectAreaLevels = new IEsfEligibilityRuleSectorSubjectAreaLevel[] { new EsfEligibilityRuleSectorSubjectAreaLevel() { TenderSpecReference = "tt_2976", LotReference = "01", SectorSubjectAreaCode = 13.2M, }, }; var learningDeliveries = new ILARSLearningDelivery[] { new Data.External.LARS.Model.LearningDelivery() { LearnAimRef = learnAimRef, SectorSubjectAreaTier1 = 14.2M, SectorSubjectAreaTier2 = 15.2M } }; var fcsDataServiceMock = new Mock <IFCSDataService>(); var larsDataServiceMock = new Mock <ILARSDataService>(); fcsDataServiceMock.Setup(m => m.GetEligibilityRuleSectorSubjectAreaLevelsFor(conRefNumber)).Returns(esfEligibilityRuleSectorSubjectAreaLevels); fcsDataServiceMock.Setup(m => m.GetEligibilityRuleSectorSubjectAreaLevelsFor("ESF223344")).Returns(new IEsfEligibilityRuleSectorSubjectAreaLevel[] { }); larsDataServiceMock.Setup(l => l.GetDeliveriesFor(learnAimRef)).Returns(learningDeliveries); using (var validationErrorHandlerMock = BuildValidationErrorHandlerMockForNoError()) { NewRule( validationErrorHandler: validationErrorHandlerMock.Object, fCSDataService: fcsDataServiceMock.Object, lARSDataService: larsDataServiceMock.Object).Validate(testLearner); } }
public void LARSConditionMet_False(string sectorSubjectArea1, string sectorSubjectArea2) { string learnAimRef = ValidationConstants.ZESF0001; string conRefNumber = "ESF223344"; var esfEligibilityRuleSectorSubjectAreaLevels = new IEsfEligibilityRuleSectorSubjectAreaLevel[] { new EsfEligibilityRuleSectorSubjectAreaLevel() { TenderSpecReference = "tt_2976", LotReference = "A1", SectorSubjectAreaCode = 13.1M, }, new EsfEligibilityRuleSectorSubjectAreaLevel() { TenderSpecReference = "tt_2978", LotReference = "A3", SectorSubjectAreaCode = 15.1M, } }; var learningDeliveries = new ILARSLearningDelivery[] { new Data.External.LARS.Model.LearningDelivery() { LearnAimRef = learnAimRef, SectorSubjectAreaTier1 = string.IsNullOrEmpty(sectorSubjectArea1) ? (decimal?)null : decimal.Parse(sectorSubjectArea1), SectorSubjectAreaTier2 = string.IsNullOrEmpty(sectorSubjectArea2) ? (decimal?)null : decimal.Parse(sectorSubjectArea2) } }; var fcsDataServiceMock = new Mock <IFCSDataService>(); var larsDataServiceMock = new Mock <ILARSDataService>(); fcsDataServiceMock.Setup(m => m.GetEligibilityRuleSectorSubjectAreaLevelsFor(conRefNumber)).Returns(esfEligibilityRuleSectorSubjectAreaLevels); larsDataServiceMock.Setup(l => l.GetDeliveriesFor(learnAimRef)).Returns(learningDeliveries); NewRule( fCSDataService: fcsDataServiceMock.Object, lARSDataService: larsDataServiceMock.Object) .LARSConditionMet(conRefNumber, learnAimRef).Should().BeFalse(); }
public void GetSectorSubjectAreaLevelsForContract_DataCheck() { string conRefNumber = "ESF0002"; var sectorSubjectAreaLevels = new IEsfEligibilityRuleSectorSubjectAreaLevel[] { new EsfEligibilityRuleSectorSubjectAreaLevel() { TenderSpecReference = "tt_9972", LotReference = "01", SectorSubjectAreaCode = 13.1M, MinLevelCode = "2", MaxLevelCode = "4" } }; var allocations = new Dictionary <string, IFcsContractAllocation> { { conRefNumber, new FcsContractAllocation { ContractAllocationNumber = conRefNumber, TenderSpecReference = "tt_9972", LotReference = "01", EsfEligibilityRule = new EsfEligibilityRule() { SectorSubjectAreaLevels = sectorSubjectAreaLevels } } }, { "101", new FcsContractAllocation { ContractAllocationNumber = "101", TenderSpecReference = "tt_9978", LotReference = "04" } }, }; var externalDataCahceMock = new Mock <IExternalDataCache>(); externalDataCahceMock.Setup(e => e.FCSContractAllocations).Returns(allocations); NewService(externalDataCahceMock.Object) .GetEligibilityRuleSectorSubjectAreaLevelsFor(conRefNumber).Should().BeSameAs(sectorSubjectAreaLevels); }
public void GetSectorSubjectAreaLevelsForContract_ContractAllocation_NullCheck() { string conRefNumber = "ESF0002"; var sectorSubjectAreaLevels = new IEsfEligibilityRuleSectorSubjectAreaLevel[] { new EsfEligibilityRuleSectorSubjectAreaLevel() { TenderSpecReference = "tt_9972", LotReference = "01", SectorSubjectAreaCode = 13.1M, MinLevelCode = "2", MaxLevelCode = "4" } }; Dictionary <string, IFcsContractAllocation> allocations = null; var externalDataCacheMock = new Mock <IExternalDataCache>(); externalDataCacheMock.Setup(e => e.FCSContractAllocations).Returns(allocations); NewService(externalDataCacheMock.Object) .GetEligibilityRuleSectorSubjectAreaLevelsFor(conRefNumber).Should().BeEmpty(); }
/// <summary> /// Determines whether [has disqualifying subject area tier2] [the specified subject area level]. /// the subject areas level is prechecked for usability, lars delivery cannot be null here /// </summary> /// <param name="subjectAreaLevel">The subject area level.</param> /// <param name="larsDelivery">The lars delivery.</param> /// <returns> /// <c>true</c> if [has disqualifying subject area tier2] [the specified subject area level]; otherwise, <c>false</c>. /// </returns> public bool HasQualifyingSubjectAreaTier2(IEsfEligibilityRuleSectorSubjectAreaLevel subjectAreaLevel, ILARSLearningDelivery larsDelivery) => It.Has(larsDelivery.SectorSubjectAreaTier2) && subjectAreaLevel.SectorSubjectAreaCode == larsDelivery.SectorSubjectAreaTier2;
/// <summary> /// Determines whether [is disqualifying subject area tier] [the specified subject area level]. /// </summary> /// <param name="subjectAreaLevel">The subject area level.</param> /// <param name="larsDelivery">The lars delivery.</param> /// <returns> /// <c>true</c> if [is disqualifying subject area tier] [the specified subject area level]; otherwise, <c>false</c>. /// </returns> public bool IsDisqualifyingSubjectAreaTier(IEsfEligibilityRuleSectorSubjectAreaLevel subjectAreaLevel, ILARSLearningDelivery larsDelivery) => !(HasQualifyingSubjectAreaTier1(subjectAreaLevel, larsDelivery) || HasQualifyingSubjectAreaTier2(subjectAreaLevel, larsDelivery));
/// <summary> /// Determines whether [has disqualifying maximum level] [the specified subject area level]. /// the subject areas level is prechecked for usability /// </summary> /// <param name="subjectAreaLevel">The subject area level.</param> /// <param name="notionalNVQLevel2">The notional NVQ level2.</param> /// <returns> /// <c>true</c> if [has disqualifying maximum level] [the specified subject area level]; otherwise, <c>false</c>. /// </returns> public bool HasDisqualifyingMaximumLevel(IEsfEligibilityRuleSectorSubjectAreaLevel subjectAreaLevel, TypeOfNotionalNVQLevelV2 notionalNVQLevel2) => notionalNVQLevel2 > subjectAreaLevel.MaxLevelCode.AsNotionalNVQLevelV2();
/// <summary> /// Determines whether [is disqualifying subject area level] [the specified subject area level]. /// the subject areas level is prechecked for usability /// </summary> /// <param name="subjectAreaLevel">The subject area level.</param> /// <param name="notionalNVQLevel2">The notional NVQ level2.</param> /// <returns> /// <c>true</c> if [is disqualifying subject area level] [the specified subject area level]; otherwise, <c>false</c>. /// </returns> public bool IsDisqualifyingSubjectAreaLevel(IEsfEligibilityRuleSectorSubjectAreaLevel subjectAreaLevel, TypeOfNotionalNVQLevelV2 notionalNVQLevel2) => !IsOutOfScope(notionalNVQLevel2) && (HasDisqualifyingMinimumLevel(subjectAreaLevel, notionalNVQLevel2) || HasDisqualifyingMaximumLevel(subjectAreaLevel, notionalNVQLevel2));
/// <summary> /// Determines whether [is usable subject area] [the specified subject area level]. /// </summary> /// <param name="subjectAreaLevel">The subject area level.</param> /// <returns> /// <c>true</c> if [is usable subject area] [the specified subject area level]; otherwise, <c>false</c>. /// </returns> public bool IsUsableSubjectArea(IEsfEligibilityRuleSectorSubjectAreaLevel subjectAreaLevel) => It.Has(subjectAreaLevel?.SectorSubjectAreaCode) && (It.Has(subjectAreaLevel.MinLevelCode) || It.Has(subjectAreaLevel.MaxLevelCode));
/// <summary> /// Determines whether [has disqualifying subject sector] [the specified subject area level]. /// the lars delivery cannot be null here /// </summary> /// <param name="subjectAreaLevel">The subject area level.</param> /// <param name="larsDelivery">The lars delivery.</param> /// <returns> /// <c>true</c> if [has disqualifying subject sector] [the specified subject area level]; otherwise, <c>false</c>. /// </returns> public bool HasDisqualifyingSubjectSector(IEsfEligibilityRuleSectorSubjectAreaLevel subjectAreaLevel, ILARSLearningDelivery larsDelivery) => IsUsableSubjectArea(subjectAreaLevel) && (IsDisqualifyingSubjectAreaLevel(subjectAreaLevel, GetNotionalNVQLevelV2(larsDelivery)) || IsDisqualifyingSubjectAreaTier(subjectAreaLevel, larsDelivery));
public bool HasDisqualifyingMinimumLevel(IEsfEligibilityRuleSectorSubjectAreaLevel subjectAreaLevel, double notionalNVQLevel2) => notionalNVQLevel2 < subjectAreaLevel.MinLevelCode.AsNotionalNVQLevelV2();
public bool IsUsableSubjectArea(IEsfEligibilityRuleSectorSubjectAreaLevel subjectAreaLevel) => subjectAreaLevel != null && !subjectAreaLevel.SectorSubjectAreaCode.HasValue && (!string.IsNullOrWhiteSpace(subjectAreaLevel.MinLevelCode) || !string.IsNullOrWhiteSpace(subjectAreaLevel.MaxLevelCode));
public bool IsUsableSubjectArea(IEsfEligibilityRuleSectorSubjectAreaLevel subjectAreaLevel) { return(subjectAreaLevel?.SectorSubjectAreaCode != null && (!string.IsNullOrWhiteSpace(subjectAreaLevel.MinLevelCode) || !string.IsNullOrWhiteSpace(subjectAreaLevel.MaxLevelCode))); }
public bool SubjectAreaTierFilter(IEsfEligibilityRuleSectorSubjectAreaLevel subjectAreaLevel, ILARSLearningDelivery larsDelivery) { return(subjectAreaLevel.SectorSubjectAreaCode == larsDelivery.SectorSubjectAreaTier1 || subjectAreaLevel.SectorSubjectAreaCode == larsDelivery.SectorSubjectAreaTier2); }
public bool IsDisqualifyingSubjectAreaLevel(IEsfEligibilityRuleSectorSubjectAreaLevel subjectAreaLevel, double notionalNVQLevel2) { return(notionalNVQLevel2 != LARSConstants.NotionalNVQLevelV2Doubles.OutOfScope && (notionalNVQLevel2 < subjectAreaLevel.MinLevelCode.AsNotionalNVQLevelV2() || notionalNVQLevel2 > subjectAreaLevel.MaxLevelCode.AsNotionalNVQLevelV2())); }