Created
July 5, 2014 13:51
-
-
Save AlexArchive/8fbbb425bc60f582780e 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
public static void SetFakeControllerContext(this Controller controller, NameValueCollection querystring = null) | |
{ | |
var context = new Mock<HttpContextBase>(); | |
context.Setup(c => c.Request.QueryString).Returns(querystring ?? new NameValueCollection()); | |
controller.ControllerContext = new ControllerContext(context.Object, new RouteData(), | |
new Mock<ControllerBase>().Object); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment