public async Task <ActionResult> UpdateModulesOrders(UpdateLecturesOrdersCommand command, CancellationToken token) { await Mediator.Send(command, token); return(NoContent()); }
public async Task WhenIUpdateAModuleLecturesWithAnEmptyOrANullId(string moduleId) { _command = new UpdateLecturesOrdersCommand { ModuleId = moduleId, LecturesOrders = new LectureOrderDto[1] }; _response = await _client.PutAsync(BaseUrl, Utilities.GetRequestContent(_command)); }
public void LecturesOrdersCollectionIsNull_ShouldHaveError() { var command = new UpdateLecturesOrdersCommand { LecturesOrders = null }; _sut.ShouldHaveValidationErrorFor(x => x.LecturesOrders, command); }
public void LecturesOrdersCollectionIsEmpty_ShouldHaveError() { var command = new UpdateLecturesOrdersCommand { LecturesOrders = new Collection <LectureOrderDto>() }; _sut.ShouldHaveValidationErrorFor(x => x.LecturesOrders, command); }
public void ModuleIdIsEmptyOrNull_ShouldHaveError(string moduleId) { var command = new UpdateLecturesOrdersCommand { ModuleId = moduleId }; _sut.ShouldHaveValidationErrorFor(x => x.ModuleId, command); }
public async Task WhenIUpdateAModuleLecturesWithAnInvalidModuleId() { _command = new UpdateLecturesOrdersCommand { ModuleId = "invalidModuleId", LecturesOrders = new LectureOrderDto[1] }; _response = await _client.PutAsync(BaseUrl, Utilities.GetRequestContent(_command)); }
public async Task WhenIUpdateAModuleLecturesWithoutSpecifyingLecturesOrders() { _command = new UpdateLecturesOrdersCommand { ModuleId = "moduleId", LecturesOrders = new List <LectureOrderDto>() }; _response = await _client.PutAsync(BaseUrl, Utilities.GetRequestContent(_command)); }
public void SetUp() { _service = new Mock <IUpdateLecturesOrdersService>(); _commonService = new Mock <IModulesCommonService>(); _unitOfWork = new Mock <IUnitOfWork>(); _command = new UpdateLecturesOrdersCommand(); _sut = new UpdateLecturesOrdersCommandHandler(_service.Object, _commonService.Object, _unitOfWork.Object); _lecturesToUpdateOrders = new List <Lecture>(); _service.Setup(x => x.GetModuleLecturesFromRepo(_command.ModuleId, default)) .ReturnsAsync(_lecturesToUpdateOrders); }
public async Task WhenIUpdateLecturesOrdersOfAPublishedCourse() { 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); _command = new UpdateLecturesOrdersCommand { ModuleId = module.Id, LecturesOrders = new LectureOrderDto[1] }; _response = await _client.PutAsync(BaseUrl, Utilities.GetRequestContent(_command)); }
public void ValidParameters_ShouldNotHaveError() { var command = new UpdateLecturesOrdersCommand { ModuleId = "moduleId", LecturesOrders = new[] { new LectureOrderDto { LectureId = "lecture1", Order = 1 }, new LectureOrderDto { LectureId = "lecture2", Order = 2 } } }; _sut.ShouldNotHaveValidationErrorFor(x => x.ModuleId, command); _sut.ShouldNotHaveValidationErrorFor(x => x.LecturesOrders, command); }
public void GivenADraftCourseAndAModuleHavingTheFollowingLecturesOrders(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 lecture1 = new ArticleLecture("lecture 1", module.Id, 1, "lecture 1 content"); _factory.CreateLecture(lecture1); var lecture2 = new VideoLecture("lecture 2", module.Id, 2); _factory.CreateLecture(lecture2); _command = new UpdateLecturesOrdersCommand { ModuleId = module.Id }; _lecturesIds = new[] { lecture1.Id, lecture2.Id }; }