I am knee deep in starting a new ASP.NET MVC project. Several tutorials have recommended the use of MVC Contrib. I wanted to get the opinion of the Stack Overflow community if it fulfilled its promise of increasing productivity with ASP.NET MVC. Basically are the benefits of MVC Contrib worth adding another leaky abstraction to my application?
I think MVC Contrib is invaluable when it comes to testing. They provide a lot of extension methods that allow you to fluently test routing and action results. For example:
"~/Administration/Users/Modify/testuser" .ShouldMapTo(a => a.Modify("testuser"));
...for routing, and for action results:
Controller.List() .AssertViewRendered() .WithViewData>() .Count .ShouldEqual(4, "Should be 4 users returned");
Also MVC Contrib provides a helpful TestControllerBuilder class which can build up a controller and take care of faking all the necessary HTTP context type of things. This doesn't seem like much but paired with DI, writing it yourself if a pain.
Builder = new TestControllerBuilder(); Builder.CreateController<CT>();
Moving on from testing, the controller factories for DI/IoC are really useful so you don't have to write it yourself, but not essential IMHO.
The other thing I like about MVC Contrib are the fluent HTML helpers. I think it is much nicer to set HTML properties and other data using these kind of fluent helpers -- here's are two examples:
<%= this.TextBox("name").Label("Activity Category Name: ").MaxLength(50).Class("required")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With