Exemplo n.º 1
0
        private List<RuleObject> SetUpRulesDisplay(ICollection<System.Workflow.Activities.Rules.Rule> rules)
        {
            List<RuleObject> rulesDisplay = new List<RuleObject>();

            foreach (System.Workflow.Activities.Rules.Rule rule in rules)
            {
                RuleObject ruleObj = new RuleObject(rule);
                rulesDisplay.Add(ruleObj);
            }

            return rulesDisplay;
        }
Exemplo n.º 2
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;
        }
Exemplo n.º 3
0
        private Rule SetUpRule(Rule rule, RuleStatementAction action, RuleObject ruleObj)
        {
            Rule thisRule = rule.Clone();
            thisRule.ThenActions.Clear();
            thisRule.ElseActions.Clear();

            thisRule.Name = ruleObj.Name;

            thisRule.Condition = SetRuleCondition((RuleExpressionCondition)thisRule.Condition, ruleObj.Condition);

            foreach (ActionObject actionObj in ruleObj.ThenActions)
            {
                RuleStatementAction thisAction = (RuleStatementAction)action.Clone();
                thisAction = SetRuleAction(thisAction, actionObj);
                thisRule.ThenActions.Add(thisAction);
            }

            foreach (ActionObject actionObj in ruleObj.ElseActions)
            {
                RuleStatementAction thisAction = (RuleStatementAction)action.Clone();
                thisAction = SetRuleAction(thisAction, actionObj);
                thisRule.ElseActions.Add(thisAction);
            }

            return thisRule;
        }