Пример #1
0
        public void Should_CreatePipeline_Without_CompressionHandler()
        {
            using (AuthenticationHandler authenticationHandler = (AuthenticationHandler)GraphClientFactory.CreatePipeline(handlers))
                using (RetryHandler retryHandler = (RetryHandler)authenticationHandler.InnerHandler)
                    using (RedirectHandler redirectHandler = (RedirectHandler)retryHandler.InnerHandler)
#if iOS
                        using (NSUrlSessionHandler innerMost = (NSUrlSessionHandler)redirectHandler.InnerHandler)
#elif macOS
                        using (Foundation.NSUrlSessionHandler innerMost = (Foundation.NSUrlSessionHandler)redirectHandler.InnerHandler)
#endif
                        {
                            Assert.NotNull(authenticationHandler);
                            Assert.NotNull(retryHandler);
                            Assert.NotNull(redirectHandler);
                            Assert.NotNull(innerMost);
                            Assert.IsType <AuthenticationHandler>(authenticationHandler);
                            Assert.IsType <RetryHandler>(retryHandler);
                            Assert.IsType <RedirectHandler>(redirectHandler);
#if iOS
                            Assert.IsType <NSUrlSessionHandler>(innerMost);
#elif macOS
                            Assert.IsType <Foundation.NSUrlSessionHandler>(innerMost);
#endif
                        }
        }
Пример #2
0
        public void HttpProvider_CustomNSUrlSessionHandler()
        {
#if iOS
            using (var httpClientHandler = new NSUrlSessionHandler())
#elif macOS
            using (var httpClientHandler = new Foundation.NSUrlSessionHandler())
#endif
                using (var httpProvider = new HttpProvider(httpClientHandler, false, null))
                {
                    Assert.Equal(httpClientHandler, httpProvider.httpMessageHandler);
                    Assert.True(httpProvider.httpClient.DefaultRequestHeaders.Contains(CoreConstants.Headers.FeatureFlag));
                    Assert.False(httpProvider.disposeHandler);
                }
        }