public void CreateTest() { var result = _controller.Create() as ViewResult; Assert.AreEqual("Create", result.ViewName); Project project = new Project { ProjectName="UnitTest", Discription = "Test And Test" }; var rr = _controller.Create(project) as RedirectToRouteResult; Assert.AreEqual(string.Empty, rr.RouteName); }
public void EditTest() { long? num = null; var result = _controller.Edit(num) as HttpStatusCodeResult; Assert.AreEqual( (int) HttpStatusCode.BadRequest , result.StatusCode); result = _controller.Edit(long.MaxValue) as HttpNotFoundResult; Assert.AreEqual((int)HttpStatusCode.NotFound, result.StatusCode); ViewResult vr = _controller.Edit(1) as ViewResult; if (vr != null) Assert.AreEqual("Edit", vr.ViewName); Project project = new Project { ProjectId = 1, ProjectName = "UnitTest", Discription = "Test And Test" }; var rr = _controller.Edit(project) as RedirectToRouteResult; Assert.AreEqual(string.Empty, rr.RouteName); }