示例#1
0
        public async Task <ActionResult> AddLearnerAccessHistory(AddLearnerAccessHistoryCommand command,
                                                                 CancellationToken token)
        {
            await Mediator.Send(command, token);

            return(NoContent());
        }
        public void LectureIdIsValid_ShouldNotHaveError()
        {
            var command = new AddLearnerAccessHistoryCommand {
                LectureId = "lectureId"
            };

            _sut.ShouldNotHaveValidationErrorFor(x => x.LectureId, command);
        }
        public void LectureIdIsEmptyOrNull_ShouldHaveError(string lectureId)
        {
            var command = new AddLearnerAccessHistoryCommand {
                LectureId = lectureId
            };

            _sut.ShouldHaveValidationErrorFor(x => x.LectureId, command);
        }
示例#4
0
        public void SetUp()
        {
            _service    = new Mock <IAddLearnerAccessHistoryService>();
            _unitOfWork = new Mock <IUnitOfWork>();
            _sut        = new AddLearnerAccessHistoryCommandHandler(_service.Object, _unitOfWork.Object);

            _command = new AddLearnerAccessHistoryCommand {
                LectureId = "lectureId"
            };

            _courseId = "courseId";
            _service.Setup(x => x.GetLectureCourseId(_command.LectureId, default))
            .ReturnsAsync(_courseId);

            _accessHistory = new LearnerLectureAccessHistory("learnerId", "lectureId");
            _service.Setup(x => x.CreateAccessHistory(_command.LectureId))
            .Returns(_accessHistory);
        }