From 1617ea7af3d7d5521cac63d91e04cbc68890fab5 Mon Sep 17 00:00:00 2001 From: Andrew Horth Date: Mon, 18 Sep 2023 15:06:05 +0100 Subject: [PATCH] Amended to run tests for both change of name and change of date of birth scenarios --- .../CaseTests.cs | 57 +++++++++++++++---- 1 file changed, 45 insertions(+), 12 deletions(-) diff --git a/TeachingRecordSystem/tests/TeachingRecordSystem.SupportUi.EndToEndTests/CaseTests.cs b/TeachingRecordSystem/tests/TeachingRecordSystem.SupportUi.EndToEndTests/CaseTests.cs index 854347503a..f4221baafb 100644 --- a/TeachingRecordSystem/tests/TeachingRecordSystem.SupportUi.EndToEndTests/CaseTests.cs +++ b/TeachingRecordSystem/tests/TeachingRecordSystem.SupportUi.EndToEndTests/CaseTests.cs @@ -9,12 +9,23 @@ public CaseTests(HostFixture hostFixture) { } - [Fact] - public async Task SelectCaseAndApprove() + [Theory] + [InlineData(true)] + [InlineData(false)] + public async Task SelectCaseAndApprove(bool isNameChange) { var createPersonResult = await TestData.CreatePerson(); - var createIncidentResult = await TestData.CreateNameChangeIncident(b => b.WithCustomerId(createPersonResult.ContactId)); - var caseReference = createIncidentResult.TicketNumber; + string caseReference; + if (isNameChange) + { + var createIncidentResult = await TestData.CreateNameChangeIncident(b => b.WithCustomerId(createPersonResult.ContactId)); + caseReference = createIncidentResult.TicketNumber; + } + else + { + var createIncidentResult = await TestData.CreateDateOfBirthChangeIncident(b => b.WithCustomerId(createPersonResult.ContactId)); + caseReference = createIncidentResult.TicketNumber; + } await using var context = await HostFixture.CreateBrowserContext(); var page = await context.NewPageAsync(); @@ -40,12 +51,23 @@ public async Task SelectCaseAndApprove() await page.AssertFlashMessage("The request has been accepted"); } - [Fact] - public async Task SelectCaseAndReject() + [Theory] + [InlineData(true)] + [InlineData(false)] + public async Task SelectCaseAndReject(bool isNameChange) { var createPersonResult = await TestData.CreatePerson(); - var createIncidentResult = await TestData.CreateNameChangeIncident(b => b.WithCustomerId(createPersonResult.ContactId)); - var caseReference = createIncidentResult.TicketNumber; + string caseReference; + if (isNameChange) + { + var createIncidentResult = await TestData.CreateNameChangeIncident(b => b.WithCustomerId(createPersonResult.ContactId)); + caseReference = createIncidentResult.TicketNumber; + } + else + { + var createIncidentResult = await TestData.CreateDateOfBirthChangeIncident(b => b.WithCustomerId(createPersonResult.ContactId)); + caseReference = createIncidentResult.TicketNumber; + } await using var context = await HostFixture.CreateBrowserContext(); var page = await context.NewPageAsync(); @@ -73,12 +95,23 @@ public async Task SelectCaseAndReject() await page.AssertFlashMessage("The request has been rejected"); } - [Fact] - public async Task SelectCaseAndCancel() + [Theory] + [InlineData(true)] + [InlineData(false)] + public async Task SelectCaseAndCancel(bool isNameChange) { var createPersonResult = await TestData.CreatePerson(); - var createIncidentResult = await TestData.CreateNameChangeIncident(b => b.WithCustomerId(createPersonResult.ContactId)); - var caseReference = createIncidentResult.TicketNumber; + string caseReference; + if (isNameChange) + { + var createIncidentResult = await TestData.CreateNameChangeIncident(b => b.WithCustomerId(createPersonResult.ContactId)); + caseReference = createIncidentResult.TicketNumber; + } + else + { + var createIncidentResult = await TestData.CreateDateOfBirthChangeIncident(b => b.WithCustomerId(createPersonResult.ContactId)); + caseReference = createIncidentResult.TicketNumber; + } await using var context = await HostFixture.CreateBrowserContext(); var page = await context.NewPageAsync();