コード例 #1
0
        public void LearningPathIdIsValid_ShouldNotHaveError()
        {
            _command = new UpdateUserLearningPathCommand {
                LearningPathId = "learningPathId"
            };

            _sut.ShouldNotHaveValidationErrorFor(x => x.LearningPathId, _command);
        }
コード例 #2
0
        public void LearningPathIdIsNullOrEmpty_ShouldHaveError(string learningPathId)
        {
            _command = new UpdateUserLearningPathCommand {
                LearningPathId = learningPathId
            };

            _sut.ShouldHaveValidationErrorFor(x => x.LearningPathId, _command);
        }
コード例 #3
0
        public void SetUp()
        {
            _service    = new Mock <IUpdateUserLearningPathService>();
            _unitOfWork = new Mock <IUnitOfWork>();
            _sut        = new UpdateUserLearningPathCommandHandler(_service.Object, _unitOfWork.Object);

            _command = new UpdateUserLearningPathCommand {
                UserId = "userId", LearningPathId = "learningPathId"
            };

            _userToUpdate = new User("email", "organizationId");
            _service.Setup(x => x.GetUserFromRepo(_command.UserId, default))
            .ReturnsAsync(_userToUpdate);

            _learningPath = new LearningPath("name", "organizationId");
            _service.Setup(x => x.GetLearningPath(_command.LearningPathId, default))
            .ReturnsAsync(_learningPath);
        }
コード例 #4
0
        public async Task <ActionResult> UpdateUser(UpdateUserLearningPathCommand command, CancellationToken token)
        {
            await Mediator.Send(command, token);

            return(NoContent());
        }