public async Task Should_Not_Remove_Question() { var command = new RemoveQuestionCommand(); var result = await _service.Delete(command); result.Success.Should().BeFalse(); result.Message.Should().Be(QuestionValidationMessages.ID); }
public ValidationResult Validate(RemoveQuestionCommand command) { var result = new ValidationResult(); if (!ValidateId(command.Id)) { result.AddMessage(QuestionValidationMessages.ID); } return(result); }
public async Task Should_Remove_Question() { var command = new RemoveQuestionCommand() { Id = _question.Id }; var result = await _service.Delete(command); result.Success.Should().BeTrue(); }
public async Task <Result <QuestionResponse> > Delete(RemoveQuestionCommand command) { var validationResult = Validate(_removeQuestionCommandValidator.Validate(command)); if (!validationResult.Success) { return(validationResult); } await _repository.Remove(command.Id); return(new Result <QuestionResponse>()); }
public async Task <IActionResult> RemovePollQuestion(RemoveQuestionCommand request) { return(Ok(await _mediator.Send(request))); }