public void ValidModuleId_ShouldNotHaveError() { var command = new DeleteModuleCommand { ModuleId = "moduleId" }; _sut.ShouldNotHaveValidationErrorFor(x => x.ModuleId, command); }
public void ModuleIdIsEmptyOrNull_ShouldHaveError(string moduleId) { var command = new DeleteModuleCommand { ModuleId = moduleId }; _sut.ShouldHaveValidationErrorFor(x => x.ModuleId, command); }
public async Task <CommandResult> Remove([FromServices] DeleteModuleCommand _deleteModuleCommand, [FromBody] DeleteModuleInput deleteModuleInput) { var userInput = new UserInput <DeleteModuleInput> { UserId = User.GetUserId(), Data = deleteModuleInput }; var result = await Business.InvokeAsync <DeleteModuleCommand, UserInput <DeleteModuleInput>, CommandResult <dynamic> >( _deleteModuleCommand, userInput); return(result); }
public void SetUp() { _service = new Mock <IDeleteModuleService>(); _commonService = new Mock <IModulesCommonService>(); _unitOfWork = new Mock <IUnitOfWork>(); _mediator = new Mock <IMediator>(); _command = new DeleteModuleCommand { ModuleId = "moduleId" }; _sut = new DeleteModuleCommandHandler(_service.Object, _commonService.Object, _unitOfWork.Object, _mediator.Object); _moduleToDelete = new Module("name", "courseId", 1); _commonService.Setup(x => x.GetModuleFromRepo(_command.ModuleId, default)) .ReturnsAsync(_moduleToDelete); }
public async Task DeleteModule_Call() { //-------------- Arrange ------------- CommonArrangements(); var request = new DeleteModuleRequest(); var command = new DeleteModuleCommand(); A.CallTo(() => _mapper.Map <DeleteModuleRequest, DeleteModuleCommand>(request)).Returns(command); //-------------- Act ------------- var resp = moduleService.DeleteModuleAsync(request); //-------------- Assert ------------- A.CallTo(() => _bus.SendAsync(command)).MustHaveHappened(Repeated.Exactly.Once); }
//取消选中选择框 private void UnChecked(object parameter) { EditModuleCommand.RaiseCanExecuteChanged(); DeleteModuleCommand.RaiseCanExecuteChanged(); }