I am trying to add unit testing to a new MVC application and I am following the guide at:
http://msdn.microsoft.com/en-us/data/dn314429
The manual describes in detail what I would like to do - testing the results returned to the controller Index () action is sorted correctly, but this example is too far-fetched for my needs. In my case, my ViewModel consists of numerous domain objects, and I find it too tedious to taunt.
The request in my controller action is as follows:
var roles = _db.Roles
.OrderBy(r => r.Area.Application.Name)
.ThenBy(r => r.Area.Name)
.ThenBy(r => r.Name)
.Select(role =>
new RoleViewModel
{
RoleName = role.Name,
Description = role.Description,
ApplicationArea = role.Area.Application.Name + "/" + role.Area.Name,
GroupsUsingThisRole = role.RoleGroupMappings
.Select(rgm => rgm.Group.Name).ToList()
}).ToList();
, DBSets. , , , , , , , , .
, ? , , , , , .