private static SuppressHostPrincipalMessageHandler CreateProductUnderTest(HttpMessageHandler innerHandler)
        {
            SuppressHostPrincipalMessageHandler handler = new SuppressHostPrincipalMessageHandler();

            handler.InnerHandler = innerHandler;
            return(handler);
        }
コード例 #2
0
        public void ConstructorWithPrincipalService_SetsPrincipalService()
        {
            // Arrange
            IHostPrincipalService expectedPrincipalService = CreateDummyPrincipalService();
            SuppressHostPrincipalMessageHandler handler    = new SuppressHostPrincipalMessageHandler(
                expectedPrincipalService);

            // Act
            IHostPrincipalService principalService = handler.HostPrincipalService;

            // Assert
            Assert.Same(expectedPrincipalService, principalService);
        }
        public void ConstructorWithPrincipalService_SetsPrincipalService()
        {
            // Arrange
            IHostPrincipalService expectedPrincipalService = CreateDummyPrincipalService();
            SuppressHostPrincipalMessageHandler handler = new SuppressHostPrincipalMessageHandler(
                expectedPrincipalService);

            // Act
            IHostPrincipalService principalService = handler.HostPrincipalService;

            // Assert
            Assert.Same(expectedPrincipalService, principalService);
        }
コード例 #4
0
        public void ConstructorWithConfiguration_SetsPrincipalService()
        {
            // Arrange
            IHostPrincipalService expectedPrincipalService = CreateDummyPrincipalService();

            IHostPrincipalService principalService;

            using (HttpConfiguration configuration = new HttpConfiguration())
            {
                configuration.Services.Replace(typeof(IHostPrincipalService), expectedPrincipalService);
                SuppressHostPrincipalMessageHandler handler = new SuppressHostPrincipalMessageHandler(configuration);

                // Act
                principalService = handler.HostPrincipalService;
            }

            // Assert
            Assert.Same(expectedPrincipalService, principalService);
        }
        public void ConstructorWithConfiguration_SetsPrincipalService()
        {
            // Arrange
            IHostPrincipalService expectedPrincipalService = CreateDummyPrincipalService();

            IHostPrincipalService principalService;

            using (HttpConfiguration configuration = new HttpConfiguration())
            {
                configuration.Services.Replace(typeof(IHostPrincipalService), expectedPrincipalService);
                SuppressHostPrincipalMessageHandler handler = new SuppressHostPrincipalMessageHandler(configuration);

                // Act
                principalService = handler.HostPrincipalService;
            }

            // Assert
            Assert.Same(expectedPrincipalService, principalService);
        }
 private static SuppressHostPrincipalMessageHandler CreateProductUnderTest(
     IHostPrincipalService principalService, HttpMessageHandler innerHandler)
 {
     SuppressHostPrincipalMessageHandler handler = new SuppressHostPrincipalMessageHandler(principalService);
     handler.InnerHandler = innerHandler;
     return handler;
 }