Testing MVC with Ivonna -- first look

Recently I've been adding some bits to Ivonna that are supposed to make her more MVC-friendly. I fell asleep with a happy smile om my face after the following test passed:

var session = new TestSession();
var response = session.Get("/");
Assert.AreEqual("Home", response.ControllerName);

As before, we have a WebResponse class, but this one stays in the Ivonna.Framework.MVC namespace. The one that was used all along has been moved to the Ivonna.Framework.Webforms namespace, so all you need to make your old code compile is add an import. TestSession.Get() is an extension method: it has WebForms and MVC "flavours", depending on which namespace you import. This way, you don't have to learn a new syntax for a different framework. Of course, you can still use TestSession.ProcessRequest() if you need to customize your request.

What's implemented already is full information about the action method: the ControllerContext and ActionDescriptor instances, and parameter values participating in the method invocation. You can get the Route through these as well, but I plan to expose it as a property. Next step is provide the information about the ActionResult, including the IView instance, if any. So, the WebResponse instance will contain the full information about the request. Information about the child requests will be available as well.

blog comments powered by Disqus

Latest blog posts

Powered by FeedBurner

Archives