@@ -364,9 +364,9 @@ public async Task SendReturnsObjectOnContent(HttpStatusCode statusCode)
364
364
var mockParseNode = new Mock < IParseNode > ( ) ;
365
365
mockParseNode . Setup < IParsable > ( x => x . GetObjectValue ( It . IsAny < ParsableFactory < MockEntity > > ( ) ) )
366
366
. Returns ( new MockEntity ( ) ) ;
367
- var mockParseNodeFactory = new Mock < IParseNodeFactory > ( ) ;
368
- mockParseNodeFactory . Setup < IParseNode > ( x => x . GetRootParseNode ( It . IsAny < string > ( ) , It . IsAny < Stream > ( ) ) )
369
- . Returns ( mockParseNode . Object ) ;
367
+ var mockParseNodeFactory = new Mock < IAsyncParseNodeFactory > ( ) ;
368
+ mockParseNodeFactory . Setup ( x => x . GetRootParseNodeAsync ( It . IsAny < string > ( ) , It . IsAny < Stream > ( ) , It . IsAny < CancellationToken > ( ) ) )
369
+ . Returns ( Task . FromResult ( mockParseNode . Object ) ) ;
370
370
var adapter = new HttpClientRequestAdapter ( _authenticationProvider , httpClient : client , parseNodeFactory : mockParseNodeFactory . Object ) ;
371
371
var requestInfo = new RequestInformation
372
372
{
@@ -393,7 +393,7 @@ public async Task RetriesOnCAEResponse()
393
393
StatusCode = methodCalled ? HttpStatusCode . OK : HttpStatusCode . Unauthorized ,
394
394
Content = new StreamContent ( new MemoryStream ( Encoding . UTF8 . GetBytes ( "Test" ) ) )
395
395
} ;
396
- if ( ! methodCalled )
396
+ if ( ! methodCalled )
397
397
response . Headers . WwwAuthenticate . Add ( new ( "Bearer" , "realm=\" \" , authorization_uri=\" https://login.microsoftonline.com/common/oauth2/authorize\" , client_id=\" 00000003-0000-0000-c000-000000000000\" , error=\" insufficient_claims\" , claims=\" eyJhY2Nlc3NfdG9rZW4iOnsibmJmIjp7ImVzc2VudGlhbCI6dHJ1ZSwgInZhbHVlIjoiMTY1MjgxMzUwOCJ9fX0=\" " ) ) ;
398
398
methodCalled = true ;
399
399
return Task . FromResult ( response ) ;
@@ -440,7 +440,7 @@ public async Task SetsTheApiExceptionStatusCode(HttpStatusCode statusCode)
440
440
var response = await adapter . SendPrimitiveAsync < Stream > ( requestInfo ) ;
441
441
Assert . Fail ( "Expected an ApiException to be thrown" ) ;
442
442
}
443
- catch ( ApiException e )
443
+ catch ( ApiException e )
444
444
{
445
445
Assert . Equal ( ( int ) statusCode , e . ResponseStatusCode ) ;
446
446
Assert . True ( e . ResponseHeaders . ContainsKey ( "request-id" ) ) ;
@@ -467,9 +467,9 @@ public async Task SelectsTheXXXErrorMappingClassCorrectly(HttpStatusCode statusC
467
467
var mockParseNode = new Mock < IParseNode > ( ) ;
468
468
mockParseNode . Setup < IParsable > ( x => x . GetObjectValue ( It . IsAny < ParsableFactory < IParsable > > ( ) ) )
469
469
. Returns ( new MockError ( "A general error occured" ) ) ;
470
- var mockParseNodeFactory = new Mock < IParseNodeFactory > ( ) ;
471
- mockParseNodeFactory . Setup < IParseNode > ( x => x . GetRootParseNode ( It . IsAny < string > ( ) , It . IsAny < Stream > ( ) ) )
472
- . Returns ( mockParseNode . Object ) ;
470
+ var mockParseNodeFactory = new Mock < IAsyncParseNodeFactory > ( ) ;
471
+ mockParseNodeFactory . Setup ( x => x . GetRootParseNodeAsync ( It . IsAny < string > ( ) , It . IsAny < Stream > ( ) , It . IsAny < CancellationToken > ( ) ) )
472
+ . Returns ( Task . FromResult ( mockParseNode . Object ) ) ;
473
473
var adapter = new HttpClientRequestAdapter ( _authenticationProvider , mockParseNodeFactory . Object , httpClient : client ) ;
474
474
var requestInfo = new RequestInformation
475
475
{
@@ -485,7 +485,7 @@ public async Task SelectsTheXXXErrorMappingClassCorrectly(HttpStatusCode statusC
485
485
var response = await adapter . SendPrimitiveAsync < Stream > ( requestInfo , errorMapping ) ;
486
486
Assert . Fail ( "Expected an ApiException to be thrown" ) ;
487
487
}
488
- catch ( MockError mockError )
488
+ catch ( MockError mockError )
489
489
{
490
490
Assert . Equal ( ( int ) statusCode , mockError . ResponseStatusCode ) ;
491
491
Assert . Equal ( "A general error occured" , mockError . Message ) ;
@@ -511,9 +511,9 @@ public async Task ThrowsApiExceptionOnMissingMapping(HttpStatusCode statusCode)
511
511
var mockParseNode = new Mock < IParseNode > ( ) ;
512
512
mockParseNode . Setup < IParsable > ( x => x . GetObjectValue ( It . IsAny < ParsableFactory < IParsable > > ( ) ) )
513
513
. Returns ( new MockError ( "A general error occured: " + statusCode . ToString ( ) ) ) ;
514
- var mockParseNodeFactory = new Mock < IParseNodeFactory > ( ) ;
515
- mockParseNodeFactory . Setup < IParseNode > ( x => x . GetRootParseNode ( It . IsAny < string > ( ) , It . IsAny < Stream > ( ) ) )
516
- . Returns ( mockParseNode . Object ) ;
514
+ var mockParseNodeFactory = new Mock < IAsyncParseNodeFactory > ( ) ;
515
+ mockParseNodeFactory . Setup ( x => x . GetRootParseNodeAsync ( It . IsAny < string > ( ) , It . IsAny < Stream > ( ) , It . IsAny < CancellationToken > ( ) ) )
516
+ . Returns ( Task . FromResult ( mockParseNode . Object ) ) ;
517
517
var adapter = new HttpClientRequestAdapter ( _authenticationProvider , mockParseNodeFactory . Object , httpClient : client ) ;
518
518
var requestInfo = new RequestInformation
519
519
{
@@ -529,7 +529,7 @@ public async Task ThrowsApiExceptionOnMissingMapping(HttpStatusCode statusCode)
529
529
var response = await adapter . SendPrimitiveAsync < Stream > ( requestInfo , errorMapping ) ;
530
530
Assert . Fail ( "Expected an ApiException to be thrown" ) ;
531
531
}
532
- catch ( ApiException apiException )
532
+ catch ( ApiException apiException )
533
533
{
534
534
Assert . Equal ( ( int ) statusCode , apiException . ResponseStatusCode ) ;
535
535
Assert . Contains ( "The server returned an unexpected status code and no error factory is registered for this code" , apiException . Message ) ;
0 commit comments