public NewQuestionTest() { _handler = new PostHandler(_questionRepository.Object, null); _validCommand = new NewQuestionCommand { Text = "Tecnologias para 2021?", User = "******" }; }
public async Task <ActionResult> QuestionPost( [FromBody] NewQuestionCommand command) { var result = await _bus.SendCommand(command); if (!result.Sucess) { return(BadRequest(result)); } return(Ok(result)); }
public async Task Notify_When_User_Invalid() { var invalidCommand = new NewQuestionCommand { Text = "Tecnologias para 2021?", User = "******" }; var result = await _handler.Handle(invalidCommand); var notifications = (List <string>)result.Data; var notificationWithUserMinChar = notifications.Where(n => n == Message.PostUserMinChar).Any(); Assert.True(notificationWithUserMinChar); }
public async Task Notify_When_Text_Invalid() { var invalidCommand = new NewQuestionCommand { Text = "Iae?", User = "******" }; var result = await _handler.Handle(invalidCommand); var notifications = (List <string>)result.Data; var notificationWithTextMinChar = notifications.Where(n => n == Message.PostTextMinChar).Any(); Assert.True(notificationWithTextMinChar); }