Skip to content

Instantly share code, notes, and snippets.

@deap82
Last active November 7, 2015 16:00
Show Gist options
  • Select an option

  • Save deap82/11279e2903fb7c7d3b5d to your computer and use it in GitHub Desktop.

Select an option

Save deap82/11279e2903fb7c7d3b5d to your computer and use it in GitHub Desktop.
Testing Controller actions that calls Url.Action with SpecsFor
//Twitter conversation: https://twitter.com/Deap82/status/660723939602247680
//I got it working by using this in Given, but it seemed strange to me that
//FakeUrlHelper would not be part of it...
protected override void Given()
{
base.Given();
this.UseFakeContextForController();
SUT.Url = new UrlHelper(SUT.ControllerContext.RequestContext);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment