@@ -25,7 +25,7 @@ public class GraphClientFactoryTests : IDisposable
2525 public GraphClientFactoryTests ( )
2626 {
2727 this . testHttpMessageHandler = new MockRedirectHandler ( ) ;
28- handlers = handlers = new DelegatingHandler [ 3 ] ;
28+ handlers = new DelegatingHandler [ 3 ] ;
2929 handlers [ 0 ] = new RetryHandler ( ) ;
3030 handlers [ 1 ] = new RedirectHandler ( ) ;
3131 handlers [ 2 ] = new AuthenticationHandler ( authenticationProvider . Object ) ;
@@ -37,24 +37,27 @@ public void Dispose()
3737 this . testHttpMessageHandler . Dispose ( ) ;
3838 }
3939
40+ // Note:
41+ // 1. Xunit's IsType doesn't consider inheritance behind the classes.
42+ // 2. We can't control the order of execution for the tests
43+ // and 'GraphClientFactory.DefaultHttpHandler' can easily be modified
44+ // by other tests since it's a static delegate.
4045 [ Fact ]
4146 public void CreatePipelineWithoutHttpMessageHandlerInput ( )
4247 {
4348 using ( RetryHandler retryHandler = ( RetryHandler ) GraphClientFactory . CreatePipeline ( handlers ) )
4449 using ( RedirectHandler redirectHandler = ( RedirectHandler ) retryHandler . InnerHandler )
4550 using ( AuthenticationHandler authenticationHandler = ( AuthenticationHandler ) redirectHandler . InnerHandler )
46- using ( HttpClientHandler innerMost = ( HttpClientHandler ) authenticationHandler . InnerHandler )
51+ using ( HttpMessageHandler innerMost = authenticationHandler . InnerHandler )
4752 {
48- System . Diagnostics . Debug . WriteLine ( "InvalidCast: " + authenticationHandler . InnerHandler . GetType ( ) . ToString ( ) ) ;
49-
5053 Assert . NotNull ( retryHandler ) ;
5154 Assert . NotNull ( redirectHandler ) ;
5255 Assert . NotNull ( authenticationHandler ) ;
5356 Assert . NotNull ( innerMost ) ;
5457 Assert . IsType ( typeof ( RetryHandler ) , retryHandler ) ;
5558 Assert . IsType ( typeof ( RedirectHandler ) , redirectHandler ) ;
5659 Assert . IsType ( typeof ( AuthenticationHandler ) , authenticationHandler ) ;
57- Assert . IsType ( typeof ( HttpClientHandler ) , innerMost ) ;
60+ Assert . True ( innerMost is HttpMessageHandler ) ;
5861 }
5962
6063 }
0 commit comments