예제 #1
0
        public void CanSearchOnePolicy(string name, bool expectedResults)
        {
            PolicyGrinder grinder = PolicyGrinderFactory.Synthesize();
            Policy        policy  = new Policy();

            policy.Name = name;
            PolicyResponse response = grinder.GetOnePolicy(policy);

            Assert.AreEqual(expectedResults, response.Success);
        }
        public ActionResult Policy(string id, string reference)
        {
            PolicyGrinder grinder   = PolicyGrinderFactory.Synthesize();
            Policy        newPolicy = new Policy();

            if (reference != null && reference == "categories")
            {
                ViewBag.LinkText       = "Return to View Policies";
                ViewBag.LinkAction     = "Categories";
                ViewBag.LinkController = "Admin";
            }
            else
            {
                ViewBag.LinkText       = "Return to Manage Policies";
                ViewBag.LinkAction     = "ManagePolicies";
                ViewBag.LinkController = "Admin";
            }
            newPolicy.Name = id;
            var policySearched = grinder.GetOnePolicy(newPolicy);

            return(View(policySearched));
        }