private PsfModel GeneratePreSearchFiltersViewModel() { var filtersModel = new PsfModel { Sections = new List <PsfSection>() }; var filterSectionOne = new PsfSection { Name = "Multi Select Section One", Description = "Dummy Title One", SingleSelectOnly = false, NextPageUrl = "NextSectionURL", PreviousPageUrl = "HomePageURL", PageNumber = 1, TotalNumberOfPages = 2, SectionDataType = "Dummy Data Type One", Options = new List <PsfOption>() }; for (int ii = 0; ii < 3; ii++) { var iiString = ii.ToString(); filterSectionOne.Options.Add(new PsfOption { Id = iiString, IsSelected = false, Name = $"Title-{iiString}", Description = $"Description-{iiString}", OptionKey = $"{iiString}-UrlName", ClearOtherOptionsIfSelected = false }); } //Add one thats Non Applicable filterSectionOne.Options.Add(new PsfOption { Id = "3", IsSelected = false, Name = "Title-3", Description = "Description-3", OptionKey = "3-UrlName", ClearOtherOptionsIfSelected = true }); filtersModel.Sections.Add(filterSectionOne); var filterSectionTwo = new PsfSection { Name = "Single Select Section Two", Description = "Dummy Title Two", SingleSelectOnly = true, NextPageUrl = "SearchPageURL", PreviousPageUrl = "PreviousPageURL", PageNumber = 2, TotalNumberOfPages = 2, SectionDataType = "Dummy Data Type Two" }; filterSectionTwo.Options = new List <PsfOption>(); for (int ii = 0; ii < 3; ii++) { var iiString = ii.ToString(); filterSectionTwo.Options.Add(new PsfOption { Id = iiString, IsSelected = false, Name = $"Title-{iiString}", Description = $"Description-{iiString}", OptionKey = $"{iiString}-UrlName", ClearOtherOptionsIfSelected = false }); } filtersModel.Sections.Add(filterSectionTwo); return(filtersModel); }
private static void AddFilterSection(PsfSection currentSection, PsfModel model, string demovalues) { var values = demovalues.Split('~'); foreach (var value in values) { var data = value.Split(','); if (data.Length == 2) { currentSection.Options.Add(new PsfOption { IsSelected = Convert.ToBoolean(data[0]), OptionKey = Convert.ToString(data[1]) }); } } if (currentSection.Options.Any()) { model.Sections.Add(currentSection); } }
private PsfModel GeneratePreSEarchFiltersViewModel(PreSearchFilterType filterType) { var filtersModel = new PsfModel { OptionsSelected = "DummyJsonState" }; var filterSectionOne = new PsfSection { Name = "Multi Select Section One", Description = "Dummy Title One", SingleSelectOnly = false, NextPageUrl = "NextSectionURL", PreviousPageUrl = "HomePageURL", PageNumber = 1, TotalNumberOfPages = 2, SectionDataType = filterType.ToString() }; filterSectionOne.Options = new List <PsfOption>(); for (int ii = 0; ii < 3; ii++) { var iiString = ii.ToString(); filterSectionOne.Options.Add(item: new PsfOption { Id = iiString, IsSelected = false, Name = $"Title-{iiString}", Description = $"Description-{iiString}", OptionKey = $"{iiString}-UrlName", ClearOtherOptionsIfSelected = false }); } filtersModel.Section = filterSectionOne; return(filtersModel); }
private void CheckFilterSecton(PreSearchFiltersController controller, PsfSection filterSection, PreSearchFilterType expectedFilterType, bool addNotApplicable = true) { filterSection.Description.Should().BeEquivalentTo(controller.SectionDescription); filterSection.Name.Should().BeEquivalentTo(controller.SectionTitle); filterSection.NextPageUrl.Should().BeEquivalentTo(controller.NextPageUrl); filterSection.PreviousPageUrl.Should().BeEquivalentTo(controller.PreviousPageUrl); filterSection.SectionDataType.Should().BeEquivalentTo(expectedFilterType.ToString()); filterSection.PageNumber.Should().Be(controller.ThisPageNumber); filterSection.TotalNumberOfPages.Should().Be(controller.TotalNumberOfPages); filterSection.Options.Count.Should().Be(5); int idx = 0; foreach (PreSearchFilterOption p in GetDummyPreSearchFilterOption(addNotApplicable)) { filterSection.Options[idx].Id.Should().BeEquivalentTo(p.Id); filterSection.Options[idx].Name.Should().BeEquivalentTo(p.Name); filterSection.Options[idx].Description.Should().BeEquivalentTo(p.Description); filterSection.Options[idx].IsSelected.Should().Be(false); filterSection.Options[idx].ClearOtherOptionsIfSelected.Should().Be(p.ClearOtherOptionsIfSelected); filterSection.Options[idx].OptionKey.Should().BeEquivalentTo(p.OptionKey); idx++; } }
private PsfModel GetDummyPreSearchFiltersModel() { var model = new PsfModel { Sections = new List <PsfSection>(), Section = new PsfSection { Options = new List <PsfOption>() } }; // interests var interestSection = new PsfSection { Name = nameof(JobProfileIndex.Interests), Options = new List <PsfOption>(), SectionDataType = "Interest", }; if (!string.IsNullOrWhiteSpace(DemoInterestsValues)) { AddFilterSection(interestSection, model, DemoInterestsValues); } // enablers var enablersSection = new PsfSection { Name = nameof(JobProfileIndex.Enablers), SectionDataType = nameof(PreSearchFilterType.Enabler), Options = new List <PsfOption>(), }; if (!string.IsNullOrWhiteSpace(DemoEnablersValues)) { AddFilterSection(enablersSection, model, DemoEnablersValues); } // training routes var trainingRouteSection = new PsfSection { Name = nameof(JobProfileIndex.TrainingRoutes), SectionDataType = nameof(PreSearchFilterType.TrainingRoute), Options = new List <PsfOption>(), }; if (!string.IsNullOrWhiteSpace(DemoTrainingRoutesValues)) { AddFilterSection(trainingRouteSection, model, DemoTrainingRoutesValues); } // entry qualifics var entrySection = new PsfSection { Name = nameof(JobProfileIndex.EntryQualifications), Options = new List <PsfOption>(), SectionDataType = nameof(PreSearchFilterType.EntryQualification), }; if (!string.IsNullOrWhiteSpace(DemoEntryQualificationsValues)) { AddFilterSection(entrySection, model, DemoEntryQualificationsValues); } //job areas var jobAreas = new PsfSection { Name = nameof(JobProfileIndex.EntryQualifications), Options = new List <PsfOption>(), SectionDataType = nameof(PreSearchFilterType.JobArea), }; if (!string.IsNullOrWhiteSpace(DemoJobAreasValues)) { AddFilterSection(jobAreas, model, DemoJobAreasValues); } // preferred tasks var preferredTasks = new PsfSection { Name = nameof(JobProfileIndex.EntryQualifications), Options = new List <PsfOption>(), SectionDataType = nameof(PreSearchFilterType.PreferredTaskType), }; if (!string.IsNullOrWhiteSpace(DemoPreferredTaskTypesValues)) { AddFilterSection(preferredTasks, model, DemoPreferredTaskTypesValues); } return(model); }