public void CreateWithInvalidModel() { var controller = new RolesController(new UserRoleBLL(new RoleServiceStub())); var role = new Role(); controller.ViewData.ModelState.AddModelError("RoleName", ""); var actionResult = (ViewResult)controller.Create(role); Assert.AreEqual(actionResult.ViewName, ""); }
public void CreateWithValidId() { var controller = new RolesController(new UserRoleBLL(new RoleServiceStub())); var role = new Role { RoleId = 1, RoleStringId = "C", RoleName = "Customer" }; var actionResult = (RedirectToRouteResult)controller.Create(role); Assert.AreEqual(actionResult.RouteName, ""); Assert.IsTrue(actionResult.RouteValues.Values.Count == 1); Assert.AreEqual(actionResult.RouteValues.Values.First(), "Index"); }
public void CreateGetView() { var controller = new RolesController(new UserRoleBLL(new RoleServiceStub())); var actionResult = (ViewResult)controller.Create(); Assert.AreEqual(actionResult.ViewName, ""); }