public async Task <ActionResult> UpdateCourseLearningPaths(UpdateCourseLearningPathsCommand command, CancellationToken token) { await Mediator.Send(command, token); return(NoContent()); }
public void CourseIdIsEmptyOrNull_ShouldHaveError(string courseId) { var command = new UpdateCourseLearningPathsCommand { CourseId = courseId }; _sut.ShouldHaveValidationErrorFor(x => x.CourseId, command); }
public async Task WhenIUpdateACourseLearningPathsWithAnEmptyOrANullId(string courseId) { _command = new UpdateCourseLearningPathsCommand { CourseId = courseId, LearningPathsIds = new string[1] }; _response = await _client.PutAsync(BaseUrl, Utilities.GetRequestContent(_command)); }
public async Task WhenIUpdateACourseLearningPathsWithAnInvalidCourseId() { _command = new UpdateCourseLearningPathsCommand { CourseId = "invalidCourseId", LearningPathsIds = new string[1] }; _response = await _client.PutAsync(BaseUrl, Utilities.GetRequestContent(_command)); }
public async Task WhenIUpdateACourseLearningPathsWithoutSpecifyingLearningPathsIds() { _command = new UpdateCourseLearningPathsCommand { CourseId = "courseId", LearningPathsIds = new List <string>() }; _response = await _client.PutAsync(BaseUrl, Utilities.GetRequestContent(_command)); }
public void GivenADraftCourseThatHasAnEmptyLearningPathsList(Table table) { var course = new Course("course", _instructorId, DateTime.Now); _factory.CreateCourse(course); _command = new UpdateCourseLearningPathsCommand { CourseId = course.Id }; }
public async Task WhenIUpdateACourseLearningPathsWithAnInvalidLearningPathsIds() { var course = new Course("course", _instructorId, DateTime.Now); _factory.CreateCourse(course); _command = new UpdateCourseLearningPathsCommand { CourseId = course.Id, LearningPathsIds = new[] { "invalidPathId1" } }; _response = await _client.PutAsync(BaseUrl, Utilities.GetRequestContent(_command)); }
public void ValidParameters_ShouldNotHaveError() { var command = new UpdateCourseLearningPathsCommand { CourseId = "courseId", LearningPathsIds = new List <string> { "learningPathId" } }; _sut.ShouldNotHaveValidationErrorFor(x => x.CourseId, command); _sut.ShouldNotHaveValidationErrorFor(x => x.LearningPathsIds, command); }
public void SetUp() { _service = new Mock <IUpdateCourseLearningPathsService>(); _unitOfWork = new Mock <IUnitOfWork>(); _sut = new UpdateCourseLearningPathsCommandHandler(_service.Object, _unitOfWork.Object); _command = new UpdateCourseLearningPathsCommand { CourseId = "courseId", LearningPathsIds = new List <string>() }; _courseToUpdate = new Course("course title", "creatorId", DateTime.Now); _service.Setup(x => x.GetCourseFromRepo(_command.CourseId, default)) .ReturnsAsync(_courseToUpdate); }
public async Task WhenIUpdateTheLearningPathsOfAPublishedCourse() { var course = new Course("course", _instructorId, DateTime.Now); course.ChangeCourseStatus(PublishedStatus.Instance); _factory.CreateCourse(course); var learningPath = new LearningPath("developer", _organizationId); _factory.AddLearningPath(learningPath); _command = new UpdateCourseLearningPathsCommand { CourseId = course.Id, LearningPathsIds = new[] { learningPath.Id } }; _response = await _client.PutAsync(BaseUrl, Utilities.GetRequestContent(_command)); }
public async Task WhenIUpdateACourseBelongingToAnOtherOrganization() { var otherOrganization = new Organization("other organization", SubscriptionPlans.Free); _factory.CreateOrganization(otherOrganization); var otherInstructor = new User("*****@*****.**", otherOrganization.Id); _factory.CreateUser(otherInstructor); var course = new Course("course", otherInstructor.Id, DateTime.Now); _factory.CreateCourse(course); _command = new UpdateCourseLearningPathsCommand { CourseId = course.Id, LearningPathsIds = new string[1] }; _response = await _client.PutAsync(BaseUrl, Utilities.GetRequestContent(_command)); }
public void GivenADraftCourseThatHasANon_EmptyLearningPathsList(Table table) { var developer = new LearningPath("developer", _organizationId); _factory.AddLearningPath(developer); var businessAnalyst = new LearningPath("Business Analyst", _organizationId); _factory.AddLearningPath(businessAnalyst); var course = new Course("course", _instructorId, DateTime.Now); course.AddLearningPath(new LearningPathCourse(developer.Id, course.Id, 1)); course.AddLearningPath(new LearningPathCourse(businessAnalyst.Id, course.Id, 2)); _factory.CreateCourse(course); _command = new UpdateCourseLearningPathsCommand { CourseId = course.Id }; _learningPathsIds = new[] { developer.Id }; }
public void LearningPathsIdsListIsNull_ShouldHaveError() { var command = new UpdateCourseLearningPathsCommand(); _sut.ShouldHaveValidationErrorFor(x => x.LearningPathsIds, command); }