public void LectureIdIsValid_ShouldNotHaveError() { var command = new CompleteLectureCommand { LectureId = "lectureId" }; _sut.ShouldNotHaveValidationErrorFor(x => x.LectureId, command); }
public void LectureIdIsEmptyOrNull_ShouldHaveError(string lectureId) { var command = new CompleteLectureCommand { LectureId = lectureId }; _sut.ShouldHaveValidationErrorFor(x => x.LectureId, command); }
public void SetUp() { _service = new Mock <ICompleteLectureService>(); _unitOfWork = new Mock <IUnitOfWork>(); _sut = new CompleteLectureCommandHandler(_service.Object, _unitOfWork.Object); _command = new CompleteLectureCommand { LectureId = "lectureId" }; _service.Setup(x => x.IsTheLectureAlreadyCompleted(_command.LectureId, default)) .ReturnsAsync(false); _completedLecture = new LearnerCompletedLecture("learnerId", _command.LectureId); _service.Setup(x => x.CreateCompletedLecture(_command.LectureId)) .Returns(_completedLecture); }
public async Task <ActionResult> CompleteLecture(CompleteLectureCommand command, CancellationToken token) { await Mediator.Send(command, token); return(NoContent()); }