@@ -86,6 +86,18 @@ public async Task BlockParticipant_ExistingParticipant_ReturnsSuccess()
8686 DateOfBirth = "19231012"
8787 } ) ;
8888
89+ var pdsDemoResponse = JsonSerializer . Serialize (
90+ new PdsDemographic
91+ {
92+ NhsNumber = "6427635034" ,
93+ FamilyName = "Jones" ,
94+ DateOfBirth = "1923-10-12"
95+ } ) ;
96+
97+ _mockHttpClient . Setup ( x => x . SendGet ( "RetrievePdsDemographicUrl" , It . IsAny < Dictionary < string , string > > ( ) ) )
98+ . ReturnsAsync ( pdsDemoResponse ) ;
99+
100+
89101 _mockParticipantManagementClient . Setup ( x => x . Update ( It . IsAny < ParticipantManagement > ( ) ) )
90102 . ReturnsAsync ( true ) ;
91103 _mockHttpClient . Setup ( x => x . SendPost ( "NemsUnsubscribeUrl" , It . IsAny < Dictionary < string , string > > ( ) ) )
@@ -94,13 +106,13 @@ public async Task BlockParticipant_ExistingParticipant_ReturnsSuccess()
94106 StatusCode = HttpStatusCode . OK
95107 } ) ;
96108
97-
98109 //act
99110 var result = await _sut . BlockParticipant ( _request . Object ) ;
100111
101112 //asset
102113 Assert . AreEqual ( HttpStatusCode . OK , result . StatusCode ) ;
103114 _mockHttpClient . Verify ( x => x . SendPost ( "NemsUnsubscribeUrl" , It . IsAny < Dictionary < string , string > > ( ) ) , Times . Once ) ;
115+ _mockHttpClient . Verify ( x => x . SendGet ( "RetrievePdsDemographicUrl" , It . IsAny < Dictionary < string , string > > ( ) ) , Times . Once ) ;
104116 _mockParticipantManagementClient . Verify ( x => x . Update ( It . IsAny < ParticipantManagement > ( ) ) , Times . Once ) ;
105117 _mockHttpClient . VerifyNoOtherCalls ( ) ;
106118 }
@@ -232,10 +244,11 @@ public async Task BlockParticipant_ExistingParticipantFailsThreePointCheck_Retur
232244 //asset
233245 Assert . AreEqual ( HttpStatusCode . BadRequest , result . StatusCode ) ;
234246 _mockHttpClient . Verify ( x => x . SendPost ( "NemsUnsubscribeUrl" , It . IsAny < Dictionary < string , string > > ( ) ) , Times . Never ) ;
247+ _mockHttpClient . Verify ( x => x . SendGet ( "RetrievePdsDemographicUrl" , It . IsAny < Dictionary < string , string > > ( ) ) , Times . Once ) ;
235248 _mockHttpClient . VerifyNoOtherCalls ( ) ;
236249 _mockParticipantManagementClient . Verify ( x => x . GetSingleByFilter ( It . IsAny < Expression < Func < ParticipantManagement , bool > > > ( ) ) , Times . Once ) ;
237250 _mockParticipantManagementClient . VerifyNoOtherCalls ( ) ;
238- _mockParticipantDemographicClient . Verify ( x => x . GetSingleByFilter ( It . IsAny < Expression < Func < ParticipantDemographic , bool > > > ( ) ) , Times . Once ) ;
251+ _mockParticipantDemographicClient . Verify ( x => x . GetSingleByFilter ( It . IsAny < Expression < Func < ParticipantDemographic , bool > > > ( ) ) , Times . Never ) ;
239252 _mockParticipantDemographicClient . VerifyNoOtherCalls ( ) ;
240253 }
241254 [ TestMethod ]
0 commit comments