Exemple #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);
        }
Exemple #2
0
        public JsonResult RemoveComment(DeleteProductCommentCommand command)
        {
            var result = _commandBus.Send(command);

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

            return(JsonMessage(result));
        }