mercredi 27 avril 2016

Unit Testing ViewResult in Asp.NET MVC

Even though there are couple of Posts on StackOverflow about Unit Testing Action Result in MVC, I have a specific Question ....

Here is my ActionResult in Controller:

public ActionResult Index()
{
    return View(db.Products.ToList());
}

Every Item in Products has different attributes like Name,Photo,Quantity etc.. I wrote a testmethod for this method .It looks as follows :

private CartEntity db = new CartEntity();

[TestMethod]
public void Test_Index()
{
    //Arrange
    ProductsController prodController = new ProductsController();

    ViewResult = prodController.Index();


}

What Should I compare in this case since there are no parameters are being passed into Index Action

Aucun commentaire:

Enregistrer un commentaire