public void Remove_InvalidId_ErrorResult() { mockUnitOfWork .Setup(m => m.Operators.GetById(1)) .Returns((Operator)null); var result = manager.Remove(1); TestContext.WriteLine(result.Details); Assert.That(result.Success, Is.False); }
/// <summary> /// Remove operator with specified Id. Uses pageStateJson for simplicity /// </summary> public IActionResult Remove(int operatorId, string pageStateJson) { PageState pageState = JsonConvert.DeserializeObject <PageState>(pageStateJson); var result = operatorManager.Remove(operatorId); if (!result.Success) { TempData["ErrorMessage"] = result.Details; return(Redirect(Url.Action("Operators", pageState))); } else { return(Redirect(Url.Action("Operators", pageState))); } }