public void TitleLengthOver100_ShouldHaveError() { var command = new UpdateLectureCommand { Title = new string('*', 101) }; _sut.ShouldHaveValidationErrorFor(x => x.Title, command); }
public async Task WhenIUpdateAnInvalidLectureId() { _command = new UpdateLectureCommand { LectureId = "invalidLectureId", Title = "lecture title" }; _response = await _client.PutAsync(BaseUrl, Utilities.GetRequestContent(_command)); }
public async Task WhenIUpdateALectureWithAnEmptyOrANullTitle(string title) { _command = new UpdateLectureCommand { LectureId = "lectureId", Title = title }; _response = await _client.PutAsync(BaseUrl, Utilities.GetRequestContent(_command)); }
public void TitleIsEmptyOrNull_ShouldHaveError(string title) { var command = new UpdateLectureCommand { Title = title }; _sut.ShouldHaveValidationErrorFor(x => x.Title, command); }
public void LectureIdIsEmptyOrNull_ShouldHaveError(string lectureId) { var command = new UpdateLectureCommand { LectureId = lectureId }; _sut.ShouldHaveValidationErrorFor(x => x.LectureId, command); }
public async Task WhenIUpdateALectureWithATitleLengthOverCharacters(int maximumTitleLength) { _command = new UpdateLectureCommand { LectureId = "lectureId", Title = new string('*', maximumTitleLength + 1) }; _response = await _client.PutAsync(BaseUrl, Utilities.GetRequestContent(_command)); }
public void ValidParameters_ShouldNotHaveErrors() { var command = new UpdateLectureCommand { LectureId = "lectureId", Title = "title" }; _sut.ShouldNotHaveValidationErrorFor(x => x.LectureId, command); _sut.ShouldNotHaveValidationErrorFor(x => x.Title, command); }
public void SetUp() { _service = new Mock <IUpdateLectureService>(); _commonService = new Mock <ILecturesCommonService>(); _unitOfWork = new Mock <IUnitOfWork>(); _command = new UpdateLectureCommand { LectureId = "lectureId" }; _sut = new UpdateLectureCommandHandler(_service.Object, _commonService.Object, _unitOfWork.Object); _lectureToUpdate = new ArticleLecture("title", "moduleId", 1, "content"); _commonService.Setup(x => x.GetLectureFromRepo(_command.LectureId, default)) .ReturnsAsync(_lectureToUpdate); }
public void GivenALectureBelongingToADraftCourseWith(Table table) { var course = new Course("course", _instructorId, DateTime.Now); _factory.CreateCourse(course); var module = new Module("module", course.Id, 1); _factory.CreateModule(module); var lecture = new ArticleLecture("old title", module.Id, 1, "old content"); lecture.UpdateDuration(60); _factory.CreateLecture(lecture); _command = new UpdateLectureCommand { LectureId = lecture.Id }; }
public async Task WhenIUpdateALectureWhileTheCourseIsPublished() { var course = new Course("course", _instructorId, DateTime.Now); course.ChangeCourseStatus(PublishedStatus.Instance); _factory.CreateCourse(course); var module = new Module("module", course.Id, 1); _factory.CreateModule(module); var lecture = new ArticleLecture("lecture title", module.Id, 1, "article content"); _factory.CreateLecture(lecture); _command = new UpdateLectureCommand { LectureId = lecture.Id, Title = "lecture title" }; _response = await _client.PutAsync(BaseUrl, Utilities.GetRequestContent(_command)); }
public async Task <ActionResult> UpdateLecture(UpdateLectureCommand command, CancellationToken token) { await Mediator.Send(command, token); return(NoContent()); }