File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
application/CohortManager/src/Functions/ScreeningValidationService/LookupValidation
tests/UnitTests/ScreeningValidationServiceTests/LookupValidation Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 88 }
99 ],
1010 "Rules" : [
11+ {
12+ "RuleName" : " 12.BlockedParticipant.BSSelect.Fatal" ,
13+ "Expression" : " newParticipant.BlockedFlag != \" 1\" " ,
14+ "Actions" : {
15+ "OnFailure" : {
16+ "Name" : " OutputExpression" ,
17+ "Context" : {
18+ "Expression" :" \" Participant is blocked\" "
19+ }
20+ }
21+ }
22+ },
1123 {
1224 "RuleName" : " 36.ValidatePrimaryCareProvider.NonFatal" ,
1325 "Expression" : " string.IsNullOrEmpty(newParticipant.PrimaryCareProvider) || dbLookup.CheckIfPrimaryCareProviderExists(newParticipant.primaryCareProvider)" ,
Original file line number Diff line number Diff line change @@ -680,6 +680,26 @@ public async Task Run_ParticipantLocationRemainingOutsideOfCohort_ShouldThrowExc
680680 It . IsAny < ParticipantCsvRecord > ( ) ) ,
681681 Times . Once ( ) ) ;
682682 }
683+
684+ [ TestMethod ]
685+ public async Task Run_BlockedParticipant_CreatesException ( )
686+ {
687+ // Arrange
688+ SetupRules ( "LookupRules" ) ;
689+ _requestBody . NewParticipant . BlockedFlag = "1" ;
690+ var json = JsonSerializer . Serialize ( _requestBody ) ;
691+ SetUpRequestBody ( json ) ;
692+
693+ // Act
694+ await _sut . RunAsync ( _request . Object ) ;
695+
696+ // Assert
697+ _exceptionHandler . Verify ( handleException => handleException . CreateValidationExceptionLog (
698+ It . Is < IEnumerable < RuleResultTree > > ( r => r . Any ( x => x . Rule . RuleName == "12.BlockedParticipant.BSSelect.Fatal" ) ) ,
699+ It . IsAny < ParticipantCsvRecord > ( ) ) ,
700+ Times . Once ( ) ) ;
701+ }
702+
683703 private void SetUpRequestBody ( string json )
684704 {
685705 var byteArray = Encoding . ASCII . GetBytes ( json ) ;
You can’t perform that action at this time.
0 commit comments