public void EditViewTinh() { TINHsController tinhController = new TINHsController(); TINH tinh = new TINH { MaTinh = "0002", TenTinh = "Hồ Chí Minh" }; tinhController.Create(tinh); ViewResult result = tinhController.Edit("0002") as ViewResult; Assert.IsNotNull(result); string expected = ""; string actual = result.ViewName; Assert.AreEqual(expected, actual); }
public void EditPostTinh() { TINHsController tinhController = new TINHsController(); TINH tinh = new TINH { MaTinh = "0002", TenTinh = "Hồ Chí Minh" }; tinhController.Create(tinh); tinh.TenTinh = "TP Hồ Chí Minh"; RedirectToRouteResult result = tinhController.Edit(tinh) as RedirectToRouteResult; Assert.IsNotNull(result); string expected = "Index"; string actual = result.RouteValues["action"].ToString(); Assert.AreEqual(expected, actual); }