Jan 23, 2015 at 2:15 PM

I have a cshtml file with a call to @Html.RouteLink passing as a second parameter the name of the route.

I'm having an exception in my test because the route name cannot be found in the route collection. I'm trying to set the route collection in the view using:
var mockViewContext = new Mock<ViewContext>();
            var mockViewDataContainer = new Mock<IViewDataContainer>();
            mockViewDataContainer.Setup(vdc => vdc.ViewData).Returns(new ViewDataDictionary());

            var routeCollection = new RouteCollection();

            var details = new Details();
            details.Html = new HtmlHelper<VacancyDetailViewModel>(mockViewContext.Object, mockViewDataContainer.Object, routeCollection);
But it doesn't works.

How can I deal with this problem?

Thank you very much,
Jan 23, 2015 at 4:54 PM

I have a pull request prepared to solve this problem. Please, can you tell me how can I do it?

Jan 23, 2015 at 5:39 PM

I've sent you the pull request. Well, actually I've sent you two pull request. I added a unit test in the second one.

Thank you very much!
Jan 27, 2015 at 10:37 PM
Your change is in, thanks.
Jan 28, 2015 at 8:16 AM
Thank you David!