diff --git a/src/Dfe.EarlyYearsQualification.Content/Constants/AdvicePages.cs b/src/Dfe.EarlyYearsQualification.Content/Constants/AdvicePages.cs index e9ddb0b6..41b42d45 100644 --- a/src/Dfe.EarlyYearsQualification.Content/Constants/AdvicePages.cs +++ b/src/Dfe.EarlyYearsQualification.Content/Constants/AdvicePages.cs @@ -21,14 +21,19 @@ public static class AdvicePages /// Entry ID for the "Qualifications achieved in Scotland" advice page. /// public const string QualificationsAchievedInScotland = "3deQYTynsM9iLnJ5fgFqk"; - + /// /// Entry ID for the "Qualifications achieved in Northern Ireland" advice page. /// public const string QualificationsAchievedInWales = "1Xu4FPcZDxFb5yDCI6lLCj"; - + /// /// Entry ID for the "Qualification not on the list" advice page. /// public const string QualificationNotOnTheList = "XU6vhxIHdeasGLwueCGel"; + + /// + /// Entry ID for the "Qualification Level 7" advice page + /// + public const string QualificationLevel7 = "1bGiyvwsJZPd14dwrVtWCM"; } \ No newline at end of file diff --git a/src/Dfe.EarlyYearsQualification.Mock/Content/MockContentfulService.cs b/src/Dfe.EarlyYearsQualification.Mock/Content/MockContentfulService.cs index bbfe35ff..5b545fc6 100644 --- a/src/Dfe.EarlyYearsQualification.Mock/Content/MockContentfulService.cs +++ b/src/Dfe.EarlyYearsQualification.Mock/Content/MockContentfulService.cs @@ -9,6 +9,7 @@ namespace Dfe.EarlyYearsQualification.Mock.Content; public class MockContentfulService : IContentService { private const string WhereWasTheQualificationAwardedPath = "/questions/where-was-the-qualification-awarded"; + private const string WhatLevelIsTheQualificationPath = "/questions/what-level-is-the-qualification"; public async Task GetAccessibilityStatementPage() { @@ -39,7 +40,7 @@ await Task.FromResult(CreateAdvicePage("Qualifications achieved outside the Unit AdvicePages.QualificationsStartedBetweenSept2014AndAug2019 => await Task.FromResult(CreateAdvicePage("Level 2 qualifications started between 1 September 2014 and 31 August 2019", - body, "/questions/what-level-is-the-qualification")), + body, WhatLevelIsTheQualificationPath)), AdvicePages.QualificationsAchievedInScotland => await Task.FromResult(CreateAdvicePage("Qualifications achieved in Scotland", @@ -56,6 +57,12 @@ await Task.FromResult(CreateAdvicePage("Qualifications achieved in Northern Irel AdvicePages.QualificationNotOnTheList => await Task.FromResult(CreateAdvicePage("Qualification not on the list", body, "/qualifications")), + + AdvicePages.QualificationLevel7 => + await Task.FromResult(CreateAdvicePage("Qualification at Level 7", + body, + WhatLevelIsTheQualificationPath)), + _ => null }; } @@ -488,6 +495,10 @@ private static RadioQuestionPage CreateWhatLevelIsTheQualificationPage() new() { Label = "Level 3", Value = "3" + }, + new() + { + Label = "Level 7", Value = "7" } }; return CreateRadioQuestionPage("What level is the qualification?", options, diff --git a/src/Dfe.EarlyYearsQualification.Web/Controllers/AdviceController.cs b/src/Dfe.EarlyYearsQualification.Web/Controllers/AdviceController.cs index b9dd3a93..2fe3fef0 100644 --- a/src/Dfe.EarlyYearsQualification.Web/Controllers/AdviceController.cs +++ b/src/Dfe.EarlyYearsQualification.Web/Controllers/AdviceController.cs @@ -17,37 +17,43 @@ public async Task QualificationOutsideTheUnitedKingdom() { return await GetView(AdvicePages.QualificationsAchievedOutsideTheUk); } - + [HttpGet("level-2-qualifications-started-between-1-sept-2014-and-31-aug-2019")] public async Task QualificationsStartedBetweenSept2014AndAug2019() { return await GetView(AdvicePages.QualificationsStartedBetweenSept2014AndAug2019); } - + [HttpGet("qualifications-achieved-in-northern-ireland")] public async Task QualificationsAchievedInNorthernIreland() { return await GetView(AdvicePages.QualificationsAchievedInNorthernIreland); } - + [HttpGet("qualifications-achieved-in-scotland")] public async Task QualificationsAchievedInScotland() { return await GetView(AdvicePages.QualificationsAchievedInScotland); } - + [HttpGet("qualifications-achieved-in-wales")] public async Task QualificationsAchievedInWales() { return await GetView(AdvicePages.QualificationsAchievedInWales); } - + [HttpGet("qualification-not-on-the-list")] public async Task QualificationNotOnTheList() { return await GetView(AdvicePages.QualificationNotOnTheList); } + [HttpGet("qualification-level-7")] + public async Task QualificationLevel7() + { + return await GetView(AdvicePages.QualificationLevel7); + } + private async Task GetView(string advicePageId) { var advicePage = await contentService.GetAdvicePage(advicePageId); diff --git a/src/Dfe.EarlyYearsQualification.Web/Controllers/QuestionsController.cs b/src/Dfe.EarlyYearsQualification.Web/Controllers/QuestionsController.cs index 32903d90..76625408 100644 --- a/src/Dfe.EarlyYearsQualification.Web/Controllers/QuestionsController.cs +++ b/src/Dfe.EarlyYearsQualification.Web/Controllers/QuestionsController.cs @@ -79,8 +79,9 @@ public async Task WhenWasTheQualificationStarted() return RedirectToAction("Index", "Error"); } - var model = await MapDateModel(new DateQuestionModel(), questionPage, nameof(this.WhenWasTheQualificationStarted), - Questions); + var model = await MapDateModel(new DateQuestionModel(), questionPage, + nameof(this.WhenWasTheQualificationStarted), + Questions); return View("Date", model); } @@ -90,7 +91,7 @@ public async Task WhenWasTheQualificationStarted(DateQuestionMode if (!ModelState.IsValid || !questionModelValidator.IsValid(model)) { var questionPage = await contentService.GetDateQuestionPage(QuestionPages.WhenWasTheQualificationStarted); - + // ReSharper disable once InvertIf if (questionPage is not null) { @@ -120,7 +121,7 @@ public async Task WhatLevelIsTheQualification(RadioQuestionModel if (!ModelState.IsValid) { var questionPage = await contentService.GetRadioQuestionPage(QuestionPages.WhatLevelIsTheQualification); - + // ReSharper disable once InvertIf if (questionPage is not null) { @@ -133,12 +134,13 @@ public async Task WhatLevelIsTheQualification(RadioQuestionModel userJourneyCookieService.SetLevelOfQualification(model.Option!); - if (model.Option == "2" && WasAwardedBetweenSeptember2014AndAugust2019()) - { - return RedirectToAction("QualificationsStartedBetweenSept2014AndAug2019", "Advice"); - } - - return RedirectToAction(nameof(this.WhatIsTheAwardingOrganisation)); + return model.Option switch + { + "2" when WasAwardedBetweenSeptember2014AndAugust2019() => + RedirectToAction("QualificationsStartedBetweenSept2014AndAug2019", "Advice"), + "7" => RedirectToAction(nameof(AdviceController.QualificationLevel7), "Advice"), + _ => RedirectToAction(nameof(this.WhatIsTheAwardingOrganisation)) + }; } [HttpGet("what-is-the-awarding-organisation")] @@ -154,8 +156,8 @@ public async Task WhatIsTheAwardingOrganisation() var qualifications = await GetFilteredQualifications(); var model = await MapDropdownModel(new DropdownQuestionModel(), questionPage, qualifications, - nameof(this.WhatIsTheAwardingOrganisation), - Questions); + nameof(this.WhatIsTheAwardingOrganisation), + Questions); return View("Dropdown", model); } @@ -167,15 +169,15 @@ public async Task WhatIsTheAwardingOrganisation(DropdownQuestionM { var questionPage = await contentService.GetDropdownQuestionPage(QuestionPages.WhatIsTheAwardingOrganisation); - + // ReSharper disable once InvertIf if (questionPage is not null) { var qualifications = await GetFilteredQualifications(); model = await MapDropdownModel(model, questionPage, qualifications, - nameof(this.WhatIsTheAwardingOrganisation), - Questions); + nameof(this.WhatIsTheAwardingOrganisation), + Questions); model.HasErrors = true; } @@ -239,8 +241,9 @@ private async Task MapRadioModel(RadioQuestionModel model, R return model; } - private async Task MapDateModel(DateQuestionModel model, DateQuestionPage question, string actionName, - string controllerName) + private async Task MapDateModel(DateQuestionModel model, DateQuestionPage question, + string actionName, + string controllerName) { model.Question = question.Question; model.CtaButtonText = question.CtaButtonText; @@ -258,9 +261,10 @@ private async Task MapDateModel(DateQuestionModel model, Date return model; } - private async Task MapDropdownModel(DropdownQuestionModel model, DropdownQuestionPage question, - List qualifications, string actionName, - string controllerName) + private async Task MapDropdownModel(DropdownQuestionModel model, + DropdownQuestionPage question, + List qualifications, string actionName, + string controllerName) { var awardingOrganisationExclusions = new[] { AwardingOrganisations.AllHigherEducation, AwardingOrganisations.Various }; @@ -294,7 +298,7 @@ var uniqueAwardingOrganisations Text = awardingOrg }); } - + model.ErrorBannerHeading = question.ErrorBannerHeading; model.ErrorBannerLinkText = question.ErrorBannerLinkText; model.AdditionalInformationHeader = question.AdditionalInformationHeader; diff --git a/tests/Dfe.EarlyYearsQualification.AccessibilityTests/.pa11yci-ubuntu.js b/tests/Dfe.EarlyYearsQualification.AccessibilityTests/.pa11yci-ubuntu.js index 1dcf5578..10acca09 100644 --- a/tests/Dfe.EarlyYearsQualification.AccessibilityTests/.pa11yci-ubuntu.js +++ b/tests/Dfe.EarlyYearsQualification.AccessibilityTests/.pa11yci-ubuntu.js @@ -26,6 +26,7 @@ var config = { "http://localhost:5000/advice/qualifications-achieved-in-wales", "http://localhost:5000/advice/qualifications-achieved-in-northern-ireland", "http://localhost:5000/advice/qualification-not-on-the-list", + "http://localhost:5000/advice/qualification-level-7" ] }; diff --git a/tests/Dfe.EarlyYearsQualification.E2ETests/cypress/e2e/journey/journey-spec.cy.js b/tests/Dfe.EarlyYearsQualification.E2ETests/cypress/e2e/journey/journey-spec.cy.js index 57d68f31..2739094f 100644 --- a/tests/Dfe.EarlyYearsQualification.E2ETests/cypress/e2e/journey/journey-spec.cy.js +++ b/tests/Dfe.EarlyYearsQualification.E2ETests/cypress/e2e/journey/journey-spec.cy.js @@ -105,15 +105,15 @@ describe('A spec used to test the various routes through the journey', () => { }) cy.get('#3').click(); cy.get('button[id="question-submit"]').click(); - + // what-is-the-awarding-organisation page cy.location().should((loc) => { expect(loc.pathname).to.eq('/questions/what-is-the-awarding-organisation'); }) - + cy.get('#awarding-organisation-select').select(1); // first no-default item in the list cy.get('button[id="question-submit"]').click(); - + // qualifications page cy.location().should((loc) => { expect(loc.pathname).to.eq('/qualifications'); @@ -137,7 +137,7 @@ describe('A spec used to test the various routes through the journey', () => { cy.get('#yes_0_0').click(); cy.get('#yes_1_0').click(); cy.get('button[id="additional-requirement-button"]').click(); - + // qualification details page cy.location().should((loc) => { expect(loc.pathname).to.eq('/qualifications/qualification-details/EYQ-240'); @@ -187,14 +187,14 @@ describe('A spec used to test the various routes through the journey', () => { // click not on the list link cy.get('a[href="/advice/qualification-not-on-the-list"]').click(); - + // qualification not on the list page cy.location().should((loc) => { expect(loc.pathname).to.eq('/advice/qualification-not-on-the-list'); }) cy.get('#advice-page-heading').should("contain.text", "Qualification not on the list"); - + // check back button goes back to the qualifications list page cy.get('#back-button').click(); @@ -203,6 +203,47 @@ describe('A spec used to test the various routes through the journey', () => { }) }) + it("Selecting qualification level 7 should navigate to the level 7 advice page", () => { + // home page + cy.get('.govuk-button--start').click(); + + // where-was-the-qualification-awarded page + cy.location().should((loc) => { + expect(loc.pathname).to.eq('/questions/where-was-the-qualification-awarded'); + }) + + cy.get('#england').click(); + cy.get('button[id="question-submit"]').click(); + + // when-was-the-qualification-started page + cy.location().should((loc) => { + expect(loc.pathname).to.eq('/questions/when-was-the-qualification-started'); + }) + + cy.get('#date-started-month').type("6"); + cy.get('#date-started-year').type("2022"); + cy.get('button[id="question-submit"]').click(); + + // what-level-is-the-qualification page + cy.location().should((loc) => { + expect(loc.pathname).to.eq('/questions/what-level-is-the-qualification'); + }) + cy.get('#7').click(); + cy.get('button[id="question-submit"]').click(); + + // level 7 advice page + cy.location().should((loc) => { + expect(loc.pathname).to.eq('/advice/qualification-level-7'); + }) + + // check back button goes back to the what level is the qualification page + cy.get('#back-button').click(); + + cy.location().should((loc) => { + expect(loc.pathname).to.eq('/questions/what-level-is-the-qualification'); + }) + }) + it("should move the user back to the previous page when they click on the back button", () => { // home page cy.get('.govuk-button--start').click(); @@ -221,45 +262,45 @@ describe('A spec used to test the various routes through the journey', () => { }) const testDates = [ - ['09', '2014'], - ['06', '2017'], - ['08', '2019'], + ['09', '2014'], + ['06', '2017'], + ['08', '2019'], ]; - + testDates.forEach((date) => { - const [month, year] = date; - it(`should redirect when qualification is level 2 and startMonth is ${month} and startYear is ${year}`, () => { - // home page - cy.get('.govuk-button--start').click(); - - // where-was-the-qualification-awarded page - cy.location().should((loc) => { - expect(loc.pathname).to.eq('/questions/where-was-the-qualification-awarded'); - }) - - cy.get('#england').click(); - cy.get('button[id="question-submit"]').click(); - - // when-was-the-qualification-started page - cy.location().should((loc) => { - expect(loc.pathname).to.eq('/questions/when-was-the-qualification-started'); - }) - - cy.get('#date-started-month').type(month); - cy.get('#date-started-year').type(year); - cy.get('button[id="question-submit"]').click(); - - // what-level-is-the-qualification page - cy.location().should((loc) => { - expect(loc.pathname).to.eq('/questions/what-level-is-the-qualification'); - }) - cy.get('#2').click(); - cy.get('button[id="question-submit"]').click(); - - // level-2-qualifications-started-between-1-sept-2014-and-31-aug-2019 page - cy.location().should((loc) => { - expect(loc.pathname).to.eq('/advice/level-2-qualifications-started-between-1-sept-2014-and-31-aug-2019'); - }) + const [month, year] = date; + it(`should redirect when qualification is level 2 and startMonth is ${month} and startYear is ${year}`, () => { + // home page + cy.get('.govuk-button--start').click(); + + // where-was-the-qualification-awarded page + cy.location().should((loc) => { + expect(loc.pathname).to.eq('/questions/where-was-the-qualification-awarded'); + }) + + cy.get('#england').click(); + cy.get('button[id="question-submit"]').click(); + + // when-was-the-qualification-started page + cy.location().should((loc) => { + expect(loc.pathname).to.eq('/questions/when-was-the-qualification-started'); }) + + cy.get('#date-started-month').type(month); + cy.get('#date-started-year').type(year); + cy.get('button[id="question-submit"]').click(); + + // what-level-is-the-qualification page + cy.location().should((loc) => { + expect(loc.pathname).to.eq('/questions/what-level-is-the-qualification'); + }) + cy.get('#2').click(); + cy.get('button[id="question-submit"]').click(); + + // level-2-qualifications-started-between-1-sept-2014-and-31-aug-2019 page + cy.location().should((loc) => { + expect(loc.pathname).to.eq('/advice/level-2-qualifications-started-between-1-sept-2014-and-31-aug-2019'); + }) + }) }) }) \ No newline at end of file diff --git a/tests/Dfe.EarlyYearsQualification.E2ETests/cypress/e2e/pages/advice-spec.cy.js b/tests/Dfe.EarlyYearsQualification.E2ETests/cypress/e2e/pages/advice-spec.cy.js index 09adb737..cb0a6164 100644 --- a/tests/Dfe.EarlyYearsQualification.E2ETests/cypress/e2e/pages/advice-spec.cy.js +++ b/tests/Dfe.EarlyYearsQualification.E2ETests/cypress/e2e/pages/advice-spec.cy.js @@ -38,4 +38,11 @@ describe("A spec that tests advice pages", () => { cy.get("#advice-page-heading").should("contain.text", "Qualifications achieved in Northern Ireland"); cy.get("#advice-page-body").should("contain.text", "Test Advice Page Body"); }) + + it("Checks the Qualifications level 7 details are on the page", () => { + cy.visit("/advice/qualification-level-7"); + + cy.get("#advice-page-heading").should("contain.text", "Qualification at Level 7"); + cy.get("#advice-page-body").should("contain.text", "Test Advice Page Body"); + }) }) \ No newline at end of file diff --git a/tests/Dfe.EarlyYearsQualification.UnitTests/Controllers/AdviceControllerTests.cs b/tests/Dfe.EarlyYearsQualification.UnitTests/Controllers/AdviceControllerTests.cs index 86801fa3..3f27431a 100644 --- a/tests/Dfe.EarlyYearsQualification.UnitTests/Controllers/AdviceControllerTests.cs +++ b/tests/Dfe.EarlyYearsQualification.UnitTests/Controllers/AdviceControllerTests.cs @@ -358,4 +358,63 @@ public async Task QualificationNotOnTheList_ContentServiceReturnsAdvicePage_Retu mockHtmlRenderer.Verify(x => x.ToHtml(It.IsAny()), Times.Once); } + + [TestMethod] + public async Task QualificationLevel7_ContentServiceReturnsNoAdvicePage_RedirectsToErrorPage() + { + var mockLogger = new Mock>(); + var mockContentService = new Mock(); + var mockHtmlRenderer = new Mock(); + + var controller = new AdviceController(mockLogger.Object, mockContentService.Object, mockHtmlRenderer.Object); + + mockContentService.Setup(x => x.GetAdvicePage(AdvicePages.QualificationLevel7)) + .ReturnsAsync((AdvicePage?)default).Verifiable(); + + var result = await controller.QualificationLevel7(); + + result.Should().NotBeNull(); + + var resultType = result as RedirectToActionResult; + + resultType.Should().NotBeNull(); + + resultType!.ActionName.Should().Be("Index"); + resultType.ControllerName.Should().Be("Error"); + + mockLogger.VerifyError("No content for the advice page"); + } + + [TestMethod] + public async Task QualificationLevel7_ContentServiceReturnsAdvicePage_ReturnsAdvicePageModel() + { + var mockLogger = new Mock>(); + var mockContentService = new Mock(); + var mockHtmlRenderer = new Mock(); + + var controller = new AdviceController(mockLogger.Object, mockContentService.Object, mockHtmlRenderer.Object); + + var renderedHtmlBody = "Test html body (level 7)"; + + var advicePage = new AdvicePage { Heading = "Heading (level 7)", Body = ContentfulContentHelper.Text("Anything") }; + mockContentService.Setup(x => x.GetAdvicePage(AdvicePages.QualificationLevel7)) + .ReturnsAsync(advicePage); + + mockHtmlRenderer.Setup(x => x.ToHtml(It.IsAny())).ReturnsAsync(renderedHtmlBody); + + var result = await controller.QualificationLevel7(); + + result.Should().NotBeNull(); + + var resultType = result as ViewResult; + resultType.Should().NotBeNull(); + + var model = resultType!.Model as AdvicePageModel; + model.Should().NotBeNull(); + + model!.Heading.Should().Be(advicePage.Heading); + model.BodyContent.Should().Be(renderedHtmlBody); + + mockHtmlRenderer.Verify(x => x.ToHtml(It.IsAny()), Times.Once); + } } \ No newline at end of file diff --git a/tests/Dfe.EarlyYearsQualification.UnitTests/Controllers/QuestionsControllerTests.cs b/tests/Dfe.EarlyYearsQualification.UnitTests/Controllers/QuestionsControllerTests.cs index edd96fd7..3bfaf0a7 100644 --- a/tests/Dfe.EarlyYearsQualification.UnitTests/Controllers/QuestionsControllerTests.cs +++ b/tests/Dfe.EarlyYearsQualification.UnitTests/Controllers/QuestionsControllerTests.cs @@ -680,6 +680,36 @@ public async Task Post_WhatLevelIsTheQualification_Level2WithInDate_ReturnsRedir resultType.ControllerName.Should().Be("Advice"); } + [TestMethod] + public async Task Post_WhatLevelIsTheQualification_Level7_ReturnsRedirectResponse() + { + var mockLogger = new Mock>(); + var mockContentService = new Mock(); + var mockRenderer = new Mock(); + var mockUserJourneyCookieService = new Mock(); + var mockContentFilterService = new Mock(); + var mockQuestionModelValidator = new Mock(); + + mockUserJourneyCookieService.Setup(x => x.GetWhenWasQualificationAwarded()) + .Returns((6, 2015)); + var controller = new QuestionsController(mockLogger.Object, mockContentService.Object, mockRenderer.Object, + mockUserJourneyCookieService.Object, mockContentFilterService.Object, + mockQuestionModelValidator.Object); + + var result = await controller.WhatLevelIsTheQualification(new RadioQuestionModel + { + Option = "7" + }); + + result.Should().NotBeNull(); + + var resultType = result as RedirectToActionResult; + resultType.Should().NotBeNull(); + + resultType!.ActionName.Should().Be(nameof(AdviceController.QualificationLevel7)); + resultType.ControllerName.Should().Be("Advice"); + } + [TestMethod] public async Task WhatIsTheAwardingOrganisation_ContentServiceReturnsNoQuestionPage_RedirectsToErrorPage() { diff --git a/tests/Dfe.EarlyYearsQualification.UnitTests/Mocks/MockContentfulServiceTests.cs b/tests/Dfe.EarlyYearsQualification.UnitTests/Mocks/MockContentfulServiceTests.cs index c3a5b9db..64ab761e 100644 --- a/tests/Dfe.EarlyYearsQualification.UnitTests/Mocks/MockContentfulServiceTests.cs +++ b/tests/Dfe.EarlyYearsQualification.UnitTests/Mocks/MockContentfulServiceTests.cs @@ -45,7 +45,7 @@ public async Task GetAdvicePage_Level2SeptAndAug_ReturnsExpectedDetails() result.Body!.Content[0].Should().BeAssignableTo() .Which.Content.Should().ContainSingle(x => ((Text)x).Value == "Test Advice Page Body"); } - + [TestMethod] public async Task GetAdvicePage_QualificationsAchievedInScotland_ReturnsExpectedDetails() { @@ -58,7 +58,7 @@ public async Task GetAdvicePage_QualificationsAchievedInScotland_ReturnsExpected result.Body!.Content[0].Should().BeAssignableTo() .Which.Content.Should().ContainSingle(x => ((Text)x).Value == "Test Advice Page Body"); } - + [TestMethod] public async Task GetAdvicePage_QualificationsAchievedInWales_ReturnsExpectedDetails() { @@ -71,7 +71,7 @@ public async Task GetAdvicePage_QualificationsAchievedInWales_ReturnsExpectedDet result.Body!.Content[0].Should().BeAssignableTo() .Which.Content.Should().ContainSingle(x => ((Text)x).Value == "Test Advice Page Body"); } - + [TestMethod] public async Task GetAdvicePage_QualificationsAchievedInNorthernIreland_ReturnsExpectedDetails() { @@ -84,7 +84,7 @@ public async Task GetAdvicePage_QualificationsAchievedInNorthernIreland_ReturnsE result.Body!.Content[0].Should().BeAssignableTo() .Which.Content.Should().ContainSingle(x => ((Text)x).Value == "Test Advice Page Body"); } - + [TestMethod] public async Task GetAdvicePage_QualificationNotOnTheList_ReturnsExpectedDetails() { @@ -93,7 +93,20 @@ public async Task GetAdvicePage_QualificationNotOnTheList_ReturnsExpectedDetails var result = await contentfulService.GetAdvicePage(AdvicePages.QualificationNotOnTheList); result.Should().NotBeNull(); result.Should().BeAssignableTo(); - result!.Heading.Should().NotBeNullOrEmpty(); + result!.Heading.Should().Be("Qualification not on the list"); + result.Body!.Content[0].Should().BeAssignableTo() + .Which.Content.Should().ContainSingle(x => ((Text)x).Value == "Test Advice Page Body"); + } + + [TestMethod] + public async Task GetAdvicePage_QualificationLevel7_ReturnsExpectedDetails() + { + var contentfulService = new MockContentfulService(); + + var result = await contentfulService.GetAdvicePage(AdvicePages.QualificationLevel7); + result.Should().NotBeNull(); + result.Should().BeAssignableTo(); + result!.Heading.Should().Be("Qualification at Level 7"); result.Body!.Content[0].Should().BeAssignableTo() .Which.Content.Should().ContainSingle(x => ((Text)x).Value == "Test Advice Page Body"); } @@ -279,11 +292,13 @@ public async Task GetRadioQuestionPage_PassInWhatLevelIsTheQualification_Returns result.AdditionalInformationBody!.Content[0].Should().BeAssignableTo() .Which.Content.Should().ContainSingle(x => ((Text)x).Value == "This is the additional information body"); result.Options.Should().NotBeNullOrEmpty(); - result.Options.Count.Should().Be(2); + result.Options.Count.Should().Be(3); result.Options[0].Label.Should().Be("Level 2"); result.Options[0].Value.Should().Be("2"); result.Options[1].Label.Should().Be("Level 3"); result.Options[1].Value.Should().Be("3"); + result.Options[2].Label.Should().Be("Level 7"); + result.Options[2].Value.Should().Be("7"); } [TestMethod] @@ -489,11 +504,11 @@ public async Task GetCheckAdditionalRequirementsPageContent_ReturnsExpectedDetai result.Should().NotBeNull(); result.Should().BeAssignableTo(); result!.BackButton.Should().BeEquivalentTo(new NavigationLink - { - DisplayText = "Back", - OpenInNewTab = false, - Href = "/" - }); + { + DisplayText = "Back", + OpenInNewTab = false, + Href = "/" + }); result.ErrorMessage.Should().NotBeNullOrEmpty(); result.ErrorSummaryHeading.Should().NotBeNullOrEmpty(); result.Heading.Should().NotBeNullOrEmpty();