I'm kind of new to unit testing and I am wondering if I'm doing it correct or not.
//Controller
public ActionResult Index()
{
return View("../Message/Index");
}
[TestMethod]
public void MessageViewCorrectTest()
{
var controller = new MessageController();
var result = controller.Index() as ViewResult;
Assert.AreEqual("../Message/Index", result.ViewName);
}
[TestMethod]
public void MessageViewInCorrectTest()
{
var controller = new MessageController();
var result = controller.Index() as ViewResult;
Assert.AreNotEqual("Something/Else", result.ViewName);
}
Am I doing it right, is there a better way or is this good?
Any feedback would be appreciated, thanks in advance.
Aucun commentaire:
Enregistrer un commentaire