Permalink
Browse files

Merge pull request #756 from andreichuk/OnErrorHook

Implemented. Issue #688
  • Loading branch information...
2 parents c8be5d4 + 0e19b3d commit 9a52cd6769445d240488babe506e9d027bf8cd2a @thecodejunkie thecodejunkie committed Oct 4, 2012
@@ -1,7 +1,7 @@
namespace Nancy.Tests.Fakes
{
using Nancy.Routing;
- using ResolveResult = System.Tuple<Routing.Route, DynamicDictionary, System.Func<NancyContext, Response>, System.Action<NancyContext>>;
+ using ResolveResult = System.Tuple<Routing.Route, DynamicDictionary, System.Func<NancyContext, Response>, System.Action<NancyContext>, System.Func<NancyContext, System.Exception, Response>>;
public class FakeRouteResolver : IRouteResolver
{
@@ -11,7 +11,7 @@ public class FakeRouteResolver : IRouteResolver
ResolveResult IRouteResolver.Resolve(NancyContext context)
{
- return new ResolveResult(new FakeRoute(), new DynamicDictionary(), null, null);
+ return new ResolveResult(new FakeRoute(), new DynamicDictionary(), null, null, null);
}
}
}
@@ -9,7 +9,7 @@ namespace Nancy.Tests.Unit
using Nancy.Routing;
using Nancy.Tests.Fakes;
using Xunit;
- using ResolveResult = System.Tuple<Nancy.Routing.Route, DynamicDictionary, System.Func<NancyContext, Response>, System.Action<NancyContext>>;
+ using ResolveResult = System.Tuple<Nancy.Routing.Route, DynamicDictionary, System.Func<NancyContext, Response>, System.Action<NancyContext>, System.Func<NancyContext, System.Exception, Response>>;
public class NancyEngineFixture
{
@@ -39,7 +39,7 @@ public NancyEngineFixture()
contextFactory = A.Fake<INancyContextFactory>();
A.CallTo(() => contextFactory.Create()).Returns(context);
- A.CallTo(() => resolver.Resolve(A<NancyContext>.Ignored)).Returns(new ResolveResult(route, DynamicDictionary.Empty, null, null));
+ A.CallTo(() => resolver.Resolve(A<NancyContext>.Ignored)).Returns(new ResolveResult(route, DynamicDictionary.Empty, null, null, null));
var applicationPipelines = new Pipelines();
@@ -328,6 +328,7 @@ public void Should_set_status_code_to_500_if_route_throws()
new FakeRoute(),
DynamicDictionary.Empty,
null,
+ null,
null);
A.CallTo(() => resolver.Resolve(A<NancyContext>.Ignored)).Returns(resolvedRoute);
@@ -351,6 +352,7 @@ public void Should_store_exception_details_if_dispatcher_throws()
new FakeRoute(),
DynamicDictionary.Empty,
null,
+ null,
null);
A.CallTo(() => resolver.Resolve(A<NancyContext>.Ignored)).Returns(resolvedRoute);
@@ -379,6 +381,7 @@ public void Should_invoke_the_error_request_hook_if_one_exists_when_dispatcher_t
errorRoute,
DynamicDictionary.Empty,
null,
+ null,
null);
A.CallTo(() => resolver.Resolve(A<NancyContext>.Ignored)).Returns(resolvedRoute);
@@ -420,7 +423,7 @@ public void Should_add_unhandled_exception_to_context_as_requestexecutionexcepti
new Route("GET", "/", null, x => { throw new Exception(); });
var resolved =
- new ResolveResult(routeUnderTest, DynamicDictionary.Empty, null, null);
+ new ResolveResult(routeUnderTest, DynamicDictionary.Empty, null, null, null);
A.CallTo(() => resolver.Resolve(A<NancyContext>.Ignored)).Returns(resolved);
@@ -455,6 +458,7 @@ public void Should_persist_original_exception_in_requestexecutionexception()
new FakeRoute(),
DynamicDictionary.Empty,
null,
+ null,
null);
A.CallTo(() => resolver.Resolve(A<NancyContext>.Ignored)).Returns(resolvedRoute);
@@ -483,6 +487,7 @@ public void Should_add_requestexecutionexception_to_context_when_pipeline_is_nul
new FakeRoute(),
DynamicDictionary.Empty,
null,
+ null,
null);
A.CallTo(() => resolver.Resolve(A<NancyContext>.Ignored)).Returns(resolvedRoute);
@@ -512,6 +517,7 @@ public void Should_persist_original_exception_in_requestexecutionexception_when_
new FakeRoute(),
DynamicDictionary.Empty,
null,
+ null,
null);
A.CallTo(() => resolver.Resolve(A<NancyContext>.Ignored)).Returns(resolvedRoute);
Oops, something went wrong.

0 comments on commit 9a52cd6

Please sign in to comment.