Vote UpVote

Unit Testing Html Helpers for ASP.NET MVC

Craig Stuntz's Weblog – 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 code here to get the prototype to compile. Now let’s write some unit tests. First we ...
Favorite? Off-Topic? Craig Stuntz @ 2010-09-10 17:23


Visits: 224
Votes: 0
Favorites: 0
Off-Topic: 1

Visits by Source

User Actions

Users who voted for this posting

Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News


Please login or register to use this functionality.
(click on this box to dismiss)