public void SetUp() { _lecturesService = new Mock <IUploadMediaService>(); _commonService = new Mock <ILecturesCommonService>(); _unitOfWork = new Mock <IUnitOfWork>(); _sut = new UploadMediaCommandHandler(_lecturesService.Object, _commonService.Object, _unitOfWork.Object); _mediaLectureToUpdate = new VideoLecture("title", "moduleId", 1); _command = new UploadMediaCommand(_mediaLectureToUpdate.Id, "lectureType", null); _commonService.Setup(x => x.GetLectureFromRepo(_command.LectureId, default)) .ReturnsAsync(_mediaLectureToUpdate); _mediaResource = new ResourceToCreate(_command.File, VideoType.Instance); _lecturesService.Setup(x => x.GenerateMediaResource(_command.File)) .Returns(_mediaResource); _uploadedResource = new ResourceUploadResult("resourceId", "resourceUrl"); _lecturesService.Setup(x => x.UploadResource(_mediaResource)) .Returns(_uploadedResource); }
public void ValidData_ShouldNotHaveError() { var command = new UploadMediaCommand("lectureId", "lectureType", null); _sut.ShouldNotHaveValidationErrorFor(x => x.LectureId, command); }
public void LectureTypeIsEmptyOrNull_ShouldHaveError(string lectureType) { var command = new UploadMediaCommand(null, lectureType, null); _sut.ShouldHaveValidationErrorFor(x => x.LectureType, command); }