Exemple #1
0
        public async Task <IActionResult> Remove(Remove.Command command)
        {
            await this.mediator.SendAsync(command);

            TempData.SetSuccessMessage(SuccessMessages.SuccessfullyRemovedProduct(command.ProductId));
            return(RedirectToAction("Products", "Admin"));
        }
Exemple #2
0
        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));
        }