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

            TempData.SetSuccessMessage(SuccessMessages.SuccessfullyCreatedProduct(command.Name));
            return(this.RedirectToActionJson("Products", "Admin"));
        }
Example #2
0
        public async Task SuccessfullCreationSetsSuccessMessage(SliceFixture fixture)
        {
            // Arrange
            var controller = fixture.GetController <ProductController>();

            // Act
            var createCommand = new Create.Command()
            {
                Name        = "Some product",
                Description = "Some description",
                Category    = new Data.Models.Category()
                {
                    Name = "Some category"
                },
                Price = 120.00m
            };

            await controller.Create(createCommand);

            // Assert
            controller.TempData
            .ShouldContainSuccessMessage(SuccessMessages.SuccessfullyCreatedProduct(createCommand.Name));
        }