Exemple #1
0
        /// <summary>
        /// New service.
        /// </summary>
        /// <returns>a <seealso cref="LookupDetailsProvider"/></returns>
        public EPAOrganisationDetailsProvider NewService()
        {
            var cache = new ExternalDataCache
            {
                EPAOrganisations = new List <EPAOrganisation>
                {
                    new EPAOrganisation {
                        ID = "EPA0001", Standard = "STD0001", EffectiveFrom = DateTime.Parse("2012-01-01"), EffectiveTo = DateTime.Parse("2014-12-31")
                    },
                    new EPAOrganisation {
                        ID = "EPA0002", Standard = "STD0002", EffectiveFrom = DateTime.Parse("2013-01-01"), EffectiveTo = DateTime.Parse("2015-12-31")
                    },
                    new EPAOrganisation {
                        ID = "EPA0003", Standard = "STD0003", EffectiveFrom = DateTime.Parse("2014-01-01"), EffectiveTo = DateTime.Parse("2016-12-31")
                    },
                    new EPAOrganisation {
                        ID = "EPA0004", Standard = "STD0004", EffectiveFrom = DateTime.Parse("2015-01-01"), EffectiveTo = DateTime.Parse("2099-12-31")
                    },
                    new EPAOrganisation {
                        ID = "EPA0005", Standard = "STD0005", EffectiveFrom = DateTime.Parse("2016-01-01"), EffectiveTo = DateTime.Parse("2099-12-31")
                    },
                }
            };

            return(new EPAOrganisationDetailsProvider(cache));
        }
