コード例 #1
0
 public DfcBreadcrumbControllerTests()
 {
     repositoryCategoryFake   = A.Fake <IJobProfileCategoryRepository>(ops => ops.Strict());
     repositoryJobProfileFake = A.Fake <IJobProfileRepository>(ops => ops.Strict());
     sitefinityCurrentContext = A.Fake <ISitefinityCurrentContext>(ops => ops.Strict());
     loggerFake = A.Fake <IApplicationLogger>();
 }
 public SkillsFrameworkDataImportService(ISkillsFrameworkService skillsFrameworkService, IFrameworkSkillRepository frameworkSkillRepository, IJobProfileSocCodeRepository jobProfileSocCodeRepository, IJobProfileRepository jobProfileRepository, ISocSkillMatrixRepository socSkillMatrixRepository, IReportAuditRepository reportAuditRepository)
 {
     this.skillsFrameworkService      = skillsFrameworkService;
     this.frameworkSkillRepository    = frameworkSkillRepository;
     this.jobProfileSocCodeRepository = jobProfileSocCodeRepository;
     this.jobProfileRepository        = jobProfileRepository;
     this.reportAuditRepository       = reportAuditRepository;
     this.socSkillMatrixRepository    = socSkillMatrixRepository;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="JobProfileWhatItTakesController" /> class.
 /// </summary>
 /// <param name="jobProfileRepository">The job profile repository.</param>
 /// <param name="webAppContext">The web application context.</param>
 /// <param name="applicationLogger">application logger</param>
 /// <param name="sitefinityPage">sitefinity</param>
 /// <param name="jobProfileRelatedSkillsRepository">The job profile related skills repository.</param>
 public JobProfileWhatItTakesController(
     IJobProfileRepository jobProfileRepository,
     IWebAppContext webAppContext,
     IApplicationLogger applicationLogger,
     ISitefinityPage sitefinityPage,
     IJobProfileRelatedSkillsRepository jobProfileRelatedSkillsRepository)
     : base(webAppContext, jobProfileRepository, applicationLogger, sitefinityPage)
 {
     this.jobProfileSkillsRepository = jobProfileRelatedSkillsRepository;
 }
コード例 #4
0
 public JobProfileHowToBecomeController(
     IWebAppContext webAppContext,
     IJobProfileRepository jobProfileRepository,
     IApplicationLogger applicationLogger,
     ISitefinityPage sitefinityPage,
     IMapper mapper)
     : base(webAppContext, jobProfileRepository, applicationLogger, sitefinityPage)
 {
     this.mapper = mapper;
 }
 public JobProfileCourseOpportunityController(
     ICourseSearchService courseSearchService,
     IAsyncHelper asyncHelper,
     IWebAppContext webAppContext,
     IJobProfileRepository jobProfileRepository,
     IApplicationLogger loggingService,
     ISitefinityPage sitefinityPage)
     : base(webAppContext, jobProfileRepository, loggingService, sitefinityPage)
 {
     this.courseSearchService = courseSearchService;
     this.asyncHelper         = asyncHelper;
 }
        public SkillsFrameworkDataImportServiceTests()
        {
            fakeSkillsFrameworkService      = A.Fake <ISkillsFrameworkService>(ops => ops.Strict());
            fakeFrameworkSkillRepository    = A.Fake <IFrameworkSkillRepository>(ops => ops.Strict());
            fakeSocSkillMatrixRepository    = A.Fake <ISocSkillMatrixRepository>(ops => ops.Strict());
            fakeJobProfileSocCodeRepository = A.Fake <IJobProfileSocCodeRepository>(ops => ops.Strict());
            fakeReportAuditRepository       = A.Fake <IReportAuditRepository>(ops => ops.Strict());
            fakeJobProfileRepository        = A.Fake <IJobProfileRepository>(ops => ops.Strict());

            A.CallTo(() => fakeReportAuditRepository.CreateAudit("SummaryDetails", A <string> ._)).DoesNothing();
            A.CallTo(() => fakeReportAuditRepository.CreateAudit("ActionDetails", A <string> ._)).DoesNothing();
            A.CallTo(() => fakeReportAuditRepository.CreateAudit("ErrorDetails", A <string> ._)).DoesNothing();
        }
コード例 #7
0
 public JobProfileIndexEnhancer(
     IJobProfileRepository jobProfileRepository,
     IJobProfileCategoryRepository jobProfileCategoryRepository,
     ISalaryService salaryService,
     ISalaryCalculator salaryCalculator,
     IApplicationLogger applicationLogger)
 {
     this.jobProfileRepository         = jobProfileRepository;
     this.jobProfileCategoryRepository = jobProfileCategoryRepository;
     this.salaryService     = salaryService;
     this.salaryCalculator  = salaryCalculator;
     this.applicationLogger = applicationLogger;
 }
コード例 #8
0
 public JobProfileDetailsController(
     IWebAppContext webAppContext,
     IJobProfileRepository jobProfileRepository,
     IApplicationLogger applicationLogger,
     ISitefinityPage sitefinityPage,
     IMapper mapper,
     IAsyncHelper asyncHelper,
     ISearchQueryService <JobProfileIndex> searchService)
     : base(webAppContext, jobProfileRepository, applicationLogger, sitefinityPage)
 {
     this.mapper             = mapper;
     this.asyncHelper        = asyncHelper;
     this.searchQueryService = searchService;
 }
コード例 #9
0
        private void SetupCallsAndFakes(bool isValidJobProfile, bool inContentAuthoringSite = false, bool isContentPreviewMode = false)
        {
            webAppContextFake        = A.Fake <IWebAppContext>(ops => ops.Strict());
            jobProfileRepositoryFake = A.Fake <IJobProfileRepository>(ops => ops.Strict());
            applicationLoggerFake    = A.Fake <IApplicationLogger>();
            sitefinityPageFake       = A.Fake <ISitefinityPage>(ops => ops.Strict());
            mapper = new MapperConfiguration(c => c.AddProfile <JobProfilesAutoMapperProfile>()).CreateMapper();

            A.CallTo(() => webAppContextFake.IsContentAuthoringSite).Returns(inContentAuthoringSite);
            A.CallTo(() => webAppContextFake.IsContentPreviewMode).Returns(isContentPreviewMode);
            A.CallTo(() => webAppContextFake.SetMetaDescription(A <string> ._)).DoesNothing();
            A.CallTo(() => jobProfileRepositoryFake.GetByUrlName(A <string> ._))
            .Returns(GetDummyJobProfile(isValidJobProfile));
            A.CallTo(() => jobProfileRepositoryFake.GetByUrlNameForPreview(A <string> ._))
            .Returns(GetDummyJobProfile(isValidJobProfile));
            A.CallTo(() => sitefinityPageFake.GetDefaultJobProfileToUse(A <string> ._))
            .Returns(nameof(JobProfile.UrlName));
        }
コード例 #10
0
 protected BaseJobProfileWidgetController(IWebAppContext webAppContext, IJobProfileRepository jobProfileRepository, IApplicationLogger loggingService, ISitefinityPage sitefinityPage) : base(loggingService)
 {
     this.WebAppContext        = webAppContext;
     this.jobProfileRepository = jobProfileRepository;
     this.sitefinityPage       = sitefinityPage;
 }
コード例 #11
0
        public static async Task <HttpResponseMessage> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "result/{sessionId}/{jobCategory}")] HttpRequest req,
            string sessionId,
            string jobCategory,
            ILogger log,
            [Inject] IHttpRequestHelper httpRequestHelper,
            [Inject] IHttpResponseMessageHelper httpResponseMessageHelper,
            [Inject] IUserSessionRepository userSessionRepository,
            [Inject] IJobProfileRepository jobProfileRepository)
        {
            try
            {
                var correlationId = httpRequestHelper.GetDssCorrelationId(req);
                if (string.IsNullOrEmpty(correlationId))
                {
                    log.LogInformation("Unable to locate 'DssCorrelationId' in request header");
                }

                if (!Guid.TryParse(correlationId, out var correlationGuid))
                {
                    log.LogInformation("Unable to parse 'DssCorrelationId' to a Guid");
                    correlationGuid = Guid.NewGuid();
                }

                if (string.IsNullOrEmpty(sessionId))
                {
                    log.LogInformation($"Correlation Id: {correlationId} - Session Id not supplied");
                    return(httpResponseMessageHelper.BadRequest());
                }

                var userSession = await userSessionRepository.GetUserSession(sessionId);

                if (userSession == null)
                {
                    log.LogInformation($"Correlation Id: {correlationId} - Session Id does not exist {sessionId}");
                    return(httpResponseMessageHelper.NoContent());
                }

                if (userSession.ResultData == null)
                {
                    log.LogInformation($"Correlation Id: {correlationId} - Result data does not yet exist for session {userSession.PrimaryKey}");
                    return(httpResponseMessageHelper.BadRequest());
                }

                var traits      = userSession.ResultData.Traits;
                int traitsTake  = (traits.Length > 3 && traits[2].TotalScore == traits[3].TotalScore) ? 4 : 3;
                var jobFamilies = userSession.ResultData.JobCategories;

                if (!jobCategory.EqualsIgnoreCase("short"))
                {
                    jobCategory = JobCategoryHelper.GetCode(jobCategory);
                }

                var suggestedJobProfiles = new List <JobProfileResult>();
                foreach (var category in jobFamilies)
                {
                    if (category.FilterAssessmentResult == null)
                    {
                        continue;
                    }

                    var categoryProfiles = new List <JobProfileResult>();
                    if (category.TotalQuestions == 0)
                    {
                        // Build the list of job profiles
                        var jobProfiles =
                            await jobProfileRepository.JobProfilesForJobFamily(category.JobCategoryName);

                        var profilesSet = category.FilterAssessmentResult.SuggestedJobProfiles.ToHashSet(StringComparer.InvariantCultureIgnoreCase);

                        foreach (var jobProfile in jobProfiles.Where(p =>
                                                                     (p.JobProfileCategories == null || p.JobProfileCategories.Contains(category.JobCategoryName, StringComparer.InvariantCultureIgnoreCase)) &&
                                                                     profilesSet.Contains(p.Title))
                                 )
                        {
                            categoryProfiles.Add(new JobProfileResult()
                            {
                                CareerPathAndProgression = jobProfile.CareerPathAndProgression,
                                Overview           = jobProfile.Overview,
                                SalaryExperienced  = jobProfile.SalaryExperienced,
                                SalaryStarter      = jobProfile.SalaryStarter,
                                JobCategory        = category.JobCategoryName,
                                SocCode            = jobProfile.SocCode,
                                Title              = jobProfile.Title,
                                UrlName            = jobProfile.UrlName,
                                TypicalHours       = jobProfile.TypicalHours,
                                TypicalHoursPeriod = String.Join("/", jobProfile.WorkingHoursDetails),
                                ShiftPattern       = String.Join("/", jobProfile.WorkingPattern),
                                ShiftPatternPeriod = String.Join("/", jobProfile.WorkingPatternDetails),
                                WYDDayToDayTasks   = jobProfile.WYDDayToDayTasks
                            });
                        }
                    }

                    category.ResultsShown =
                        category.ResultsShown ||
                        category.JobCategoryCode.EqualsIgnoreCase(jobCategory) ||
                        (category.TotalQuestions == 0 && (categoryProfiles.Count == 0));

                    suggestedJobProfiles.AddRange(categoryProfiles);
                }

                var model = new ResultsResponse()
                {
                    AssessmentType     = userSession.AssessmentType,
                    SessionId          = userSession.UserSessionId,
                    JobFamilyCount     = userSession.ResultData.JobCategories.Length,
                    JobFamilyMoreCount = userSession.ResultData.JobCategories.Length - 3,
                    Traits             = traits.Take(traitsTake).Select(x => x.TraitText).ToArray(),
                    JobCategories      = jobFamilies,
                    JobProfiles        = suggestedJobProfiles.ToArray(),
                    WhatYouToldUs      = userSession.ResultData?.JobCategories.SelectMany(r => r.FilterAssessmentResult?.WhatYouToldUs ?? new string[] { }).Distinct().ToArray() ?? new string[] { }
                };

                await userSessionRepository.UpdateUserSession(userSession);

                return(httpResponseMessageHelper.Ok(JsonConvert.SerializeObject(model)));
            }
            catch (Exception ex)
            {
                log.LogError(ex, "Fatal exception {message}", ex.ToString());
                return(new HttpResponseMessage {
                    StatusCode = HttpStatusCode.InternalServerError
                });
            }
        }
 public JobProfileWhatYouWillDoController(IJobProfileRepository jobProfileRepository, IWebAppContext webAppContext, IApplicationLogger applicationLogger, ISitefinityPage sitefinityPage, IFormatContentService formatContentService)
     : base(webAppContext, jobProfileRepository, applicationLogger, sitefinityPage)
 {
     this.formatContentService = formatContentService;
 }
