예제 #1
0
        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);
        }
예제 #2
0
        public ValidationResult Validate(RemoveQuestionCommand command)
        {
            var result = new ValidationResult();

            if (!ValidateId(command.Id))
            {
                result.AddMessage(QuestionValidationMessages.ID);
            }
            return(result);
        }
예제 #3
0
        public async Task Should_Remove_Question()
        {
            var command = new RemoveQuestionCommand()
            {
                Id = _question.Id
            };

            var result = await _service.Delete(command);

            result.Success.Should().BeTrue();
        }
예제 #4
0
        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>());
        }
예제 #5
0
 public async Task <IActionResult> RemovePollQuestion(RemoveQuestionCommand request)
 {
     return(Ok(await _mediator.Send(request)));
 }