示例#1
0
        public void NameIsValid_ShouldNotHaveError()
        {
            _command = new CreateLearningPathCommand {
                Name = "learning path name"
            };

            _sut.ShouldNotHaveValidationErrorFor(x => x.Name, _command);
        }
示例#2
0
        public void NameLengthIsOver50_ShouldHaveError()
        {
            _command = new CreateLearningPathCommand {
                Name = new string('*', 51)
            };

            _sut.ShouldHaveValidationErrorFor(x => x.Name, _command);
        }
示例#3
0
        public void NameIsNullOrEmpty_ShouldHaveError(string name)
        {
            _command = new CreateLearningPathCommand {
                Name = name
            };

            _sut.ShouldHaveValidationErrorFor(x => x.Name, _command);
        }
        public void SetUp()
        {
            _service    = new Mock <ICreateLearningPathService>();
            _unitOfWork = new Mock <IUnitOfWork>();
            _sut        = new CreateLearningPathCommandHandler(_service.Object, _unitOfWork.Object);

            _command = new CreateLearningPathCommand {
                Name = "name"
            };

            _learningPathToCreate = new LearningPath(_command.Name, "organizationId");
            _service.Setup(x => x.CreateLearningPath(_command.Name))
            .Returns(_learningPathToCreate);
        }
 public async Task <ActionResult <CommandResponse> > Create(CreateLearningPathCommand command,
                                                            CancellationToken token)
 {
     return(Ok(await Mediator.Send(command, token)));
 }