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");
        }
 public void EditGetViewValidId()
 {
     var controller = new RolesController(new UserRoleBLL(new RoleServiceStub()));
     var actionResult = (ViewResult)controller.Edit(1);
     Assert.AreEqual(actionResult.ViewName, "");
 }
        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, "");
        }
 public void EditGetViewInvalidId()
 {
     var controller = new RolesController(new UserRoleBLL(new RoleServiceStub()));
     var actionResult = (HttpNotFoundResult)controller.Edit(99);
     Assert.AreEqual(actionResult.StatusCode, 404);
 }