Пример #1
0
 public NewQuestionTest()
 {
     _handler      = new PostHandler(_questionRepository.Object, null);
     _validCommand = new NewQuestionCommand {
         Text = "Tecnologias para 2021?", User = "******"
     };
 }
Пример #2
0
        public async Task <ActionResult> QuestionPost(
            [FromBody] NewQuestionCommand command)
        {
            var result = await _bus.SendCommand(command);

            if (!result.Sucess)
            {
                return(BadRequest(result));
            }

            return(Ok(result));
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }