예제 #1
0
 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, "");
 }
예제 #2
0
        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");
        }
예제 #3
0
 public void CreateGetView()
 {
     var controller = new RolesController(new UserRoleBLL(new RoleServiceStub()));
     var actionResult = (ViewResult)controller.Create();
     Assert.AreEqual(actionResult.ViewName, "");
 }