Ejemplo n.º 1
0
        public void EditValidModel()
        {
            var controller = new RolesController(new UserRoleBLL(new RoleServiceStub()));
            var role = new Role { RoleId = 1, RoleStringId = "C", RoleName = "Customer" };

            var actionResult = (RedirectToRouteResult)controller.Edit(role);
            Assert.AreEqual(actionResult.RouteName, "");
            Assert.IsTrue(actionResult.RouteValues.Values.Count == 1);
            Assert.AreEqual(actionResult.RouteValues.Values.First(), "Index");
        }
Ejemplo n.º 2
0
 public void EditGetViewValidId()
 {
     var controller = new RolesController(new UserRoleBLL(new RoleServiceStub()));
     var actionResult = (ViewResult)controller.Edit(1);
     Assert.AreEqual(actionResult.ViewName, "");
 }
Ejemplo n.º 3
0
        public void EditInvalidModel()
        {
            var controller = new RolesController(new UserRoleBLL(new RoleServiceStub()));
            var role = new Role();
            controller.ViewData.ModelState.AddModelError("RoleName", "");

            var actionResult = (ViewResult)controller.Edit(role);
            Assert.AreEqual(actionResult.ViewName, "");
        }
Ejemplo n.º 4
0
 public void EditGetViewInvalidId()
 {
     var controller = new RolesController(new UserRoleBLL(new RoleServiceStub()));
     var actionResult = (HttpNotFoundResult)controller.Edit(99);
     Assert.AreEqual(actionResult.StatusCode, 404);
 }