public void CourseController_Should_Contain_Index_Method_Which_Takes_No_Argument() { CourseController c = new CourseController(); ActionResult result = c.Index(); Assert.IsNotNull(result, "Expected courses"); }
public void CourseController_Should_return_Courses() { var c = new CourseController(); var result = c.Index() as ViewResult; Assert.IsNotNull(result); var viewData = result.ViewData; var courses = result.ViewData.Model as IEnumerable<Course>; Assert.AreEqual("Course management", viewData["Title"], "Expected different title"); Assert.AreEqual("Create - Edit - Delete Courses", viewData["Message"], "Expected different message"); Assert.IsNotNull(courses, "Expected sequence of courses"); Assert.AreEqual(40, courses.Count(), "Expected 26 courses"); }