public void CourseHometasks_ReturnsViewResult_WithListOfHometasks()
        {
            // Arrange
            int    courseId   = 1;
            string courseName = "testCouse";
            int    hometaskId = 2;

            var courseSericeMock = Substitute.For <CourseService>();

            courseSericeMock.GetCourse(courseId).Returns(
                new Course()
            {
                Id   = courseId,
                Name = courseName
            });

            var hometaskSericeMock = Substitute.For <HometaskService>();

            hometaskSericeMock.GetAllHomeTasks().Returns(new List <HomeTask>());
            hometaskSericeMock.GetHomeTask(hometaskId).Returns(new HomeTask());

            var controller = new HometaskController(hometaskSericeMock, courseSericeMock);

            //Act
            var result = controller.CourseHometasks(courseId);

            // Assert
            var viewResult = Assert.IsType <ViewResult>(result);

            Assert.Equal(courseId, (int)viewResult.ViewData["courseId"]);
            Assert.Equal(courseName, viewResult.ViewData["courseName"]);
            var model = Assert.IsAssignableFrom <IEnumerable <HomeTask> >(viewResult.Model);
        }
        public void Create_Get_ReturnsNotFound_WhenNonExistingCourseId()
        {
            // Arrange
            int nonExistingcourseId = 42;

            var courseSericeMock = Substitute.For <CourseService>();

            courseSericeMock.GetCourse(nonExistingcourseId).Returns(default(Course));

            var controller = new HometaskController(null, courseSericeMock);

            //Act
            var result = controller.CourseHometasks(nonExistingcourseId);

            // Assert
            var viewResult = Assert.IsType <NotFoundResult>(result);
        }