Exemple #2
0
        public void Populate()
        {
            var validationContextMock = new Mock <IValidationContext>();

            var externalDataCache              = new ExternalDataCache();
            var employersDataMapperMock        = new Mock <IEmployersDataMapper>();
            var epaOrgDataMapperMock           = new Mock <IEpaOrgDataMapper>();
            var fcsDataMapperMock              = new Mock <IFcsDataMapper>();
            var larsDataMapperMock             = new Mock <ILarsDataMapper>();
            var organisationsDataMapperMock    = new Mock <IOrganisationsDataMapper>();
            var postcodesDataMapperMock        = new Mock <IPostcodesDataMapper>();
            var ulnDataMapperMock              = new Mock <IUlnDataMapper>();
            var validationErrorsDataMapperMock = new Mock <IValidationErrorsDataMapper>();
            var validationRulesDataMapperMock  = new Mock <IValidationRulesDataMapper>();

            var referenceDataRoot = new ReferenceDataRoot();

            employersDataMapperMock.Setup(m => m.MapEmployers(It.IsAny <List <ReferenceDataService.Model.Employers.Employer> >())).Returns(new List <int>()).Verifiable();
            epaOrgDataMapperMock.Setup(m => m.MapEpaOrganisations(It.IsAny <List <ReferenceDataService.Model.EPAOrganisations.EPAOrganisation> >())).Returns(new Dictionary <string, List <EPAOrganisations> >()).Verifiable();
            fcsDataMapperMock.Setup(m => m.MapFcsContractAllocations(It.IsAny <List <ReferenceDataService.Model.FCS.FcsContractAllocation> >())).Returns(new Dictionary <string, IFcsContractAllocation>()).Verifiable();
            larsDataMapperMock.Setup(m => m.MapLarsLearningDeliveries(It.IsAny <List <ReferenceDataService.Model.LARS.LARSLearningDelivery> >())).Returns(new Dictionary <string, LearningDelivery>()).Verifiable();
            larsDataMapperMock.Setup(m => m.MapLarsStandards(It.IsAny <List <ReferenceDataService.Model.LARS.LARSStandard> >())).Returns(new List <ILARSStandard>()).Verifiable();
            larsDataMapperMock.Setup(m => m.MapLarsStandardValidities(It.IsAny <List <ReferenceDataService.Model.LARS.LARSStandard> >())).Returns(new List <ILARSStandardValidity>()).Verifiable();
            organisationsDataMapperMock.Setup(m => m.MapOrganisations(It.IsAny <List <ReferenceDataService.Model.Organisations.Organisation> >())).Returns(new Dictionary <long, Organisation>()).Verifiable();
            organisationsDataMapperMock.Setup(m => m.MapCampusIdentifiers(It.IsAny <List <ReferenceDataService.Model.Organisations.Organisation> >())).Returns(new List <ICampusIdentifier>()).Verifiable();
            postcodesDataMapperMock.Setup(m => m.MapONSPostcodes(It.IsAny <List <ReferenceDataService.Model.Postcodes.Postcode> >())).Returns(new List <ONSPostcode>()).Verifiable();
            postcodesDataMapperMock.Setup(m => m.MapPostcodes(It.IsAny <List <ReferenceDataService.Model.Postcodes.Postcode> >())).Returns(new List <string>()).Verifiable();
            postcodesDataMapperMock.Setup(m => m.MapDevolvedPostcodes(It.IsAny <List <ReferenceDataService.Model.PostcodesDevolution.DevolvedPostcode> >())).Returns(new Dictionary <string, IReadOnlyCollection <IDevolvedPostcode> >()).Verifiable();

            ulnDataMapperMock.Setup(m => m.MapUlns(It.IsAny <List <long> >())).Returns(new List <long>()).Verifiable();
            validationErrorsDataMapperMock.Setup(m => m.MapValidationErrors(It.IsAny <List <ReferenceDataService.Model.MetaData.ValidationError> >())).Returns(new Dictionary <string, ValidationError>()).Verifiable();
            validationRulesDataMapperMock.Setup(m => m.MapValidationRules(It.IsAny <List <ReferenceDataService.Model.MetaData.ValidationRule> >())).Returns(new List <ValidationRule>()).Verifiable();

            NewService(
                externalDataCache,
                employersDataMapperMock.Object,
                epaOrgDataMapperMock.Object,
                fcsDataMapperMock.Object,
                larsDataMapperMock.Object,
                organisationsDataMapperMock.Object,
                postcodesDataMapperMock.Object,
                ulnDataMapperMock.Object,
                validationErrorsDataMapperMock.Object,
                validationRulesDataMapperMock.Object).Populate(referenceDataRoot, validationContextMock.Object);

            employersDataMapperMock.VerifyAll();
            epaOrgDataMapperMock.VerifyAll();
            fcsDataMapperMock.VerifyAll();
            larsDataMapperMock.VerifyAll();
            organisationsDataMapperMock.VerifyAll();
            postcodesDataMapperMock.VerifyAll();
            ulnDataMapperMock.VerifyAll();
            validationErrorsDataMapperMock.VerifyAll();
            validationRulesDataMapperMock.VerifyAll();
        }
        public async Task ExecuteAsync()
        {
            IMessage           message           = new TestMessage();
            var                referenceData     = new ReferenceDataRoot();
            IExternalDataCache externalDataCache = new ExternalDataCache();
            var                externalData      = "ExtermalData";
            var                cancellationToken = CancellationToken.None;

            var fundingServiceContextMock           = new Mock <IFundingServiceContext>();
            var jsonSerializationServiceMock        = new Mock <IJsonSerializationService>();
            var ilrFileProviderServiceMock          = new Mock <IFileProviderService <IMessage> >();
            var ilrReferenceDataProviderServiceMock = new Mock <IFileProviderService <ReferenceDataRoot> >();
            var externalCachePopulationServiceMock  = new Mock <IExternalDataCachePopulationService>();
            var fundingTaskProviderMock             = new Mock <IFundingTaskProvider>();
            var loggerMock = new Mock <ILogger>();

            ilrFileProviderServiceMock.Setup(sm => sm.ProvideAsync(fundingServiceContextMock.Object, cancellationToken)).Returns(Task.FromResult(message)).Verifiable();
            ilrReferenceDataProviderServiceMock.Setup(sm => sm.ProvideAsync(fundingServiceContextMock.Object, cancellationToken)).Returns(Task.FromResult(referenceData)).Verifiable();
            externalCachePopulationServiceMock.Setup(sm => sm.PopulateAsync(referenceData, cancellationToken)).Returns(externalDataCache).Verifiable();
            jsonSerializationServiceMock.Setup(sm => sm.Serialize(externalDataCache)).Returns(externalData).Verifiable();

            fundingTaskProviderMock.Setup(sm => sm.ProvideAsync(fundingServiceContextMock.Object, message, externalData, cancellationToken)).Returns(Task.FromResult(true)).Verifiable();

            await NewService(
                jsonSerializationServiceMock.Object,
                ilrFileProviderServiceMock.Object,
                ilrReferenceDataProviderServiceMock.Object,
                externalCachePopulationServiceMock.Object,
                fundingTaskProviderMock.Object,
                loggerMock.Object).ExecuteAsync(fundingServiceContextMock.Object, cancellationToken);

            jsonSerializationServiceMock.VerifyAll();
            ilrFileProviderServiceMock.VerifyAll();
            ilrReferenceDataProviderServiceMock.VerifyAll();
            externalCachePopulationServiceMock.VerifyAll();
            fundingTaskProviderMock.VerifyAll();
        }
