public void ShouldRequireValidSentimentId() { var command = new UpdateSentimentCommand { Id = 99, Word = "test" }; FluentActions.Invoking(() => SendAsync(command)).Should().Throw <NotFoundException>(); }
public async Task ShouldUpdateSentiment() { var result = await SendAsync(new CreateSentimentCommand { Word = "nice", SentimentScore = 0.4f }); var command = new UpdateSentimentCommand { Id = result.Data.Id, Word = "nice", SentimentScore = 0.8f }; await SendAsync(command); var sentiment = await FindAsync <Sentiment>(result.Data.Id); sentiment.Word.Should().Be(command.Word); sentiment.SentimentScore.Should().Be(command.SentimentScore); }
public async Task <ActionResult <ServiceResult <SentimentDto> > > Update(UpdateSentimentCommand command) { return(Ok(await Mediator.Send(command))); }