public void CoursesOrdersListIsEmpty_ShouldHaveError()
        {
            _command = new UpdateCoursesOrdersCommand {
                CoursesOrders = new List <CourseOrderDto>()
            };

            _sut.ShouldHaveValidationErrorFor(x => x.CoursesOrders, _command);
        }
        public void CoursesOrdersListIsNull_ShouldHaveError()
        {
            _command = new UpdateCoursesOrdersCommand {
                CoursesOrders = null
            };

            _sut.ShouldHaveValidationErrorFor(x => x.CoursesOrders, _command);
        }
        public void LearningPathIdIsValid_ShouldNotHaveError()
        {
            _command = new UpdateCoursesOrdersCommand {
                LearningPathId = "learningPathId"
            };

            _sut.ShouldNotHaveValidationErrorFor(x => x.LearningPathId, _command);
        }
        public void LearningPathIdIsNullOrEmpty_ShouldHaveError(string learningPathId)
        {
            _command = new UpdateCoursesOrdersCommand {
                LearningPathId = learningPathId
            };

            _sut.ShouldHaveValidationErrorFor(x => x.LearningPathId, _command);
        }
        public void CoursesOrdersListIsValid_ShouldNotHaveError()
        {
            _command = new UpdateCoursesOrdersCommand {
                CoursesOrders = new List <CourseOrderDto> {
                    new CourseOrderDto()
                }
            };

            _sut.ShouldNotHaveValidationErrorFor(x => x.CoursesOrders, _command);
        }
        public void SetUp()
        {
            _service    = new Mock <IUpdateCoursesOrdersService>();
            _unitOfWork = new Mock <IUnitOfWork>();
            _sut        = new UpdateCoursesOrdersCommandHandler(_service.Object, _unitOfWork.Object);

            _command = new UpdateCoursesOrdersCommand
            {
                LearningPathId = "learningPathId", CoursesOrders = new List <CourseOrderDto>()
            };

            _coursesToUpdateOrders = new List <LearningPathCourse>();
            _service.Setup(x => x.GetLearningPathCourses(_command.LearningPathId, default))
            .ReturnsAsync(_coursesToUpdateOrders);
        }
        public async Task <ActionResult> UpdateCoursesOrders(UpdateCoursesOrdersCommand command, CancellationToken token)
        {
            await Mediator.Send(command, token);

            return(NoContent());
        }