private static SuppressHostPrincipalMessageHandler CreateProductUnderTest(HttpMessageHandler innerHandler) { SuppressHostPrincipalMessageHandler handler = new SuppressHostPrincipalMessageHandler(); handler.InnerHandler = innerHandler; return(handler); }
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 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; }