Exemplo n.º 1
0
        public ActionResult AssignCourse()
        {
            var model = new ListAssignmentViewModel
            {
                Courses = this.assignmentService.GetAllCourses()
            };

            return(this.View(model));
        }
Exemplo n.º 2
0
        public ActionResult ListAssignments()
        {
            var model = new ListAssignmentViewModel
            {
                Assignments = assignmentService.GetAllAssignments()
            };

            return(this.View(model));
        }
Exemplo n.º 3
0
        public void ReturnDefaultViewWithCorrectModel()
        {
            // Arange
            var assignmentServiceMock      = new Mock <IAssignmentService>();
            var storeMock                  = new Mock <IUserStore <ApplicationUser> >();
            var applicationUserManagerMock = new Mock <ApplicationUserManager>(storeMock.Object);

            var courses = new List <Course>();

            assignmentServiceMock.Setup(m => m.GetAllCourses()).Returns(courses);

            var expectedModel = new ListAssignmentViewModel()
            {
                Courses = courses
            };

            var controller = new AssignmentController(assignmentServiceMock.Object, applicationUserManagerMock.Object);

            // Act & Assert
            controller
            .WithCallTo(c => c.AssignCourse())
            .ShouldRenderDefaultView()
            .WithModel <ListAssignmentViewModel>(m => Assert.AreSame(expectedModel.Courses, m.Courses));
        }