public void WithInnerHandlerInstanceShouldThrowExceptionIfOuterHandlerIsNotDelegatingHandler()
 {
     var innerHandler = new CustomMessageHandler();
     var handler = MyWebApi
         .Handler<CustomMessageHandler>()
         .WithInnerHandler(innerHandler)
         .AndProvideTheHandler() as DelegatingHandler;
 }
        public void WithInnerHandlerWithProvidedInstanceShouldPopulateCorrectInnerHandler()
        {
            var innerHandler = new CustomMessageHandler();
            var handler = MyWebApi
                .Handler<CustomDelegatingHandler>()
                .WithInnerHandler(innerHandler)
                .AndProvideTheHandler() as DelegatingHandler;

            Assert.IsNotNull(handler);
            Assert.IsNotNull(handler.InnerHandler);
            Assert.AreSame(innerHandler, handler.InnerHandler);
        }
        public void HandlerWithProvidedInstanceShouldPopulateCorrectInstanceOfHandlerType()
        {
            var instance = new CustomMessageHandler();
            var controller = MyWebApi.Handler(instance).AndProvideTheHandler();

            Assert.IsNotNull(controller);
            Assert.IsAssignableFrom<CustomMessageHandler>(controller);
        }