public void WhenUpdateImageTitleIsExecutedWithValidModel_CommandIsSent() { var input = new UpdateImageTitleInput() { Title = "title" }; Controller._UpdateImageTitle("imageId", input); CommandInvokerMock.Verify(x => x.Execute(It.Is <UpdateImageTitleCommand>(y => y.Title == "title")), Times.Once()); }
public ActionResult _UpdateImageTitle(string imageId, UpdateImageTitleInput input) { if (ModelState.IsValid) { commandInvoker.Execute(new UpdateImageTitleCommand( imageId, input.Title)); return(Json(new { Success = true })); } else { return(Json(new { Success = false })); } }