@@ -74,7 +74,7 @@ public async Task ApiClient_HandlesHttpRequestException()
7474 x => x . Log (
7575 LogLevel . Error ,
7676 It . IsAny < EventId > ( ) ,
77- It . Is < It . IsAnyType > ( ( v , t ) => v . ToString ( ) . Contains ( "Error retrieving virtual keys" ) ) ,
77+ It . Is < It . IsAnyType > ( ( v , t ) => v != null && v . ToString ( ) != null && v . ToString ( ) ! . Contains ( "Error retrieving virtual keys" ) ) ,
7878 It . IsAny < Exception > ( ) ,
7979 It . IsAny < Func < It . IsAnyType , Exception ? , string > > ( ) ) ,
8080 Times . Once ) ;
@@ -101,7 +101,7 @@ public async Task ApiClient_HandlesTimeout()
101101 x => x . Log (
102102 LogLevel . Error ,
103103 It . IsAny < EventId > ( ) ,
104- It . Is < It . IsAnyType > ( ( v , t ) => v . ToString ( ) . Contains ( "Error retrieving virtual keys" ) ) ,
104+ It . Is < It . IsAnyType > ( ( v , t ) => v != null && v . ToString ( ) != null && v . ToString ( ) ! . Contains ( "Error retrieving virtual keys" ) ) ,
105105 It . IsAny < Exception > ( ) ,
106106 It . IsAny < Func < It . IsAnyType , Exception ? , string > > ( ) ) ,
107107 Times . Once ) ;
@@ -134,7 +134,7 @@ public async Task ApiClient_HandlesInvalidJson()
134134 x => x . Log (
135135 LogLevel . Error ,
136136 It . IsAny < EventId > ( ) ,
137- It . Is < It . IsAnyType > ( ( v , t ) => v . ToString ( ) . Contains ( "Error retrieving virtual keys" ) ) ,
137+ It . Is < It . IsAnyType > ( ( v , t ) => v != null && v . ToString ( ) != null && v . ToString ( ) ! . Contains ( "Error retrieving virtual keys" ) ) ,
138138 It . IsAny < Exception > ( ) ,
139139 It . IsAny < Func < It . IsAnyType , Exception ? , string > > ( ) ) ,
140140 Times . Once ) ;
@@ -167,7 +167,7 @@ public async Task ApiClient_HandlesServerError()
167167 x => x . Log (
168168 LogLevel . Error ,
169169 It . IsAny < EventId > ( ) ,
170- It . Is < It . IsAnyType > ( ( v , t ) => v . ToString ( ) . Contains ( "Error retrieving virtual keys" ) ) ,
170+ It . Is < It . IsAnyType > ( ( v , t ) => v != null && v . ToString ( ) != null && v . ToString ( ) ! . Contains ( "Error retrieving virtual keys" ) ) ,
171171 It . IsAny < Exception > ( ) ,
172172 It . IsAny < Func < It . IsAnyType , Exception ? , string > > ( ) ) ,
173173 Times . Once ) ;
@@ -200,7 +200,7 @@ public async Task ApiClient_HandlesUnauthorized()
200200 x => x . Log (
201201 LogLevel . Error ,
202202 It . IsAny < EventId > ( ) ,
203- It . Is < It . IsAnyType > ( ( v , t ) => v . ToString ( ) . Contains ( "Error retrieving virtual keys" ) ) ,
203+ It . Is < It . IsAnyType > ( ( v , t ) => v != null && v . ToString ( ) != null && v . ToString ( ) ! . Contains ( "Error retrieving virtual keys" ) ) ,
204204 It . IsAny < Exception > ( ) ,
205205 It . IsAny < Func < It . IsAnyType , Exception ? , string > > ( ) ) ,
206206 Times . Once ) ;
@@ -233,7 +233,7 @@ public async Task ApiClient_HandlesNotFound_ForGetAll()
233233 x => x . Log (
234234 LogLevel . Error ,
235235 It . IsAny < EventId > ( ) ,
236- It . Is < It . IsAnyType > ( ( v , t ) => v . ToString ( ) . Contains ( "Error retrieving virtual keys" ) ) ,
236+ It . Is < It . IsAnyType > ( ( v , t ) => v != null && v . ToString ( ) != null && v . ToString ( ) ! . Contains ( "Error retrieving virtual keys" ) ) ,
237237 It . IsAny < Exception > ( ) ,
238238 It . IsAny < Func < It . IsAnyType , Exception ? , string > > ( ) ) ,
239239 Times . Once ) ;
@@ -269,15 +269,15 @@ public async Task ApiClient_ReturnsEmptyCollection_WhenApiReturnsNull()
269269 It . IsAny < EventId > ( ) ,
270270 It . IsAny < It . IsAnyType > ( ) ,
271271 It . IsAny < Exception > ( ) ,
272- It . IsAny < Func < It . IsAnyType , Exception , string > > ( ) ) ,
272+ It . IsAny < Func < It . IsAnyType , Exception ? , string > > ( ) ) ,
273273 Times . Never ) ;
274274 }
275275
276276 [ Fact ]
277277 public async Task ApiClient_SetsHeadersCorrectly ( )
278278 {
279279 // Arrange
280- HttpRequestMessage capturedRequest = null ;
280+ HttpRequestMessage ? capturedRequest = null ;
281281
282282 _handlerMock . Protected ( )
283283 . Setup < Task < HttpResponseMessage > > (
@@ -305,7 +305,7 @@ public async Task ApiClient_SetsHeadersCorrectly()
305305 public async Task ApiClient_ConstructsUrlsCorrectly ( )
306306 {
307307 // Arrange
308- HttpRequestMessage capturedRequest = null ;
308+ HttpRequestMessage ? capturedRequest = null ;
309309
310310 _handlerMock . Protected ( )
311311 . Setup < Task < HttpResponseMessage > > (
@@ -332,7 +332,7 @@ public async Task ApiClient_ConstructsUrlsCorrectly()
332332 public async Task ApiClient_HandlesUriEscaping ( )
333333 {
334334 // Arrange
335- HttpRequestMessage capturedRequest = null ;
335+ HttpRequestMessage ? capturedRequest = null ;
336336
337337 _handlerMock . Protected ( )
338338 . Setup < Task < HttpResponseMessage > > (
0 commit comments