Пример #1
0
        public string CompileRuleset(RuleSet ruleset, List<RuleObject> rulesObject)
        {
            Rule rule = ruleset.Rules.ElementAt(0).Clone();
            RuleStatementAction action = (RuleStatementAction)rule.
                ThenActions.ElementAt(0).Clone();

            ruleset.Rules.Clear();

            foreach (RuleObject ruleObj in rulesObject)
            {
                Rule thisRule = SetUpRule(rule, action, ruleObj);
                ruleset.Rules.Add(thisRule);
            }

            RulesetDetails rulesetDetails = new RulesetDetails();
            return SerializeRuleSet(ruleset);
        }
Пример #2
0
        public void InitializeTest()
        {
            mockRuleService = new Mock<IRuleService>();
            testRuleDetailsOne = new RulesetDetails();
            testRuleDetailsTwo = new RulesetDetails();
            testRuleDetailsThree = new RulesetDetails();
            mockRuleSets = new List<RuleSet>();

            mockRuleSets.Add(new RuleSet()
            {
                Name = "Test RuleSet 1",
                RuleSet1 = "First Test",
                RuleSetId = 1,
                Status = 1,
            });

            mockRuleSets.Add(new RuleSet()
            {
                Name = "Test RuleSet 2",
                RuleSet1 = "Second Test",
                RuleSetId = 2,
                Status = 1,
            });

            mockRuleSets.Add(new RuleSet()
            {
                Name = "Test RuleSet 3",
                RuleSet1 = "Third Test",
                RuleSetId = 3,
                Status = 1,
            });

            testRuleDetailsOne.rulesetWrapper = mockRuleSets[0];
            testRuleDetailsTwo.rulesetWrapper = mockRuleSets[1];
            testRuleDetailsThree.rulesetWrapper = mockRuleSets[2];
        }
Пример #3
0
        public void SetUp()
        {
            ruleService = new RuleService();
            rulesetWrapper = new CardShop.Models.RuleSet();
            rulesets = new List<CardShop.Models.RuleSet>();
            ruleset = new System.Workflow.Activities.Rules.RuleSet();
            ruleObject = new RuleObject();
            ruleObjects = new List<RuleObject>();
            rulesetDetails = new RulesetDetails();

            mockRuleService = new Mock<IRuleService>();
            mockContext = new Mock<IPracticeGDVPDao>();
            mockDbSet = new Mock<IDbSet<CardShop.Models.RuleSet>>();

            ruleService.dbContext = mockContext.Object;
        }
Пример #4
0
 public ActionResult Create(RulesetDetails rulesetDetails)
 {
     //This needs some form of confirmation
     ruleService.Create(rulesetDetails.rulesetWrapper);
     return RedirectToAction("Index");
 }
Пример #5
0
 public ActionResult Edit(RulesetDetails rulesetDetails)
 {
     ruleService.Edit(rulesetDetails.rulesetWrapper);
     return RedirectToAction("Index");
 }