Skip to content

Commit 6a9d7fa

Browse files
fix: removing rule 12.BlockedParticipant.Non.Fatal as it's not used and extending the HandleException to include category (#1630)
* fix: removing rule 12.BlockedParticipant.Non.Fatal as it's not actully used and updating HandleException in the ManageParticipant function to include category * fix: updating tests
1 parent 1c71bf7 commit 6a9d7fa

File tree

4 files changed

+6
-32
lines changed

4 files changed

+6
-32
lines changed

application/CohortManager/src/Functions/ParticipantManagementServices/ManageParticipant/ManageParticipant.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ namespace NHS.CohortManager.ParticipantManagementServices;
88
using System.Text.Json;
99
using Model;
1010
using DataServices.Client;
11-
using Microsoft.AspNetCore.Components.Web;
1211

1312
public class ManageParticipant
1413
{
@@ -67,7 +66,7 @@ public async Task Run([ServiceBusTrigger(topicName: "%ParticipantManagementTopic
6766
}
6867
else if (databaseParticipant.BlockedFlag == 1)
6968
{
70-
await HandleException(new InvalidOperationException("Participant is blocked"), participant, participantRecord.FileName);
69+
await HandleException(new InvalidOperationException("Participant is blocked"), participant, participantRecord.FileName, "0");
7170
return;
7271
}
7372
else
@@ -93,9 +92,9 @@ public async Task Run([ServiceBusTrigger(topicName: "%ParticipantManagementTopic
9392
}
9493
}
9594

96-
private async Task HandleException(Exception ex, Participant participant, string fileName)
95+
private async Task HandleException(Exception ex, Participant participant, string fileName, string category = "")
9796
{
9897
_logger.LogError(ex, "Manage Exception failed");
99-
await _handleException.CreateSystemExceptionLog(ex, participant, fileName);
98+
await _handleException.CreateSystemExceptionLog(ex, participant, fileName, category);
10099
}
101100
}

application/CohortManager/src/Functions/ScreeningValidationService/LookupValidation/Breast_Screening_lookupRules.json

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,6 @@
1212
}
1313
],
1414
"Rules": [
15-
{
16-
"RuleName": "12.BlockedParticipant.Non.Fatal",
17-
"Expression": "existingParticipant.BlockedFlag != \"1\"",
18-
"Actions": {
19-
"OnFailure": {
20-
"Name": "OutputExpression",
21-
"Context": {
22-
"Expression": "\"Participant is blocked\""
23-
}
24-
}
25-
}
26-
},
2715
{
2816
"RuleName": "45.GPPracticeCodeDoesNotExist.BSSelect.NonFatal",
2917
"LocalParams": [

tests/UnitTests/ParticipantManagementServicesTests/ManageParticipantTests/ManageParticipantTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ public async Task Run_ParticipantIsBlocked_CreateExceptionAndReturn()
165165
await _sut.Run(JsonSerializer.Serialize(_request));
166166

167167
// Assert
168+
169+
//__handleException.CreateSystemExceptionLog(ex, participant, fileName, category);
168170
_participantManagementClientMock
169171
.Verify(x => x.Add(It.IsAny<ParticipantManagement>()), Times.Never);
170172
_participantManagementClientMock
@@ -176,7 +178,7 @@ public async Task Run_ParticipantIsBlocked_CreateExceptionAndReturn()
176178
It.IsAny<InvalidOperationException>(),
177179
It.IsAny<Participant>(),
178180
It.IsAny<string>(),
179-
""), Times.Once);
181+
"0"), Times.Once);
180182
}
181183

182184
[TestMethod]

tests/UnitTests/ScreeningValidationServiceTests/LookupValidation/LookupValidationTests.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -293,21 +293,6 @@ public async Task Run_ParticipantLocationRemainingOutsideOfCohortAndNotInExclude
293293
StringAssert.Contains(body, "45.GPPracticeCodeDoesNotExist.BSSelect.NonFatal");
294294
}
295295

296-
[TestMethod]
297-
public async Task Run_BlockedParticipant_ReturnValidationException()
298-
{
299-
// Arrange
300-
_requestBody.ExistingParticipant.BlockedFlag = "1";
301-
var json = JsonSerializer.Serialize(_requestBody);
302-
SetUpRequestBody(json);
303-
304-
// Act
305-
var response = await _sut.RunAsync(_request.Object);
306-
string body = await AssertionHelper.ReadResponseBodyAsync(response);
307-
308-
// Assert
309-
StringAssert.Contains(body, "12.BlockedParticipant.Non.Fatal");
310-
}
311296

312297
[TestMethod]
313298

0 commit comments

Comments
 (0)