public void EditGetAction_IsNotNull() { EditGetAction_Arrange(); WorkcenterController controller = new WorkcenterController(mock.Object); jsonResult = controller.Edit(id) as JsonResult; Assert.IsNotNull(jsonResult.Data); }
public void EditPostAction_ModelError() { EditGetAction_Arrange(); WorkcenterController controller = new WorkcenterController(mock.Object); controller.ModelState.AddModelError("Name", "Название модели не установлено"); jsonResult = controller.Edit(workcenterDto) as JsonResult; Assert.IsFalse(controller.ModelState.IsValid); }
public void EditGetAction_TypeIsTrue() { var expected = typeof(WorkcenterDTO); EditGetAction_Arrange(); WorkcenterController controller = new WorkcenterController(mock.Object); jsonResult = controller.Edit(id) as JsonResult; var actual = jsonResult.Data.GetType(); Assert.IsTrue(expected == actual); }
public void EditPostAction_RouteResult_ActionIsIndex() { // Arrange string expected = "Index"; EditGetAction_Arrange(); WorkcenterController controller = new WorkcenterController(mock.Object); // Act RedirectToRouteResult result = controller.Edit(workcenterDto) as RedirectToRouteResult; var actual = result.RouteValues["action"]; // Assert Assert.IsNotNull(result); Assert.AreEqual(expected, actual); }