public async Task WhenSkillsAreUpdated_ShouldCallUpdateDraftVacancyAsync(string[] currentlySelectedSkills, string[] newSelectedSkills)
        {
            var fixture = new SkillsOrchestratorTestsFixture();

            fixture
            .WithSelectedSkills(currentlySelectedSkills)
            .Setup();

            var vacancyRouteModel = new VacancyRouteModel
            {
                EmployerAccountId = fixture.Vacancy.EmployerAccountId,
                VacancyId         = fixture.Vacancy.Id
            };

            var skillsEditModel = new SkillsEditModel
            {
                Skills = newSelectedSkills.ToList(),
                AddCustomSkillAction = null,
                AddCustomSkillName   = null
            };

            await fixture.PostSkillsEditModelAsync(vacancyRouteModel, skillsEditModel);

            fixture.VerifyUpdateDraftVacancyAsyncIsCalled();
        }
        public async Task WhenSkillsAreUpdated_ShouldFlagSkillsFieldIndicator(string[] currentlySelectedSkills, string[] newSelectedSkills, bool fieldIndicatorSet)
        {
            var fixture = new SkillsOrchestratorTestsFixture();

            fixture
            .WithSelectedSkills(currentlySelectedSkills)
            .Setup();

            var vacancyRouteModel = new VacancyRouteModel
            {
                EmployerAccountId = fixture.Vacancy.EmployerAccountId,
                VacancyId         = fixture.Vacancy.Id
            };

            var skillsEditModel = new SkillsEditModel
            {
                Skills = newSelectedSkills.ToList(),
                AddCustomSkillAction = null,
                AddCustomSkillName   = null
            };

            await fixture.PostSkillsEditModelAsync(vacancyRouteModel, skillsEditModel);

            fixture.VerifyEmployerReviewFieldIndicators(FieldIdentifiers.Skills, fieldIndicatorSet);
        }
        public async Task WhenCustomDraftSkillsHaveBeenAdded_ShouldBeOrderedByTheirPrefix()
        {
            var fixture = new SkillsOrchestratorTestsFixture();

            var draftSkill1 = "Draft1";
            var draftSkill2 = "Draft2";
            var draftSkill3 = "Draft3";

            fixture
            .WithSelectedSkills(new string[] { })
            .Setup();

            var vacancyRouteModel = new VacancyRouteModel
            {
                EmployerAccountId = fixture.Vacancy.EmployerAccountId,
                VacancyId         = fixture.Vacancy.Id
            };

            var skillsViewModel = await fixture.GetSkillsViewModelAsync(vacancyRouteModel,
                                                                        new string[] { "2-" + draftSkill2, "3-" + draftSkill3, "1-" + draftSkill1 });

            fixture.VerifyColumn2CheckboxesItemSelected(skillsViewModel, draftSkill1, 8);
            fixture.VerifyColumn1CheckboxesItemSelected(skillsViewModel, draftSkill2, 9);
            fixture.VerifyColumn2CheckboxesItemSelected(skillsViewModel, draftSkill3, 9);
        }
        public async Task WhenCustomDraftSkillsAddedAndBaseSkillSelected_ShouldBeAddedToAlternateColumnsStartingWithColumn2()
        {
            var fixture = new SkillsOrchestratorTestsFixture();

            var draftSkill1 = "Draft1";
            var draftSkill2 = "Draft2";
            var draftSkill3 = "Draft3";

            fixture
            .WithSelectedSkills(new string[] { })
            .Setup();

            var vacancyRouteModel = new VacancyRouteModel
            {
                EmployerAccountId = fixture.Vacancy.EmployerAccountId,
                VacancyId         = fixture.Vacancy.Id
            };

            var skillsViewModel = await fixture.GetSkillsViewModelAsync(vacancyRouteModel,
                                                                        new string[] { "1-" + draftSkill1, "Patience", "2-" + draftSkill2, "3-" + draftSkill3 });

            fixture.VerifyColumn2CheckboxesItemSelected(skillsViewModel, draftSkill1, 8);
            fixture.VerifyColumn1CheckboxesItemSelected(skillsViewModel, draftSkill2, 9);
            fixture.VerifyColumn2CheckboxesItemSelected(skillsViewModel, draftSkill3, 9);
        }
        public async Task WhenCustomeDraftSkillsAdded_ShouldBeAddedToAlternateColumnsStartingWithColumn2()
        {
            var fixture = new SkillsOrchestratorTestsFixture();

            var draftSkill1 = "Draft1";
            var draftSkill2 = "Draft2";
            var draftSkill3 = "Draft3";

            fixture
            .WithSelectedSkills(new string[] { })
            .Setup();

            var vacancyRouteModel = new VacancyRouteModel
            {
                Ukprn     = fixture.Vacancy.TrainingProvider.Ukprn.Value,
                VacancyId = fixture.Vacancy.Id
            };

            var skillsViewModel = await fixture.GetSkillsViewModelAsync(vacancyRouteModel,
                                                                        new string[] { "1-" + draftSkill1, "2-" + draftSkill2, "3-" + draftSkill3 });

            fixture.VerifyColumn2CheckboxesItemSelected(skillsViewModel, draftSkill1, 8);
            fixture.VerifyColumn1CheckboxesItemSelected(skillsViewModel, draftSkill2, 9);
            fixture.VerifyColumn2CheckboxesItemSelected(skillsViewModel, draftSkill3, 9);
        }
        public async Task WhenNoSkillsSaved_ShouldReturnListOfAllBasicSkillsUnchecked()
        {
            var fixture = new SkillsOrchestratorTestsFixture();

            fixture
            .Setup();

            var vacancyRouteModel = new VacancyRouteModel
            {
                EmployerAccountId = fixture.Vacancy.EmployerAccountId,
                VacancyId         = fixture.Vacancy.Id
            };

            var skillsViewModel = await fixture.GetSkillsViewModelAsync(vacancyRouteModel);

            fixture.VerifyAllBasicSkillsAreUnchecked(skillsViewModel);
        }
        public async Task WhenNoSkillsSaved_ShouldReturnListOfAllBasicSkillsUnchecked()
        {
            var fixture = new SkillsOrchestratorTestsFixture();

            fixture
            .Setup();

            var vacancyRouteModel = new VacancyRouteModel
            {
                Ukprn     = fixture.Vacancy.TrainingProvider.Ukprn.Value,
                VacancyId = fixture.Vacancy.Id
            };

            var skillsViewModel = await fixture.GetSkillsViewModelAsync(vacancyRouteModel);

            fixture.VerifyAllBasicSkillsAreUnchecked(skillsViewModel);
        }
        public async Task WhenBaseSkillSaved_ShouldReturnListOfAllBasicSkillsWithSkillsSelected(string[] selectedSkills, int selectedCount)
        {
            var fixture = new SkillsOrchestratorTestsFixture();

            fixture
            .WithSelectedSkills(selectedSkills)
            .Setup();

            var vacancyRouteModel = new VacancyRouteModel
            {
                EmployerAccountId = fixture.Vacancy.EmployerAccountId,
                VacancyId         = fixture.Vacancy.Id
            };

            var skillsViewModel = await fixture.GetSkillsViewModelAsync(vacancyRouteModel);

            fixture.VerifySelectedSkillsCount(skillsViewModel, selectedCount);
        }
        public async Task WhenCustomSkillHasBeenSaved_ShouldReturnCustomSkillsSelectedInLastItemInSecondColumn()
        {
            var fixture = new SkillsOrchestratorTestsFixture();

            var customSkill = "Custom1";

            fixture
            .WithSelectedSkills(new string[] { customSkill })
            .Setup();

            var vacancyRouteModel = new VacancyRouteModel
            {
                EmployerAccountId = fixture.Vacancy.EmployerAccountId,
                VacancyId         = fixture.Vacancy.Id
            };

            var skillsViewModel = await fixture.GetSkillsViewModelAsync(vacancyRouteModel);

            fixture.VerifyColumn2CheckboxesItemSelected(skillsViewModel, customSkill, 8);
        }
        public async Task WhenCustomDraftSkillHasBeenAdded_ShouldBeAddedToColumn2()
        {
            var fixture = new SkillsOrchestratorTestsFixture();

            var draftSkill = "Draft1";

            fixture
            .WithSelectedSkills(new string[] { })
            .Setup();

            var vacancyRouteModel = new VacancyRouteModel
            {
                EmployerAccountId = fixture.Vacancy.EmployerAccountId,
                VacancyId         = fixture.Vacancy.Id
            };

            var skillsViewModel = await fixture.GetSkillsViewModelAsync(vacancyRouteModel, new string[] { "1-" + draftSkill });

            fixture.VerifyColumn2CheckboxesItemSelected(skillsViewModel, draftSkill, 8);
        }
        public async Task WhenMultipleCustomSkillsSaved_ShouldReturnTheCustomSkillsInAlternateColumnsStaringWithColumn2()
        {
            var fixture = new SkillsOrchestratorTestsFixture();

            var customSkill1 = "Custom1";
            var customSkill2 = "Custom2";
            var customSkill3 = "Custom3";

            fixture
            .WithSelectedSkills(new string[] { customSkill1, customSkill2, customSkill3 })
            .Setup();

            var vacancyRouteModel = new VacancyRouteModel
            {
                EmployerAccountId = fixture.Vacancy.EmployerAccountId,
                VacancyId         = fixture.Vacancy.Id
            };

            var skillsViewModel = await fixture.GetSkillsViewModelAsync(vacancyRouteModel);

            fixture.VerifyColumn2CheckboxesItemSelected(skillsViewModel, customSkill1, 8);
            fixture.VerifyColumn1CheckboxesItemSelected(skillsViewModel, customSkill2, 9);
            fixture.VerifyColumn2CheckboxesItemSelected(skillsViewModel, customSkill3, 9);
        }