Пример #1
0
        public async Task ShouldCreateSentiment()
        {
            var command = new CreateSentimentCommand
            {
                Word           = "nice",
                SentimentScore = 0.4f
            };

            var result = await SendAsync(command);

            var list = await FindAsync <Sentiment>(result.Data.Id);

            list.Should().NotBeNull();
            list.Word.Should().Be(command.Word);
            list.SentimentScore.Should().Be(command.SentimentScore);
        }
Пример #2
0
        public async Task ShouldRequireUniqueWord()
        {
            await SendAsync(new CreateSentimentCommand
            {
                Word           = "nice",
                SentimentScore = 0.4f
            });

            var command = new CreateSentimentCommand
            {
                Word           = "nice",
                SentimentScore = 0.4f
            };

            FluentActions.Invoking(() => SendAsync(command)).Should().Throw <ValidationException>();
        }
Пример #3
0
        public void ShouldRequireMinimumFields()
        {
            var command = new CreateSentimentCommand();

            FluentActions.Invoking(() => SendAsync(command)).Should().Throw <ValidationException>();
        }
 public async Task <ActionResult <ServiceResult <SentimentDto> > > Create(CreateSentimentCommand command)
 {
     return(Ok(await Mediator.Send(command)));
 }