Пример #1
0
        public List <ArticulateEvaluator> ArticulateTestCase(ActivityTest test, int caseId, bool removeConvention, bool verbose)
        {
            List <ArticulateEvaluator> toReturn = new List <ArticulateEvaluator>();


            Case toArticulate = test.TestCases.FirstOrDefault(c => c.Id == caseId);

            toArticulate.Rules.ForEach(r =>
            {
                toReturn.Add(this.ArticulateEvaluator(r));
            });



            return(toReturn);
        }
Пример #2
0
        public List <ActivityTest> AcvityLint()
        {
            //make sure logictest was run
            var runLogicTests = this.LogicLint();


            /*for each root activity
             * need to get all equations involved
             * merge those test cases from top down without adding duplicates on EvaluatorID|context
             * example
             * if (a & b) -> X ->
             *    if !a & c -> y
             * result should be
             *  a, b, c (not a,!a,b,c)
             *
             */
            List <ActivityTest> toReturn = new List <ActivityTest>();



            string   rootName     = this.WorkflowManager.RootActivityId;
            Activity rootActivity = this.WorkflowManager.GetActivity(rootName);


            List <string> equationsWithCases = new List <string>();

            equationsWithCases = (from z in logicTests where z.TestCases.Count > 0 select z.EquationId).ToList();
            List <List <string> > cases = new List <List <string> >();

            foreach (string eq in equationsWithCases)
            {
                LogicTest             eqTest  = logicTests.First(g => g.EquationId == eq);
                List <List <string> > thisRun = new List <List <string> >();
                foreach (Case testCase in eqTest.TestCases)
                {
                    List <string> ruleCases = (from g in testCase.Rules select g.ToString()).ToList();
                    if (cases.Count == 0)
                    {
                        thisRun.Add(ruleCases);
                    }
                    else
                    {
                        foreach (List <string> lastRun in cases)
                        {
                            List <string> copyOfLastRun = (from s in lastRun select s).ToList();
                            //whittle out any dupes where id and context match.
                            List <string> justIdsFromLastRun = (from s in lastRun select((Rule)s).RuleIdWithContext).ToList();

                            List <string> deduped = (from s in ruleCases where !justIdsFromLastRun.Contains(((Rule)s).RuleIdWithContext) select s).ToList();

                            List <string> thisCase = copyOfLastRun;

                            if (deduped.Count > 0)
                            {
                                thisCase = copyOfLastRun.Union(deduped).ToList();
                                thisRun.Add(thisCase);
                            }
                        }
                    }
                }
                if (thisRun.Count > 0)
                {
                    cases = thisRun;
                }
            }

            List <Case> testCases = (from z in cases select new Case((from x in z select(Rule) x).ToList())).ToList();

            ActivityTest toAdd = new ActivityTest(rootName)
            {
                TestCases = testCases
            };

            toReturn.Add(toAdd);



            int counter = 0;

            toReturn.ForEach(t =>
            {
                t.TestCases.ForEach(c => { counter++; c.Id = counter; });
            });

            return(toReturn);
        }
Пример #3
0
        public List <ArticulateEvaluator> ArticulateTestCase(ActivityTest test, int testCaseId)
        {
            Articulator articulator = new Articulator(this.workflow, this.configuration);

            return(articulator.ArticulateTestCase(test, testCaseId, false, false));
        }