Could somebody show me how you would go about creating a mock HTML Helper with Moq?
This article has a link to an article claiming to describe this, but following the li
Here's another article that shows you how to achieve the same thing:
public static HtmlHelper CreateHtmlHelper(ViewDataDictionary vd) { var mockViewContext = new Mock
( new ControllerContext( new Mock ().Object, new RouteData(), new Mock ().Object), new Mock ().Object, vd, new TempDataDictionary()); var mockViewDataContainer = new Mock (); mockViewDataContainer.Setup(v => v.ViewData).Returns(vd); return new HtmlHelper(mockViewContext.Object, mockViewDataContainer.Object); }