public async Task WhenIEditAnInvalidCourseId() { _command = new DraftCourseCommand { CourseId = "invalidCourseId" }; _response = await _client.PutAsync(BaseUrl, Utilities.GetRequestContent(_command)); }
public async Task WhenIEditACourseWithAnEmptyOrANull(string courseId) { _command = new DraftCourseCommand { CourseId = courseId }; _response = await _client.PutAsync(BaseUrl, Utilities.GetRequestContent(_command)); }
public void ValidCourseId_ShouldNotHaveError() { var command = new DraftCourseCommand { CourseId = "courseId" }; _sut.ShouldNotHaveValidationErrorFor(x => x.CourseId, command); }
public void EmptyOrNullCourseId_ShouldHaveError(string courseId) { var command = new DraftCourseCommand { CourseId = courseId }; _sut.ShouldHaveValidationErrorFor(x => x.CourseId, command); }
public void GivenACourseBelongingToMyOrganization() { var course = new Course("course", _instructorId, DateTime.Now); course.ChangeCourseStatus(UnpublishedStatus.Instance); _command = new DraftCourseCommand { CourseId = course.Id }; _factory.CreateCourse(course); }
public void SetUp() { _service = new Mock <IDraftCourseService>(); _commonService = new Mock <ICoursesCommonService>(); _unitOfWork = new Mock <IUnitOfWork>(); _command = new DraftCourseCommand { CourseId = "courseId" }; _sut = new DraftCourseCommandHandler(_service.Object, _commonService.Object, _unitOfWork.Object); _courseToDraft = new Course("name", "creatorId", DateTime.Now); _commonService.Setup(x => x.GetCourseFromRepo(_command.CourseId, default)) .ReturnsAsync(_courseToDraft); }
public async Task WhenIEditACourseBelongingToAnOtherOrganization() { 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); _command = new DraftCourseCommand { CourseId = course.Id }; _factory.CreateCourse(course); _response = await _client.PutAsync(BaseUrl, Utilities.GetRequestContent(_command)); }
public async Task <ActionResult> DraftCourse(DraftCourseCommand command, CancellationToken token) { await Mediator.Send(command, token); return(NoContent()); }