Subscribe to this list via RSS Blog posts tagged in extension methods

Posted by on in Blogs
Unit Testing Html Helpers for ASP.NET MVC Html helpers for ASP.NET MVC are static extension methods, which frequently reference the ViewContext and  HttpContext. Combined, this can make unit testing a bit tricky. Let's write a new Html helper using a test-first methodology. Let's start with a prototype function:         public static MvcHtmlString MyTable(this HtmlHelper helper, MyModel model, IDictionary<string, object> htmlAttributes)         {             return MvcHtmlString.Empty;         } I've added just enough cod...
  • Page :
  • 1

Check out more tips and tricks in this development video: