Exemple #1
0
        public void Handle_WhenExceptionIsThrownHandlingRequest_PactFailureExceptionIsThrown()
        {
            var compareException = new PactFailureException("Something\r\n \t \\ failed");

            var nancyContext = new NancyContext
            {
                Request = new Request("GET", "/Test", "HTTP")
            };

            var handler = GetSubject();

            _mockRequestMapper
            .When(x => x.Convert(Arg.Any <Request>()))
            .Do(x => { throw compareException; });

            _mockResponseMapper.Convert(Arg.Any <ProviderServiceResponse>())
            .Returns(new Response
            {
                StatusCode = HttpStatusCode.InternalServerError
            });

            Assert.Throws <PactFailureException>(() => handler.Handle(nancyContext));
        }