public async Task <IActionResult> Remove(Remove.Command command) { await this.mediator.SendAsync(command); TempData.SetSuccessMessage(SuccessMessages.SuccessfullyRemovedProduct(command.ProductId)); return(RedirectToAction("Products", "Admin")); }
public async Task SuccessfullRemoveSetsSuccessMessage(SliceFixture fixture) { // Arrange var product = AddProductToDatabase(fixture); var controller = fixture.GetController <ProductController>(); // Act var removeCommand = new Remove.Command { ProductId = product.Id }; await controller.Remove(removeCommand); // Assert controller.TempData .ShouldContainSuccessMessage(SuccessMessages.SuccessfullyRemovedProduct(removeCommand.ProductId)); }