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);
        }
예제 #2
0
 public void SetupContext()
 {
     controller = new GradesController();
     result     = controller.Index() as ViewResult;
 }
예제 #3
0
        public void IndexReturnsView()
        {
            ViewResult result = controller.Index() as ViewResult;

            Assert.AreEqual("Index", result.ViewName);
        }