public void GetTaskInCourse()
        {
            var token  = InstanceFactory.AuthorizedUserId();
            var course = InstanceFactory.Course();

            course = _courseService.Create(course, token);

            var courseTask  = InstanceFactory.CourseTask(token, course.Id);
            var createdTask = _courseTaskService.Create(courseTask, token);
            var taskInList  = _courseTaskService.GetTaskInCourse(course.Id, token);

            Assert.AreEqual(1, taskInList.Count(t => t.Id == createdTask.Id));
        }
        public void CreateTask()
        {
            var token  = InstanceFactory.AuthorizedUserId();
            var course = InstanceFactory.Course();

            course = _courseService.Create(course, token);

            var courseTask  = InstanceFactory.CourseTask(token, course.Id);
            var createdTask = _courseTaskService.Create(courseTask, token);

            Assert.IsNotNull(createdTask);
            Assert.AreEqual(token, createdTask.AuthorId);
            Assert.AreEqual(course.Id, createdTask.CourseId);
        }
        public void DeleteTask()
        {
            var token  = InstanceFactory.AuthorizedUserId();
            var course = InstanceFactory.Course();

            course = _courseService.Create(course, token);

            var courseTask  = InstanceFactory.CourseTask(token, course.Id);
            var createdTask = _courseTaskService.Create(courseTask, token);

            _courseTaskService.Delete(createdTask.Id, token);
            var taskInList = _courseTaskService.Get(createdTask.Id, token);

            Assert.IsNull(taskInList);
        }
Example #4
0
        public void CreateSolution()
        {
            var token  = InstanceFactory.AuthorizedUserId();
            var course = InstanceFactory.Course();

            course = _courseService.Create(course, token);
            var courseTask = InstanceFactory.CourseTask(token, course.Id);

            courseTask = _courseTaskService.Create(courseTask, token);

            var solution        = InstanceFactory.Solution(token, courseTask.Id);
            var createdSolution = _solutionService.Create(solution, token);

            Assert.IsNotNull(createdSolution);
            Assert.AreEqual(token, createdSolution.AuthorId);
            Assert.AreEqual(courseTask.Id, createdSolution.CourseTaskId);
        }
Example #5
0
        public void CreateReview()
        {
            var token  = InstanceFactory.AuthorizedUserId();
            var course = InstanceFactory.Course();

            course = _courseService.Create(course, token);
            var courseTask = InstanceFactory.CourseTask(token, course.Id);

            courseTask = _courseTaskService.Create(courseTask, token);
            var solution = InstanceFactory.Solution(token, courseTask.Id);

            solution = _solutionService.Create(solution, token);

            var review        = InstanceFactory.Review(token, solution.Id, courseTask);
            var createdReview = _reviewService.Create(review, token);

            Assert.IsNotNull(createdReview);
        }
Example #6
0
        public void DeleteSolution()
        {
            var token  = InstanceFactory.AuthorizedUserId();
            var course = InstanceFactory.Course();

            course = _courseService.Create(course, token);
            var courseTask = InstanceFactory.CourseTask(token, course.Id);

            courseTask = _courseTaskService.Create(courseTask, token);

            var solution = InstanceFactory.Solution(token, courseTask.Id);

            solution = _solutionService.Create(solution, token);
            _solutionService.Delete(solution.Id, token);
            var deletedSolution = _solutionService.Get(solution.Id, token);

            Assert.IsNull(deletedSolution);
        }
Example #7
0
        public void GetTaskSolution()
        {
            Guid   userId = InstanceFactory.AuthorizedUserId();
            Course course = InstanceFactory.Course();

            course = _courseService.Create(course, userId);

            CourseTask courseTask = InstanceFactory.CourseTask(userId, course.Id);

            courseTask = _courseTaskService.Create(courseTask, userId);

            CourseSolution solution = InstanceFactory.Solution(userId, courseTask.Id);

            solution = _solutionService.Create(solution, userId);
            ICollection <CourseSolution> solutions = _solutionService.GetSolutionsByTask(courseTask.Id, userId);

            Assert.IsNotNull(solutions);
            Assert.AreEqual(1, solutions.Count(s => s.AuthorId == userId));
        }
Example #8
0
        public void GetSolutionReviews()
        {
            var token  = InstanceFactory.AuthorizedUserId();
            var course = InstanceFactory.Course();

            course = _courseService.Create(course, token);
            var courseTask = InstanceFactory.CourseTask(token, course.Id);

            courseTask = _courseTaskService.Create(courseTask, token);
            var solution = InstanceFactory.Solution(token, courseTask.Id);

            solution = _solutionService.Create(solution, token);

            var review        = InstanceFactory.Review(token, solution.Id, courseTask);
            var createdReview = _reviewService.Create(review, token);
            var reviews       = _reviewService.GetReviewsBySolution(solution.Id, token);

            Assert.IsNotNull(reviews);
            Assert.AreEqual(1, reviews.Count(r => r.AuthorId == token));
        }