コード例 #13
0
 public SetContentRelatedPageTitleController(IJobProfileCategoryRepository categoryRepo, IJobProfileRepository jobProfileRepo, IWebAppContext webAppContext, IApplicationLogger applicationLogger) : base(applicationLogger)
 {
     this.categoryRepo         = categoryRepo;
     this.jobProfileRepository = jobProfileRepo;
     this.webAppContext        = webAppContext;
 }
コード例 #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="JobProfileApprenticeshipsController" /> class.
 /// </summary>
 /// <param name="jobProfileRepository">The repository.</param>
 /// <param name="webAppContext">The web application context.</param>
 /// <param name="jobProfileSocCodeRepository">The job profile soc code repository.</param>
 /// <param name="applicationLogger">The application logger.</param>
 /// <param name="sitefinityPage">Sitefinity page</param>
 public JobProfileApprenticeshipsController(IJobProfileRepository jobProfileRepository, IWebAppContext webAppContext, IJobProfileSocCodeRepository jobProfileSocCodeRepository, IApplicationLogger applicationLogger, ISitefinityPage sitefinityPage)
     : base(webAppContext, jobProfileRepository, applicationLogger, sitefinityPage)
 {
     this.jobProfileSocCodeRepository = jobProfileSocCodeRepository;
 }
 public TestBaseJobProfileWidgetController(IWebAppContext webAppContext, IJobProfileRepository jobProfileRepository, IApplicationLogger loggingService, ISitefinityPage sitefinityPage) : base(webAppContext, jobProfileRepository, loggingService, sitefinityPage)
 {
 }
 public DfcBreadcrumbController(IJobProfileCategoryRepository categoryRepo, IJobProfileRepository jobProfileRepo, ISitefinityCurrentContext sitefinityCurrentContext, IApplicationLogger applicationLogger) : base(applicationLogger)
 {
     this.categoryRepo             = categoryRepo;
     this.jobProfileRepository     = jobProfileRepo;
     this.sitefinityCurrentContext = sitefinityCurrentContext;
 }
コード例 #17
0
 public JobProfileBAUSignpostingController(IWebAppContext webAppContext, IJobProfileRepository jobProfileRepository, IApplicationLogger applicationLogger, ISitefinityPage sitefinityPage)
     : base(webAppContext, jobProfileRepository, applicationLogger, sitefinityPage)
 {
 }
コード例 #18
0
 public JobProfileSettingsAndPreviewController(IJobProfileRepository repository, IWebAppContext webAppContext, IApplicationLogger applicationLogger) : base(applicationLogger)
 {
     jobProfileRepository = repository;
     this.webAppContext   = webAppContext;
 }