public void PutCourseTest()
        {
            Course updateCourseTestData;

            updateCourseTestData = CourseTestData.GetTestDataCourseUpdate();
            mockCourseRepository.Setup(m => m.Course.UpdateCourse(updateCourseTestData)).Returns(true);

            OkObjectResult content        = courseController.Put(updateCourseTestData).Result as OkObjectResult;
            HttpStatusCode httpStatusCode = (HttpStatusCode)content.StatusCode;

            var response = content.Value as ResponseModel <Course>;
            var actualUpdateSuccessMessage = response.Message;

            Assert.AreEqual(httpStatusCode, HttpStatusCode.OK);
            Assert.AreEqual(ResponseMessage.OnSuccessUpdateMessage, actualUpdateSuccessMessage);
        }
        public void GetCourseTest()
        {
            IEnumerable <Course> expectedCourses;

            expectedCourses = CourseTestData.GetExpectedCourses();
            var expectedCoursesTask = Task.FromResult(expectedCourses);

            mockCourseRepository.Setup(m => m.Course.GetAllCoursesAsync()).Returns(expectedCoursesTask);

            OkObjectResult content        = courseController.Get().Result as OkObjectResult;
            HttpStatusCode httpStatusCode = (HttpStatusCode)content.StatusCode;

            var response      = content.Value as ResponseModel <Course>;
            var actualCourses = response.DataCollection;

            Assert.AreEqual(httpStatusCode, HttpStatusCode.OK);
            Assert.AreEqual(expectedCoursesTask.Result.Count(), actualCourses.ToList().Count);
        }
        public void GetCourseTestById()
        {
            Course expectedCourse;

            expectedCourse = CourseTestData.GetExpectedCourse();

            var expectedCourseTask = Task.FromResult(expectedCourse);

            mockCourseRepository.Setup(m => m.Course.GetCourseByIdAsync(expectedCourse.Id)).Returns(expectedCourseTask);

            OkObjectResult content        = courseController.Get(expectedCourse.Id).Result as OkObjectResult;
            HttpStatusCode httpStatusCode = (HttpStatusCode)content.StatusCode;

            var response     = content.Value as ResponseModel <Course>;
            var actualCourse = response.DataObject;

            Assert.AreEqual(httpStatusCode, HttpStatusCode.OK);
            Assert.AreEqual(expectedCourseTask.Result.Id, actualCourse.Id);
        }
        public void DeleteCourseTest()
        {
            Course deleteCourseTestData;

            deleteCourseTestData = CourseTestData.GetTestDataCourseDelete();

            var expectedCourse = Task.FromResult(deleteCourseTestData);

            mockCourseRepository.Setup(m => m.Course.GetCourseByIdAsync(deleteCourseTestData.Id)).Returns(expectedCourse);
            mockCourseRepository.Setup(m => m.Course.DeleteCourse(deleteCourseTestData)).Returns(true);

            OkObjectResult content        = courseController.Delete(deleteCourseTestData.Id).Result as OkObjectResult;
            HttpStatusCode httpStatusCode = (HttpStatusCode)content.StatusCode;

            var response = content.Value as ResponseModel <Course>;
            var actualDeleteSuccessMessage = response.Message;

            Assert.AreEqual(httpStatusCode, HttpStatusCode.OK);
            Assert.AreEqual(ResponseMessage.OnSuccessDeleteMessage, actualDeleteSuccessMessage);
        }