public async Task <SkillsViewModel> GetSkillsViewModelAsync(VacancyRouteModel vrm, string[] draftSkills = null) { var vacancy = await Utility.GetAuthorisedVacancyForEditAsync(_client, _vacancyClient, vrm, RouteNames.Skills_Get); var vm = new SkillsViewModel { Title = vacancy.Title }; if (draftSkills == null) { _skillsHelper.SetViewModelSkillsFromVacancy(vm, vacancy); } else { _skillsHelper.SetViewModelSkillsFromDraftSkills(vm, draftSkills); } if (vacancy.Status == VacancyStatus.Referred) { vm.Review = await _reviewSummaryService.GetReviewSummaryViewModelAsync(vacancy.VacancyReference.Value, ReviewFieldMappingLookups.GetSkillsFieldIndicators()); } return(vm); }
public void SetViewModelSkillsFromVacancy_ShouldOrderVacancySkills() { var helper = new SkillsOrchestratorHelper(GetBaseSkills); var vm = new SkillsViewModelBase(); var vacancy = new Vacancy { Skills = new List <string> { "Custom Skill 2", "Initiative", "Problem solving skills", "Custom Skill 1", "Administrative skills", "Communication skills" } }; helper.SetViewModelSkillsFromVacancy(vm, vacancy); vm.Column1Checkboxes.Count.Should().Be(10); vm.Column1Checkboxes.Count(c => c.Selected == false).Should().Be(6); vm.Column2Checkboxes.Count.Should().Be(9); vm.Column2Checkboxes.Count(c => c.Selected == false).Should().Be(7); vm.Column1Checkboxes[0].Value.Should().Be("Communication skills"); vm.Column1Checkboxes[0].Selected.Should().BeTrue(); vm.Column1Checkboxes[5].Value.Should().Be("Problem solving skills"); vm.Column1Checkboxes[5].Selected.Should().BeTrue(); vm.Column1Checkboxes[7].Value.Should().Be("Administrative skills"); vm.Column1Checkboxes[7].Selected.Should().BeTrue(); vm.Column1Checkboxes[9].Value.Should().Be("2-Custom Skill 1"); vm.Column1Checkboxes[9].Selected.Should().BeTrue(); vm.Column2Checkboxes[4].Value.Should().Be("Initiative"); vm.Column2Checkboxes[4].Selected.Should().BeTrue(); vm.Column2Checkboxes[8].Value.Should().Be("1-Custom Skill 2"); vm.Column2Checkboxes[8].Selected.Should().BeTrue(); }