[TestMethod]
public void Index1()
{
MovieDBContext db = new MovieDBContext();
//Arrange
MoviesController mv = new MoviesController();
//Act
ViewResult result = mv.Index() as ViewResult;
//Assert
Assert.AreEqual(result.ViewName, "Index");
}
//Controller Method is and db object create in the same controller as method (Index) exists
公共行动结果索引(){
return View(db.Movies.ToList());
}
//Error come as 初始化数据库时发生异常。有关详细信息,请参阅 InnerException。