Exemplo n.º 1
0
        public async Task DeleteProductCommentCommandHandle_DeletesExistingProductComment()
        {
            //Arrange
            AllMarktContextIM.ProductComments.Add(new AllMarkt.Entities.ProductComment
            {
                Rating = 5,
                Text   = "test"
            });

            await AllMarktContextIM.SaveChangesAsync();

            var existingProductComment = await AllMarktContextIM.ProductComments.FirstAsync();

            var deleteProductCommentCommand = new DeleteProductCommentCommand {
                Id = existingProductComment.Id
            };

            //Act
            await _deleteProductCommentCommandHandler.Handle(deleteProductCommentCommand, CancellationToken.None);

            //Assert
            AllMarktContextIM.ProductComments
            .Should()
            .NotContain(ProductComments => ProductComments.Id == deleteProductCommentCommand.Id);
        }
Exemplo n.º 2
0
        public JsonResult RemoveComment(DeleteProductCommentCommand command)
        {
            var result = _commandBus.Send(command);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        public JsonResult DeleteComment(DeleteProductCommentCommand command)
        {
            var result = _commandBus.Send(command);

            return(JsonMessage(result));
        }