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); }
public JsonResult RemoveComment(DeleteProductCommentCommand command) { var result = _commandBus.Send(command); return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult DeleteComment(DeleteProductCommentCommand command) { var result = _commandBus.Send(command); return(JsonMessage(result)); }