Beispiel #1
0
 public void Setup()
 {
     mockAuthenticationProvider = new MockAuthenticationProvider();
     testHttpMessageHandler     = new MockRedirectHandler();
     authenticationHandler      = new AuthenticationHandler(mockAuthenticationProvider.Object, testHttpMessageHandler);
     invoker = new HttpMessageInvoker(authenticationHandler);
 }
Beispiel #2
0
 public AuthenticationHandlerTests()
 {
     testHttpMessageHandler     = new MockRedirectHandler();
     mockAuthenticationProvider = new MockAuthenticationProvider();
     authenticationHandler      = new AuthenticationHandler(mockAuthenticationProvider.Object, testHttpMessageHandler);
     invoker = new HttpMessageInvoker(authenticationHandler);
 }
Beispiel #3
0
 public GraphClientFactoryTests()
 {
     this.testHttpMessageHandler = new MockRedirectHandler();
     handlers[0] = new RetryHandler();
     handlers[1] = new RedirectHandler();
     handlers[2] = new AuthenticationHandler();
 }
 public void Setup()
 {
     this.testHttpMessageHandler = new MockRedirectHandler();
     handlers[0] = new RetryHandler();
     handlers[1] = new RedirectHandler();
     handlers[2] = new AuthenticationHandler(authenticationProvider.Object);
 }
Beispiel #5
0
 public void CreatePipelineWithoutPipeline()
 {
     using (MockRedirectHandler handler = (MockRedirectHandler)GraphClientFactory.CreatePipeline(null, this.testHttpMessageHandler))
     {
         Assert.NotNull(handler);
         Assert.IsType <MockRedirectHandler>(handler);
     }
 }
Beispiel #6
0
 public void CreatePipelineWithoutPipeline()
 {
     using (MockRedirectHandler handler = (MockRedirectHandler)GraphClientFactory.CreatePipeline(this.testHttpMessageHandler, null))
     {
         Assert.IsNotNull(handler, "Create a middleware pipeline failed.");
         Assert.IsInstanceOfType(handler, typeof(MockRedirectHandler), "Inner most HttpMessageHandler class error.");
     }
 }
 public GraphClientFactoryTests()
 {
     this.testHttpMessageHandler = new MockRedirectHandler();
     handlers    = new DelegatingHandler[3];
     handlers[0] = new RetryHandler();
     handlers[1] = new RedirectHandler();
     handlers[2] = new AuthenticationHandler(authenticationProvider.Object);
 }
Beispiel #8
0
 public void CreatePipelineWithHttpMessageHandlerInput()
 {
     using (RetryHandler retryHandler = (RetryHandler)GraphClientFactory.CreatePipeline(this.testHttpMessageHandler, handlers))
         using (RedirectHandler redirectHandler = (RedirectHandler)retryHandler.InnerHandler)
             using (AuthenticationHandler authenticationHandler = (AuthenticationHandler)redirectHandler.InnerHandler)
                 using (MockRedirectHandler innerMost = (MockRedirectHandler)authenticationHandler.InnerHandler)
                 {
                     Assert.NotNull(retryHandler);
                     Assert.NotNull(redirectHandler);
                     Assert.NotNull(authenticationHandler);
                     Assert.NotNull(innerMost);
                     Assert.IsType(typeof(RetryHandler), retryHandler);
                     Assert.IsType(typeof(RedirectHandler), redirectHandler);
                     Assert.IsType(typeof(AuthenticationHandler), authenticationHandler);
                     Assert.IsType(typeof(MockRedirectHandler), innerMost);
                 }
 }
 public void CreatePipelineWithHttpMessageHandlerInput()
 {
     using (RetryHandler retryHandler = (RetryHandler)GraphClientFactory.CreatePipeline(handlers, this.testHttpMessageHandler))
         using (RedirectHandler redirectHandler = (RedirectHandler)retryHandler.InnerHandler)
             using (AuthenticationHandler authenticationHandler = (AuthenticationHandler)redirectHandler.InnerHandler)
                 using (MockRedirectHandler innerMost = (MockRedirectHandler)authenticationHandler.InnerHandler)
                 {
                     Assert.IsNotNull(retryHandler, "Create a middleware pipeline failed.");
                     Assert.IsNotNull(redirectHandler, "Create a middleware pipeline failed.");
                     Assert.IsNotNull(authenticationHandler, "Create a middleware pipeline failed.");
                     Assert.IsNotNull(innerMost, "Create inner most HttpMessageHandler failed.");
                     Assert.IsInstanceOfType(retryHandler, typeof(RetryHandler), "Pass pipeline failed in first level.");
                     Assert.IsInstanceOfType(redirectHandler, typeof(RedirectHandler), "Pass pipeline failed in seconde level.");
                     Assert.IsInstanceOfType(authenticationHandler, typeof(AuthenticationHandler), "Pass pipeline failed in third level.");
                     Assert.IsInstanceOfType(innerMost, typeof(MockRedirectHandler), "Inner most HttpMessageHandler class error.");
                 }
 }
Beispiel #10
0
 public void CreatePipelineWithHttpMessageHandlerInput()
 {
     using (AuthenticationHandler authenticationHandler = (AuthenticationHandler)GraphClientFactory.CreatePipeline(handlers, this.testHttpMessageHandler))
         using (CompressionHandler compressionHandler = (CompressionHandler)authenticationHandler.InnerHandler)
             using (RetryHandler retryHandler = (RetryHandler)compressionHandler.InnerHandler)
                 using (RedirectHandler redirectHandler = (RedirectHandler)retryHandler.InnerHandler)
                     using (MockRedirectHandler innerMost = (MockRedirectHandler)redirectHandler.InnerHandler)
                     {
                         Assert.NotNull(authenticationHandler);
                         Assert.NotNull(compressionHandler);
                         Assert.NotNull(retryHandler);
                         Assert.NotNull(redirectHandler);
                         Assert.NotNull(innerMost);
                         Assert.IsType <AuthenticationHandler>(authenticationHandler);
                         Assert.IsType <CompressionHandler>(compressionHandler);
                         Assert.IsType <RetryHandler>(retryHandler);
                         Assert.IsType <RedirectHandler>(redirectHandler);
                         Assert.IsType <MockRedirectHandler>(innerMost);
                     }
 }
Beispiel #11
0
 public RetryHandlerTests()
 {
     this.testHttpMessageHandler = new MockRedirectHandler();
     this.retryHandler           = new RetryHandler(this.testHttpMessageHandler);
     this.invoker = new HttpMessageInvoker(this.retryHandler);
 }
Beispiel #12
0
 public GraphClientFactoryTests()
 {
     this.testHttpMessageHandler = new MockRedirectHandler();
     testAuthenticationProvider  = new MockAuthenticationProvider(expectedAccessToken);
     handlers = GraphClientFactory.CreateDefaultHandlers(testAuthenticationProvider.Object).ToArray();
 }
 public CompressionHandlerTests()
 {
     this.testHttpMessageHandler = new MockRedirectHandler();
     this.compressionHandler     = new CompressionHandler(this.testHttpMessageHandler);
     this.invoker = new HttpMessageInvoker(this.compressionHandler);
 }
Beispiel #14
0
 public void Setup()
 {
     this.testHttpMessageHandler = new MockRedirectHandler();
     this.redirectHandler        = new RedirectHandler(this.testHttpMessageHandler);
     this.invoker = new HttpMessageInvoker(this.redirectHandler);
 }