public void Grades_Controller_Test_On_Index() { //Arrange var repo = Substitute.For <IRepository>(); ICollection <Grade> expectedGrades = new[] { new Grade() }; repo.GetAll <Grade>().Returns(expectedGrades); var sut = new GradesController(repo); //Act var actual = sut.Index().Result as ViewResult; //Assert Assert.IsInstanceOfType(actual, typeof(ViewResult)); var viewResult = actual; Assert.AreEqual(expectedGrades, viewResult.Model); }
public void SetupContext() { controller = new GradesController(); result = controller.Index() as ViewResult; }
public void IndexReturnsView() { ViewResult result = controller.Index() as ViewResult; Assert.AreEqual("Index", result.ViewName); }