Exemple #4
0
 public AcceptanceTestsValidationErrorsCachePopulationServiceStub(IExternalDataCache iCache)
 {
     _dataCache = (ExternalDataCache)iCache;
 }
        private async Task <IEnumerable <IValidationError> > RunValidation(ValidationActorModel actorModel, CancellationToken cancellationToken)
        {
            if (_executionContext is ExecutionContext executionContextObj)
            {
                executionContextObj.JobId   = "-1";
                executionContextObj.TaskKey = _actorId.ToString();
            }

            ILogger logger = _parentLifeTimeScope.Resolve <ILogger>();

            InternalDataCache              internalDataCache;
            ExternalDataCache              externalDataCacheGet;
            ExternalDataCache              externalDataCache;
            FileDataCache                  fileDataCache;
            Message                        message;
            IEnumerable <string>           tasks;
            ValidationContext              validationContext;
            IEnumerable <IValidationError> errors;

            try
            {
                logger.LogDebug($"{nameof(ValidationActor)} {_actorId} {GC.GetGeneration(actorModel)} starting");

                internalDataCache    = _jsonSerializationService.Deserialize <InternalDataCache>(actorModel.InternalDataCache);
                externalDataCacheGet = _jsonSerializationService.Deserialize <ExternalDataCache>(actorModel.ExternalDataCache);
                fileDataCache        = _jsonSerializationService.Deserialize <FileDataCache>(actorModel.FileDataCache);
                message = _jsonSerializationService.Deserialize <Message>(actorModel.Message);
                tasks   = _jsonSerializationService.Deserialize <IEnumerable <string> >(actorModel.TaskList);

                externalDataCache = new ExternalDataCache
                {
                    LearningDeliveries = externalDataCacheGet.LearningDeliveries.ToCaseInsensitiveDictionary(),
                    EPAOrganisations   = externalDataCacheGet.EPAOrganisations.ToCaseInsensitiveDictionary(),
                    ERNs = externalDataCacheGet.ERNs,
                    FCSContractAllocations = externalDataCacheGet.FCSContractAllocations,
                    Frameworks             = externalDataCacheGet.Frameworks,
                    Organisations          = externalDataCacheGet.Organisations,
                    Postcodes          = externalDataCacheGet.Postcodes.ToCaseInsensitiveHashSet(),
                    ONSPostcodes       = externalDataCacheGet.ONSPostcodes,
                    Standards          = externalDataCacheGet.Standards,
                    StandardValidities = externalDataCacheGet.StandardValidities,
                    ULNs              = externalDataCacheGet.ULNs,
                    ValidationErrors  = externalDataCacheGet.ValidationErrors.ToCaseInsensitiveDictionary(),
                    CampusIdentifiers = externalDataCacheGet.CampusIdentifiers
                };

                validationContext = new ValidationContext
                {
                    Input = message
                };

                logger.LogDebug($"{nameof(ValidationActor)} {_actorId} {GC.GetGeneration(actorModel)} finished getting input data");

                cancellationToken.ThrowIfCancellationRequested();
            }
            catch (Exception ex)
            {
                ActorEventSource.Current.ActorMessage(this, "Exception-{0}", ex.ToString());
                logger.LogError($"Error while processing {nameof(ValidationActor)}", ex);
                throw;
            }

            using (var childLifeTimeScope = _parentLifeTimeScope.BeginLifetimeScope(c =>
            {
                c.RegisterInstance(validationContext).As <IValidationContext>();
                c.RegisterInstance(new Cache <IMessage> {
                    Item = message
                }).As <ICache <IMessage> >();
                c.RegisterInstance(internalDataCache).As <IInternalDataCache>();
                c.RegisterInstance(externalDataCache).As <IExternalDataCache>();
                c.RegisterInstance(fileDataCache).As <IFileDataCache>();
            }))
            {
                ExecutionContext executionContext = (ExecutionContext)childLifeTimeScope.Resolve <IExecutionContext>();
                executionContext.JobId   = actorModel.JobId;
                executionContext.TaskKey = _actorId.ToString();
                ILogger jobLogger = childLifeTimeScope.Resolve <ILogger>();
                try
                {
                    jobLogger.LogDebug($"{nameof(ValidationActor)} {_actorId} {GC.GetGeneration(actorModel)} {executionContext.TaskKey} started learners: {validationContext.Input.Learners.Count}");
                    IRuleSetOrchestrationService <ILearner, IValidationError> preValidationOrchestrationService = childLifeTimeScope
                                                                                                                  .Resolve <IRuleSetOrchestrationService <ILearner, IValidationError> >();

                    errors = await preValidationOrchestrationService.ExecuteAsync(tasks, cancellationToken);

                    jobLogger.LogDebug($"{nameof(ValidationActor)} {_actorId} {GC.GetGeneration(actorModel)} {executionContext.TaskKey} validation done");
                }
                catch (Exception ex)
                {
                    ActorEventSource.Current.ActorMessage(this, "Exception-{0}", ex.ToString());
                    jobLogger.LogError($"Error while processing {nameof(ValidationActor)}", ex);
                    throw;
                }
            }

            internalDataCache = null;
            externalDataCache = null;
            fileDataCache     = null;
            message           = null;
            validationContext = null;

            return(errors);
        }
