Esempio n. 1
0
        private static InsertQuestionCommand InsertQuestionCommand()
        {
            var dispatcherMock = new Mock <ICommandDispatcher>();

            var command = new InsertQuestionCommand(dispatcherMock.Object);

            return(command);
        }
        public void HandleAsync_Return_Task()
        {
            //Arrange
            var handler = InputQuestionCommandHandler();

            var dispatcherMock = new Mock <ICommandDispatcher>();
            var command        = new InsertQuestionCommand(dispatcherMock.Object);

            //Act
            var result = handler.HandleAsync(command);

            //Assert
            Assert.IsInstanceOf <Task>(result);
        }
        public async Task <ActionResult> PostAsync([FromBody] QuestionModel model)
        {
            var insertCommand = new InsertQuestionCommand()
            {
                Descricao = model.Descricao
            };
            var servico = new ServicoCadastroQuestao();

            if (insertCommand.EhValido())
            {
                await servico.Insert(insertCommand);

                return(CustomResponse(model));
            }

            return(CustomResponse(insertCommand));
        }
 public Task Insert(InsertQuestionCommand insertCommand)
 {
     throw new NotImplementedException();
 }