Created
August 5, 2009 15:25
-
-
Save stevenharman/162758 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
/// <summary> | |
/// Bypasses IIS7 custom Errors. | |
/// </summary> | |
public class TrySkipIisCustomErrors : FilterAttribute, IActionFilter | |
{ | |
public void OnActionExecuting(ActionExecutingContext filterContext) | |
{ | |
filterContext.HttpContext.Response.TrySkipIisCustomErrors = true; | |
} | |
public void OnActionExecuted(ActionExecutedContext filterContext) { } | |
} | |
public class when_communicating_raw_errors_to_a_client : concerns<TrySkipIisCustomErrors> | |
{ | |
private ActionExecutingContext _filterContext; | |
private HttpResponseBase _response; | |
protected override void context() | |
{ | |
var handler = new TrySkipIisCustomErrors(); | |
var httpContext = fake<HttpContextBase>(); | |
_response = stub<HttpResponseBase>(); | |
httpContext | |
.Stub(c => c.Response) | |
.Return(_response); | |
_filterContext = new ActionExecutingContext {HttpContext = httpContext}; | |
handler.OnActionExecuting(_filterContext); | |
} | |
[Specification] | |
public void skip_iis7_custom_errors() | |
{ | |
_response.TrySkipIisCustomErrors.should_be_true(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment