Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,25 @@
{
"WorkflowName": "Common",
"GlobalParams": [
{
"Name": "ValidCurrentPosting",
"Expression": "string.IsNullOrEmpty(newParticipant.CurrentPosting) OR dbLookup.CheckIfCurrentPostingExists(newParticipant.CurrentPosting)"
},
{
"Name": "ValidPrimaryCareProvider",
"Expression": "string.IsNullOrEmpty(newParticipant.PrimaryCareProvider) || dbLookup.CheckIfPrimaryCareProviderExists(newParticipant.PrimaryCareProvider)"
}
],
"Rules": [
{
"RuleName": "45.GPPracticeCodeDoesNotExist.BSSelect.NonFatal",
"RuleName": "45.GPPracticeCodeDoesNotExist.NBO.NonFatal",
"LocalParams": [
{
"Name": "EnglishPostingCategory",
"Expression": "string.Equals(dbLookup.RetrievePostingCategory(newParticipant.CurrentPosting), \"ENGLAND\", StringComparison.OrdinalIgnoreCase)"
},
{
"Name": "InvalidPostingCategory",
"Expression": "!(EnglishPostingCategory || string.Equals(newParticipant.CurrentPosting, \"ENG\", StringComparison.OrdinalIgnoreCase) || string.Equals(newParticipant.CurrentPosting, \"IM\", StringComparison.OrdinalIgnoreCase) || string.Equals(newParticipant.CurrentPosting, \"DMS\", StringComparison.OrdinalIgnoreCase))"
"Name": "WelshPostingCategory",
"Expression": "string.Equals(dbLookup.RetrievePostingCategory(newParticipant.CurrentPosting), \"WALES\", StringComparison.OrdinalIgnoreCase)"
},
{
"Name": "IsExcluded",
"Expression": "dbLookup.CheckIfPrimaryCareProviderInExcludedSmuList(newParticipant.PrimaryCareProvider)"
}
],
"Expression": "(InvalidPostingCategory || ValidPrimaryCareProvider || IsExcluded)",
"Expression": "(WelshPostingCategory || ValidPrimaryCareProvider || IsExcluded)",
"Actions": {
"OnFailure": {
"Name": "OutputExpression",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public class LookupValidationTests
private readonly Mock<ILogger<LookupValidation>> _mockLogger = new();
private readonly Mock<IDataLookupFacadeBreastScreening> _lookupValidation = new();

private readonly List<string> welshPostingCategories = new List<string>{"CLD","CYM","DYF","GWE","SGA","WGA"};

[TestInitialize]
public void IntialiseTests()
{
Expand Down Expand Up @@ -189,29 +191,64 @@ public async Task Run_CurrentPosting_ReturnNoContent(string currentPosting)
}

[TestMethod]
[DataRow("InvalidCurrentPosting", "InvalidPCP")]
[DataRow("ValidCurrentPosting", "ValidPCP")]
[DataRow("InvalidCurrentPosting", "ValidPCP")]
[DataRow("ValidCurrentPosting", null)]
[DataRow("InvalidCurrentPosting", null)]
public async Task Run_CurrentPostingAndPrimaryProvider_ReturnNoContent(string currentPosting, string primaryCareProvider)
[DataRow("BAA", "InvalidPCP", true)]
[DataRow(null, "InvalidPCP", true)]
[DataRow("BAA", "ValidPCP", true)]
[DataRow(null, "ValidPCP", true)]
[DataRow("BAA", "ValidPCP", false)]
[DataRow(null, "ValidPCP", false)]
[DataRow("BAA", null, false)]
[DataRow("BAA", null, true)]
[DataRow(null, null, false)]
[DataRow("CYM", "InvalidPCP", false)]
[DataRow("CYM", "ValidPCP", false)]
[DataRow("CYM", "InvalidPCP", true)]
[DataRow("CYM", "ValidPCP", true)]
public async Task Run_CurrentPostingAndPrimaryProvider_ReturnNoContent(string currentPosting, string primaryCareProvider, bool PCPIsExcluded)
{
// Arrange
_requestBody.NewParticipant.CurrentPosting = currentPosting;
_requestBody.NewParticipant.PrimaryCareProvider = primaryCareProvider;

var json = JsonSerializer.Serialize(_requestBody);
SetUpRequestBody(json);

_lookupValidation.Setup(x => x.ValidatePostingCategories(It.IsAny<string>())).Returns(currentPosting == "ValidCurrentPosting");
_lookupValidation.Setup(x => x.CheckIfPrimaryCareProviderExists(It.IsAny<string>())).Returns(primaryCareProvider == "ValidPCP");
_lookupValidation.Setup(x => x.CheckIfPrimaryCareProviderInExcludedSmuList(It.IsAny<string>())).Returns(PCPIsExcluded);
_lookupValidation.Setup(x => x.RetrievePostingCategory(It.IsIn<string>(welshPostingCategories))).Returns("WALES");
_lookupValidation.Setup(x => x.RetrievePostingCategory(It.IsNotIn<string>(welshPostingCategories))).Returns("ENGLAND");

// Act
var response = await _sut.RunAsync(_request.Object);
string body = await AssertionHelper.ReadResponseBodyAsync(response);

// Assert
Assert.IsFalse(body.Contains("45.GPPracticeCodeDoesNotExist.BSSelect.NonFatal"));
Assert.IsFalse(body.Contains("45.GPPracticeCodeDoesNotExist.BSSelect.NonFatal")); // Rule Not Triggered
}
[TestMethod]
[DataRow("BAA", "InvalidPCP",false)]
[DataRow("HJ", "InvalidPCP",false)]
[DataRow("DMS", "InvalidPCP",false)]
public async Task Run_CurrentPostingAndPrimaryProvider_ReturnsException(string currentPosting, string primaryCareProvider, bool PCPIsExcluded)
{
// Arrange
_requestBody.NewParticipant.CurrentPosting = currentPosting;
_requestBody.NewParticipant.PrimaryCareProvider = primaryCareProvider;
var json = JsonSerializer.Serialize(_requestBody);
SetUpRequestBody(json);

_lookupValidation.Setup(x => x.CheckIfPrimaryCareProviderExists(It.IsAny<string>())).Returns(primaryCareProvider == "ValidPCP");
_lookupValidation.Setup(x => x.CheckIfPrimaryCareProviderInExcludedSmuList(It.IsAny<string>())).Returns(PCPIsExcluded);
_lookupValidation.Setup(x => x.RetrievePostingCategory(It.IsIn<string>(welshPostingCategories))).Returns("WALES");
_lookupValidation.Setup(x => x.RetrievePostingCategory(It.IsNotIn<string>(welshPostingCategories))).Returns("ENGLAND");
// Act
var response = await _sut.RunAsync(_request.Object);
string body = await AssertionHelper.ReadResponseBodyAsync(response);

// Assert
Assert.IsTrue(body.Contains("45.GPPracticeCodeDoesNotExist.NBO.NonFatal"));
}


#region Validate BSO Code (Rule 54)
[TestMethod]
Expand Down Expand Up @@ -267,35 +304,6 @@ public async Task Run_AmendedParticipantHasValidBSO_ReturnNoContent(string reaso
#endregion

[TestMethod]
[DataRow("DMS", "Z00000")]
[DataRow("ENG", "Z00000")]
[DataRow("IM", "Z00000")]

public async Task Run_ParticipantLocationRemainingOutsideOfCohortAndNotInExcludedSMU_ReturnValidationException(string newCurrentPosting, string newPrimaryCareProvider)
{
// Arrange
_requestBody.NewParticipant.RecordType = Actions.New;
_requestBody.NewParticipant.CurrentPosting = newCurrentPosting;
_requestBody.NewParticipant.PrimaryCareProvider = newPrimaryCareProvider;

var json = JsonSerializer.Serialize(_requestBody);
SetUpRequestBody(json);
_lookupValidation.Setup(x => x.RetrievePostingCategory(newCurrentPosting)).Returns(newCurrentPosting);
_lookupValidation.Setup(x => x.CheckIfCurrentPostingExists(newCurrentPosting)).Returns(true);
_lookupValidation.Setup(x => x.CheckIfPrimaryCareProviderInExcludedSmuList(newPrimaryCareProvider)).Returns(false);
_lookupValidation.Setup(x => x.CheckIfPrimaryCareProviderExists(newPrimaryCareProvider)).Returns(false);

// Act
var response = await _sut.RunAsync(_request.Object);
string body = await AssertionHelper.ReadResponseBodyAsync(response);

// Assert
StringAssert.Contains(body, "45.GPPracticeCodeDoesNotExist.BSSelect.NonFatal");
}


[TestMethod]

[DataRow(null, null, null, null, null, null, "Existing Address 1", "Existing Address 2", "Existing Address 3", "Existing Address 4", "Existing Address 5", "RG2 5TX")] // All New Address Fields null, New Postcode null, Existing Address fields full.
[DataRow("", "", "", "", "", "", "Existing Address 1", "Existing Address 2", "Existing Address 3", "Existing Address 4", "Existing Address 5", "RG2 5TX")] // All New Address Fields empty, New Postcode empty, Existing Address fields full.
[DataRow(null, null, null, null, null, "RG2 5TX", "Existing Address 1", "Existing Address 2", "Existing Address 3", "Existing Address 4", "Existing Address 5", "ZZ99 6TF")] // All New Address Fields null, All existing address field full, Postcode does not match.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
// This equates to "@epic4d-" tags, configured in the package.json at the playwright-tests root location.


export const runnerBasedEpic4dTestScenariosAdd = "@DTOSS-9496-01|@DTOSS-9498-01|@DTOSS-A456-01|@DTOSS-A457-01|@DTOSS-A459-01";
export const runnerBasedEpic4dTestScenariosAdd = "@DTOSS-11715-01|@DTOSS-9496-01|@DTOSS-9498-01|@DTOSS-A456-01|@DTOSS-A457-01|@DTOSS-A459-01";
export const runnerBasedEpic4dTestScenariosAmend = "@DTOSS-9497-01|@DTOSS-9499-01|@DTOSS-A451-01|@DTOSS-A452-01|@DTOSS-A453-01|@DTOSS-A454-01|@DTOSS-A455-01|@DTOSS-A458-01";
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"validations": [
{
"validations": {
"apiEndpoint": "api/ExceptionManagementDataService",
"NhsNumber": "9995272172",
"RuleId": 45,
"RuleDescription": "GP practice code does not exist"
},
"meta": {
"testJiraId": "@DTOSS-11715-01",
"requirementJiraId": "DTOSS-11715",
"additionalTags": "@regression @e2e @epic4d-rule8 Verify ADD records with 'HMP' Current Posting is processed a rule 45 Exception for NHS Number 9995272172"
}
},
{
"validations": {
"apiEndpoint": "api/ParticipantManagementDataService",
"RecordType": "ADD",
"NHSNumber": 9995272172,
"expectedCount": 1
},
"meta": {
"testJiraId": "@DTOSS-11715-01",
"requirementJiraId": "DTOSS-11715",
"additionalTags": "@regression @e2e @epic4d-rule8 Verify ADD records is processed without any Exception and participant is stored on Participant_Management table for NHS Number 9995272172"
}
},
{
"validations": {
"apiEndpoint": "api/ParticipantDemographicDataService",
"NhsNumber": 9995272172,
"expectedCount": 1
},
"meta": {
"testJiraId": "@DTOSS-11715-01",
"requirementJiraId": "DTOSS-11715",
"additionalTags": "@regression @e2e @epic4d-rule8 Verify ADD records is processed without any Exception and participant is stored on Participant_Demographic table for NHS Number 9995272172"
}
}
],
"inputParticipantRecord": [
{
"record_type": "ADD",
"change_time_stamp": null,
"serial_change_number": 1,
"nhs_number": 9995272172,
"superseded_by_nhs_number": null,
"primary_care_provider": "X99999",
"primary_care_effective_from_date": null,
"current_posting": "HMP",
"current_posting_effective_from_date": "20130319",
"name_prefix": "Mrs",
"given_name": "Dalby",
"other_given_name": "Conners",
"family_name": "Reg",
"previous_family_name": "gibbins",
"date_of_birth": "19720112",
"gender": 1,
"address_line_1": "AddressLine1",
"address_line_2": "AddressLine2",
"address_line_3": "AddressLine3",
"address_line_4": "AddressLine4",
"address_line_5": "AddressLine5",
"postcode": "AB23 1AF",
"paf_key": "Z3S4Q5X8",
"address_effective_from_date": "20250101",
"reason_for_removal": null,
"reason_for_removal_effective_from_date": null,
"date_of_death": null,
"death_status": null,
"home_telephone_number": "161999999",
"home_telephone_effective_from_date": "20240908",
"mobile_telephone_number": "788888888",
"mobile_telephone_effective_from_date": "20010101",
"email_address": "[email protected]",
"email_address_effective_from_date": "20240101",
"preferred_language": "en",
"is_interpreter_required": false,
"invalid_flag": false,
"eligibility": true
}
],
"nhsNumbers": [
"9995272172"
]
}
Loading