public ActionResult AddPolicy(Policy policy) { if (ModelState.IsValid) { PolicyGrinder grinder = PolicyGrinderFactory.Synthesize(); PolicyResponse response = grinder.AddNewPolicy(policy); return(RedirectToAction("ManagePolicies", response)); } return(View(policy)); }
public void CanAddPolicy(string name, string content, bool expectedResult) { PolicyGrinder grinder = PolicyGrinderFactory.Synthesize(); Policy policy = new Policy(); policy.Name = name; policy.Content = content; PolicyResponse response = grinder.AddNewPolicy(policy); Assert.AreEqual(expectedResult, response.Success); }