public async Task <IActionResult> Edit(Edit.Command command) { await this.mediator.SendAsync(command); TempData.SetSuccessMessage(SuccessMessages.SuccessfullyEditedCategory(command.Name)); return(this.RedirectToActionJson("Categories", "Admin")); }
public async Task SuccessfullEditSetsSuccessMessage(SliceFixture fixture) { // Arrange var category = AddCategoryToDatabase(fixture); var controller = fixture.GetController <CategoryController>(); // Act var editCommand = new Edit.Command { Id = category.Id, Name = "Edited name" }; await controller.Edit(editCommand); // Assert controller.TempData .ShouldContainSuccessMessage(SuccessMessages.SuccessfullyEditedCategory(editCommand.Name)); }