コード例 #1
0
        public async Task CreateReview_Should_Return_OkResult()
        {
            //Arrange
            var createReview = new Contracts.Reviews.V1.ReviewCreate
            {
                Id      = ReviewId,
                Owner   = OwnerId,
                Caption = "Test Review",
                Content = "This is awesome product... You should buy it!"
            };

            outputHelper.WriteLine("ReviewId:" + ReviewId.ToString());
            //Act
            var response = await client.PostAsJsonAsync("/reviews", createReview);

            var payload = await response.Content.ReadAsStringAsync();

            outputHelper.WriteLine(payload);
            // Assert
            response.EnsureSuccessStatusCode();
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
        }
コード例 #2
0
 public Task Handle(Contracts.Reviews.V1.ReviewCreate command) =>
 aggrigateStore.Save(Domain.Review.Create(command.Id, command.Owner, command.Caption, command.Content));
コード例 #3
0
 public Task <IActionResult> Post(Contracts.Reviews.V1.ReviewCreate command) => HandleOrThrow(command, app => applicationService.Handle(app));
コード例 #4
0
 public Task Handle(Contracts.Reviews.V1.ReviewCreate command) =>
 repository.SaveAsync(Domain.Review.Create(command.Id, command.Owner, command.ProductId, command.Caption, command.Content));