Пример #1
0
        public void DescriptionLengthIsOver100_ShouldHaveError()
        {
            _command = new UpdateLearningPathCommand {
                Description = new string('*', 101)
            };

            _sut.ShouldHaveValidationErrorFor(x => x.Description, _command);
        }
Пример #2
0
        public void DescriptionIsValid_ShouldNotHaveError()
        {
            _command = new UpdateLearningPathCommand {
                Description = "description"
            };

            _sut.ShouldNotHaveValidationErrorFor(x => x.Description, _command);
        }
Пример #3
0
        public void NameIsValid_ShouldNotHaveError()
        {
            _command = new UpdateLearningPathCommand {
                Name = "learning path name"
            };

            _sut.ShouldNotHaveValidationErrorFor(x => x.Name, _command);
        }
Пример #4
0
        public void NameLengthIsOver50_ShouldHaveError()
        {
            _command = new UpdateLearningPathCommand {
                Name = new string('*', 51)
            };

            _sut.ShouldHaveValidationErrorFor(x => x.Name, _command);
        }
Пример #5
0
        public void NameIsNullOrEmpty_ShouldHaveError(string name)
        {
            _command = new UpdateLearningPathCommand {
                Name = name
            };

            _sut.ShouldHaveValidationErrorFor(x => x.Name, _command);
        }
Пример #6
0
        public void LearningPathIdIsValid_ShouldNotHaveError()
        {
            _command = new UpdateLearningPathCommand {
                LearningPathId = "learningPathId"
            };

            _sut.ShouldNotHaveValidationErrorFor(x => x.LearningPathId, _command);
        }
Пример #7
0
        public void LearningPathIdIsNullOrEmpty_ShouldHaveError(string learningPathId)
        {
            _command = new UpdateLearningPathCommand {
                LearningPathId = learningPathId
            };

            _sut.ShouldHaveValidationErrorFor(x => x.LearningPathId, _command);
        }
        public void SetUp()
        {
            _service    = new Mock <IUpdateLearningPathService>();
            _unitOfWork = new Mock <IUnitOfWork>();
            _sut        = new UpdateLearningPathCommandHandler(_service.Object, _unitOfWork.Object);

            _command = new UpdateLearningPathCommand
            {
                LearningPathId = "learningPathId",
                Name           = "name",
                Description    = "description"
            };

            _learningPathToUpdate = new LearningPath("name", "organizationId");
            _service.Setup(x => x.GetLearningPath(_command.LearningPathId, default))
            .ReturnsAsync(_learningPathToUpdate);
        }
Пример #9
0
        public async Task <ActionResult> UpdateLearningPath(UpdateLearningPathCommand command, CancellationToken token)
        {
            await Mediator.Send(command, token);

            return(NoContent());
        }