public void ExceptionHandlerGet_IfUnset_UsesExceptionHandlerFromConfiguration() { // Arrange using (HttpConfiguration configuration = CreateConfiguration()) { IExceptionHandler expectedExceptionHandler = CreateDummyExceptionHandler(); configuration.Services.Replace(typeof(IExceptionHandler), expectedExceptionHandler); using (HttpControllerDispatcher product = CreateProductUnderTest(configuration)) { // Act IExceptionHandler exceptionHandler = product.ExceptionHandler; // Assert LastChanceExceptionHandler lastChanceHandler = Assert.IsType <LastChanceExceptionHandler>(exceptionHandler); Assert.Same(expectedExceptionHandler, lastChanceHandler.InnerHandler); } } }
public void ExceptionHandlerGet_IfUnset_UsesExceptionHandlerFromConfiguration() { // Arrange using (HttpConfiguration configuration = CreateConfiguration()) { IExceptionHandler expectedExceptionHandler = CreateDummyExceptionHandler(); configuration.Services.Replace(typeof(IExceptionHandler), expectedExceptionHandler); using (HttpMessageHandler dispatcher = CreateDummyMessageHandler()) using (HttpServer product = new HttpServer(configuration, dispatcher)) { // Act IExceptionHandler exceptionHandler = product.ExceptionHandler; // Assert Assert.IsType <LastChanceExceptionHandler>(exceptionHandler); LastChanceExceptionHandler lastChanceHandler = (LastChanceExceptionHandler)exceptionHandler; Assert.Same(expectedExceptionHandler, lastChanceHandler.InnerHandler); } } }