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); }
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); }
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); }
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); }
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)); }
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)); }