public ActionResult ViewPolicies(int CategoryId) { PolicyListVM vm = new PolicyListVM(); vm.Categories = _manager.GetAllCategories().ToList(); vm.Policies = _manager.GetAllPolicies().Where(p => p.PolicyCategory == CategoryId).ToList(); return(View(vm)); }
public void PCManagerLoadsPolicies() { PCManager manager = PCMFactory.Create(); List <Policy> policies = manager.GetAllPolicies().ToList(); Assert.AreEqual(4, policies.Count); }
public void PCManagerCanDeletePolicy(int policyNumber) { PCManager manager = PCMFactory.Create(); manager.DeletePolicy(policyNumber); List <Policy> policies = manager.GetAllPolicies().ToList(); Assert.AreEqual(3, policies.Count); }
public void PCManagerCanAddPolicy(string policyName, int categoryNum, string policyContent) { PCManager manager = PCMFactory.Create(); Policy newPolicy = new Policy(); newPolicy.PolicyName = policyName; newPolicy.PolicyCategory = categoryNum; newPolicy.Content = policyContent; manager.AddPolicy(newPolicy); List <Policy> policies = manager.GetAllPolicies().ToList(); Assert.AreEqual(5, policies.Count); }