public void AddGetAction_IsNotNull() { WorkcenterController controller = new WorkcenterController(mock.Object); jsonResult = controller.Add() as JsonResult; Assert.IsNotNull(jsonResult.Data); }
public void AddPostAction_ModelError() { AddPostAction_Arrange(); WorkcenterController controller = new WorkcenterController(mock.Object); controller.ModelState.AddModelError("Name", "Название модели не установлено"); jsonResult = controller.Add(workcenterDto) as JsonResult; Assert.IsFalse(controller.ModelState.IsValid); }
public void AddPostAction_RouteResult_ActionIsIndex() { // Arrange string expected = "Index"; AddPostAction_Arrange(); WorkcenterController controller = new WorkcenterController(mock.Object); // Act RedirectToRouteResult result = controller.Add(workcenterDto) as RedirectToRouteResult; var actual = result.RouteValues["action"]; // Assert Assert.IsNotNull(result); Assert.AreEqual(expected, actual); }