Пример #1
0
        public void CourseListActionReturnstCourseList()
        {
            string expected   = "CourseList";
            var    controller = new CourseController();

            var result = controller.CourseList() as ViewResult;

            Assert.AreEqual(expected, result.ViewName);
        }
Пример #2
0
        public void TestCourseList()
        {
            // var roleStore = new RoleStore<IdentityRole>(db);
            // var roleManager = new RoleManager<IdentityRole>(roleStore,null,null,null,null);
            var controller = new CourseController(db, null);
            var result     = controller.CourseList();

            // // var result = await controller.Index();

            var viewResult = Assert.IsType <ViewResult>(result);
            var model      = Assert.IsAssignableFrom <List <CourseModel> >(viewResult.ViewData.Model);
            var model2     = Assert.IsType <List <CourseModel> >(viewResult.ViewData.Model);

            Assert.Equal("cmpt", model2[0].Department);
        }