Exemplo n.º 1
0
        public void IndexModelNotNullIndexTest()
        {
            // Arrange
            CourseListsController controller = new CourseListsController();

            // Act
            var result = controller.Index("Alex") as ViewResult;

            // Assert
            Assert.IsNotNull(result.Model);
        }
Exemplo n.º 2
0
        public void IndexViewEqualIndexTest()
        {
            // Arrange
            CourseListsController controller = new CourseListsController();

            // Act
            var result = controller.Index(null) as ViewResult;

            // Assert
            Assert.IsInstanceOfType(result, typeof(ViewResult));
        }
Exemplo n.º 3
0
        public void CreatePageTest()
        {
            // Arrange
            CourseListsController controller = new CourseListsController();

            // Act
            var result = controller.Create() as ViewResult;

            // Assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(ViewResult));
        }
Exemplo n.º 4
0
        public void CreateTest()
        {
            // Arrange
            CourseListsController controller = new CourseListsController();
            var course = new Models.CourseList()
            {
                CourseId  = 1111,
                StudentId = 2,
                StartDate = Convert.ToDateTime("01/08/2016"),
                EndDate   = Convert.ToDateTime("10/08/2016")
            };
            // Act

            var result = controller.Create(course) as RedirectToRouteResult;

            // Assert
            Assert.AreEqual("Index", result.RouteValues["action"]);
        }