Exemple #6
0
        public async Task Populate()
        {
            var message = new TestMessage()
            {
                LearningProviderEntity = new TestLearningProvider
                {
                    UKPRN = 1
                },
                Learners = new List <TestLearner>
                {
                    new TestLearner
                    {
                        LearnRefNumber = "TestLearnRefNumber",
                        ULN            = 1234567890
                    }
                }
            };

            var fundingServiceDtoMock = new Mock <IFundingServiceDto>();

            fundingServiceDtoMock.SetupGet(f => f.Message).Returns(message);

            var externalDataCache = new ExternalDataCache();

            var postcodesDataRetrievalServiceMock = new Mock <IPostcodesDataRetrievalService>();

            var postcodesCurrentVersion = "PostcodesVersion";
            var sfaAreaCosts            = new Dictionary <string, IEnumerable <SfaAreaCost> >();
            var sfaDisadvantages        = new Dictionary <string, IEnumerable <SfaDisadvantage> >();
            var dasDisadvantages        = new Dictionary <string, IEnumerable <DasDisadvantage> >();
            var efaDisadvantages        = new Dictionary <string, IEnumerable <EfaDisadvantage> >();
            var careerLearningPilots    = new Dictionary <string, IEnumerable <CareerLearningPilot> >();
            var postcodeRoots           = new Dictionary <string, PostcodeRoot>();

            postcodesDataRetrievalServiceMock.Setup(p => p.UniquePostcodes(message)).Returns(new HashSet <string>()).Verifiable();
            postcodesDataRetrievalServiceMock.Setup(p => p.CurrentVersion()).Returns(postcodesCurrentVersion).Verifiable();
            postcodesDataRetrievalServiceMock.Setup(p => p.PostcodeRootsForPostcodes(It.IsAny <IEnumerable <string> >())).Returns(postcodeRoots);

            var largeEmployersDataRetrievalServiceMock = new Mock <ILargeEmployersDataRetrievalService>();

            var largeEmployers = new Dictionary <int, IEnumerable <LargeEmployers> >();

            largeEmployersDataRetrievalServiceMock.Setup(l => l.UniqueEmployerIds(message)).Returns(new List <int>()).Verifiable();
            largeEmployersDataRetrievalServiceMock.Setup(l => l.LargeEmployersForEmployerIds(It.IsAny <List <int> >())).Returns(largeEmployers).Verifiable();

            var larsDataRetrievalServiceMock = new Mock <ILARSDataRetrievalService>();

            var larsCurrentVersion             = "LarsVersion";
            var larsAnnualValues               = new Dictionary <string, IEnumerable <LARSAnnualValue> >();
            var larsFrameworkAims              = new Dictionary <string, IEnumerable <LARSFrameworkAims> >();
            var larsLearningDeliveryCategories = new Dictionary <string, IEnumerable <LARSLearningDeliveryCategory> >();
            var larsFundings                        = new Dictionary <string, IEnumerable <LARSFunding> >();
            var larsLearningDeliveries              = new Dictionary <string, LARSLearningDelivery>();
            var larsStandardCommonComponents        = new Dictionary <int, IEnumerable <LARSStandardCommonComponent> >();
            var larsFrameworkCommonComponents       = new List <LARSFrameworkCommonComponent>();
            var larsApprenticeshipFundingStandards  = new List <LARSStandardApprenticeshipFunding>();
            var larsApprenticeshipFundingFrameworks = new List <LARSFrameworkApprenticeshipFunding>();
            var larsStandardFundings                = new Dictionary <int, IEnumerable <LARSStandardFunding> >();

            larsDataRetrievalServiceMock.Setup(l => l.UniqueLearnAimRefs(message)).Returns(new HashSet <string>()).Verifiable();
            larsDataRetrievalServiceMock.Setup(l => l.UniqueStandardCodes(message)).Returns(new List <int>()).Verifiable();
            larsDataRetrievalServiceMock.Setup(l => l.UniqueFrameworkCommonComponents(message)).Returns(new HashSet <LARSFrameworkKey>()).Verifiable();
            larsDataRetrievalServiceMock.Setup(l => l.UniqueApprenticeshipFundingStandards(message)).Returns(It.IsAny <IEnumerable <LARSApprenticeshipFundingKey> >).Verifiable();
            larsDataRetrievalServiceMock.Setup(l => l.UniqueApprenticeshipFundingFrameworks(message)).Returns(It.IsAny <IEnumerable <LARSApprenticeshipFundingKey> >).Verifiable();
            larsDataRetrievalServiceMock.Setup(l => l.CurrentVersion()).Returns(larsCurrentVersion).Verifiable();
            larsDataRetrievalServiceMock.Setup(l => l.LARSAnnualValuesForLearnAimRefs(It.IsAny <IEnumerable <string> >())).Returns(larsAnnualValues).Verifiable();
            larsDataRetrievalServiceMock.Setup(l => l.LARSFrameworkAimsForLearnAimRefs(It.IsAny <IEnumerable <string> >())).Returns(larsFrameworkAims).Verifiable();
            larsDataRetrievalServiceMock.Setup(l => l.LARSLearningDeliveryCategoriesForLearnAimRefs(It.IsAny <HashSet <string> >())).Returns(larsLearningDeliveryCategories).Verifiable();
            larsDataRetrievalServiceMock.Setup(l => l.LARSFundingsForLearnAimRefs(It.IsAny <IEnumerable <string> >())).Returns(larsFundings).Verifiable();
            larsDataRetrievalServiceMock.Setup(l => l.LARSLearningDeliveriesForLearnAimRefs(It.IsAny <IEnumerable <string> >())).Returns(larsLearningDeliveries).Verifiable();
            larsDataRetrievalServiceMock.Setup(l => l.LARSStandardCommonComponentForStandardCode(It.IsAny <List <int> >())).Returns(larsStandardCommonComponents).Verifiable();
            larsDataRetrievalServiceMock.Setup(l => l.LARSFrameworkCommonComponentForLearnAimRefs(It.IsAny <IEnumerable <LARSFrameworkKey> >())).Returns(larsFrameworkCommonComponents).Verifiable();
            larsDataRetrievalServiceMock.Setup(l => l.LARSApprenticeshipFundingStandards(It.IsAny <List <LARSApprenticeshipFundingKey> >())).Returns(larsApprenticeshipFundingStandards).Verifiable();
            larsDataRetrievalServiceMock.Setup(l => l.LARSApprenticeshipFundingFrameworks(It.IsAny <List <LARSApprenticeshipFundingKey> >())).Returns(larsApprenticeshipFundingFrameworks).Verifiable();
            larsDataRetrievalServiceMock.Setup(l => l.LARSStandardFundingForStandardCodes(It.IsAny <List <int> >())).Returns(larsStandardFundings).Verifiable();

            var organisationDataRetrievalServiceMock = new Mock <IOrganisationDataRetrievalService>();

            var organisationCurrentVersion = "OrganisationVersion";
            var orgFundings = new Dictionary <long, IEnumerable <OrgFunding> >();

            organisationDataRetrievalServiceMock.Setup(o => o.CurrentVersion()).Returns(organisationCurrentVersion).Verifiable();
            organisationDataRetrievalServiceMock.Setup(o => o.OrgFundingsForUkprns(It.IsAny <List <long> >())).Returns(orgFundings).Verifiable();

            var appsEarningsHistoryDataRetrievalServiceMock = new Mock <IAppsEarningsHistoryDataRetrievalService>();

            var aecHistory = new Dictionary <long, IEnumerable <AECEarningsHistory> >();

            appsEarningsHistoryDataRetrievalServiceMock.Setup(a => a.AppsEarningsHistoryForLearners(It.IsAny <int>(), It.IsAny <IEnumerable <LearnRefNumberULNKey> >())).Returns(aecHistory).Verifiable();

            var fcsDataRetrievalServiceMock = new Mock <IFCSDataRetrievalService>();

            var fcsContractAllocations = new List <FCSContractAllocation>();

            fcsDataRetrievalServiceMock.Setup(f => f.UniqueConRefNumbers(message)).Returns(new HashSet <string>()).Verifiable();
            fcsDataRetrievalServiceMock.Setup(f => f.FCSContractsForUKPRN(It.IsAny <int>(), It.IsAny <IEnumerable <string> >())).Returns(fcsContractAllocations).Verifiable();

            await NewService(
                externalDataCache,
                appsEarningsHistoryDataRetrievalServiceMock.Object,
                fcsDataRetrievalServiceMock.Object,
                postcodesDataRetrievalServiceMock.Object,
                largeEmployersDataRetrievalServiceMock.Object,
                larsDataRetrievalServiceMock.Object,
                organisationDataRetrievalServiceMock.Object,
                fundingServiceDtoMock.Object)
            .PopulateAsync(CancellationToken.None);

            postcodesDataRetrievalServiceMock.VerifyAll();
            largeEmployersDataRetrievalServiceMock.VerifyAll();
            larsDataRetrievalServiceMock.VerifyAll();
            organisationDataRetrievalServiceMock.VerifyAll();
            appsEarningsHistoryDataRetrievalServiceMock.VerifyAll();
            fcsDataRetrievalServiceMock.VerifyAll();

            externalDataCache.PostcodeCurrentVersion.Should().Be(postcodesCurrentVersion);
            externalDataCache.PostcodeRoots.Should().BeSameAs(postcodeRoots);

            externalDataCache.LargeEmployers.Should().BeSameAs(largeEmployers);

            externalDataCache.LARSCurrentVersion.Should().Be(larsCurrentVersion);
            externalDataCache.LARSAnnualValue.Should().BeSameAs(larsAnnualValues);
            externalDataCache.LARSFrameworkAims.Should().BeSameAs(larsFrameworkAims);
            externalDataCache.LARSFunding.Should().BeSameAs(larsFundings);
            externalDataCache.LARSLearningDelivery.Should().BeSameAs(larsLearningDeliveries);
            externalDataCache.LARSLearningDeliveryCategory.Should().BeSameAs(larsLearningDeliveryCategories);
            externalDataCache.LARSStandardFundings.Should().BeSameAs(larsStandardFundings);
            externalDataCache.LARSFrameworkCommonComponent.Should().BeSameAs(larsFrameworkCommonComponents);
            externalDataCache.LARSStandardCommonComponent.Should().BeSameAs(larsStandardCommonComponents);
            externalDataCache.LARSApprenticeshipFundingFrameworks.Should().BeSameAs(larsApprenticeshipFundingFrameworks);
            externalDataCache.LARSApprenticeshipFundingStandards.Should().BeSameAs(larsApprenticeshipFundingStandards);

            externalDataCache.OrgVersion.Should().Be(organisationCurrentVersion);
            externalDataCache.OrgFunding.Should().BeSameAs(orgFundings);
        }
        private async Task <IEnumerable <IValidationError> > RunValidation(ValidationDPActorModel actorModel, CancellationToken cancellationToken)
        {
            if (_executionContext is ExecutionContext executionContextObj)
            {
                executionContextObj.JobId   = "-1";
                executionContextObj.TaskKey = _actorId.ToString();
            }

            ILogger logger = _parentLifeTimeScope.Resolve <ILogger>();

            InternalDataCache internalDataCache;
            ExternalDataCache externalDataCacheGet;
            ExternalDataCache externalDataCache;
            FileDataCache     fileDataCache;
            Message           message;
            IEnumerable <IValidationError> errors;

            try
            {
                logger.LogDebug($"{nameof(ValidationDPActor)} {_actorId} {GC.GetGeneration(actorModel)} starting");

                internalDataCache    = _jsonSerializationService.Deserialize <InternalDataCache>(actorModel.InternalDataCache);
                externalDataCacheGet = _jsonSerializationService.Deserialize <ExternalDataCache>(actorModel.ExternalDataCache);
                fileDataCache        = _jsonSerializationService.Deserialize <FileDataCache>(actorModel.FileDataCache);
                message = _jsonSerializationService.Deserialize <Message>(actorModel.Message);

                externalDataCache = new ExternalDataCache
                {
                    ULNs             = externalDataCacheGet.ULNs,
                    ValidationErrors = externalDataCacheGet.ValidationErrors.ToCaseInsensitiveDictionary(),
                    ValidationRules  = externalDataCacheGet.ValidationRules,
                    ReturnPeriod     = externalDataCacheGet.ReturnPeriod
                };

                logger.LogDebug($"{nameof(ValidationDPActor)} {_actorId} {GC.GetGeneration(actorModel)} finished getting input data");

                cancellationToken.ThrowIfCancellationRequested();
            }
            catch (Exception ex)
            {
                ActorEventSource.Current.ActorMessage(this, "Exception-{0}", ex.ToString());
                logger.LogError($"Error while processing {nameof(ValidationDPActor)}", ex);
                throw;
            }

            using (var childLifeTimeScope = _parentLifeTimeScope.BeginLifetimeScope(c =>
            {
                c.RegisterInstance(new Cache <IMessage> {
                    Item = message
                }).As <ICache <IMessage> >();
                c.RegisterInstance(internalDataCache).As <IInternalDataCache>();
                c.RegisterInstance(externalDataCache).As <IExternalDataCache>();
                c.RegisterInstance(fileDataCache).As <IFileDataCache>();
            }))
            {
                ExecutionContext executionContext = (ExecutionContext)childLifeTimeScope.Resolve <IExecutionContext>();
                executionContext.JobId   = actorModel.JobId;
                executionContext.TaskKey = _actorId.ToString();
                ILogger jobLogger = childLifeTimeScope.Resolve <ILogger>();
                try
                {
                    jobLogger.LogDebug($"{nameof(ValidationDPActor)} {_actorId} {GC.GetGeneration(actorModel)} {executionContext.TaskKey} started Destination and Progressions: {message.LearnerDestinationAndProgressions.Count}");
                    IRuleSetOrchestrationService <IRule <ILearnerDestinationAndProgression>, ILearnerDestinationAndProgression> preValidationOrchestrationService = childLifeTimeScope
                                                                                                                                                                    .Resolve <IRuleSetOrchestrationService <IRule <ILearnerDestinationAndProgression>, ILearnerDestinationAndProgression> >();

                    errors = await preValidationOrchestrationService.ExecuteAsync(message.LearnerDestinationAndProgressions, cancellationToken);

                    jobLogger.LogDebug($"{nameof(ValidationDPActor)} {_actorId} {GC.GetGeneration(actorModel)} {executionContext.TaskKey} Destination and Progression validation done");
                }
                catch (Exception ex)
                {
                    ActorEventSource.Current.ActorMessage(this, "Exception-{0}", ex.ToString());
                    jobLogger.LogError($"Error while processing {nameof(ValidationDPActor)}", ex);
                    throw;
                }
            }

            internalDataCache = null;
            externalDataCache = null;
            fileDataCache     = null;
            message           = null;

            return(errors);
        }