public async Task <IActionResult> Create(Create.Command command) { await this.mediator.SendAsync(command); TempData.SetSuccessMessage(SuccessMessages.SuccessfullyCreatedCategory(command.Name)); return(this.RedirectToActionJson("Categories", "Admin")); }
public async Task SuccessfulCreationSetsSuccessMessage(SliceFixture fixture) { // Arrange var controller = fixture.GetController <CategoryController>(); // Act var createCommand = new Create.Command { Name = "Some category" }; await controller.Create(createCommand); // Assert controller.TempData .ShouldContainSuccessMessage(SuccessMessages.SuccessfullyCreatedCategory(createCommand.Name)); }