Created
May 3, 2012 20:11
-
-
Save skinny/2588933 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fact] | |
public void Should_return_unauthorized_response_for_route_based_authentication() | |
{ | |
var module = new FakeHookedModule(new BeforePipeline()); | |
module.Get["/public"] = _ => | |
{ | |
return HttpStatusCode.OK; | |
}; | |
module.Get["/secure"] = _ => | |
{ | |
module.RequiresAuthenticationForAction(); | |
return HttpStatusCode.OK; | |
}; | |
var getContext = new NancyContext { Request = new Request("GET", "/public", "http") }; | |
var result = module.Before.Invoke(getContext); | |
result.ShouldBeNull(); | |
getContext = new NancyContext { Request = new Request("GET", "/secure", "http") }; | |
result = module.Before.Invoke(getContext); | |
result.ShouldNotBeNull(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment