Using dynamic type to test controller actions returning JsonResult

added by gpeipman
7/24/2010 7:33:05 AM


I wrote unit tests for my ASP.NET MVC application that uses some jQuery AJAX-components. These components load data from server in JSON format. I needed to write tests for these methods to make sure that correct data is returned to client. In this posting I will show you how to use dynamic type to test JSON-based action results and therefore avoid creating DTO classes.