コード例 #1
0
        internal void CalculateHitAndRuns(List <ActivityTest> tests)
        {
            tests.ForEach(t =>
            {
                t.TestCases.ForEach(tc =>
                {
                    foreach (LogicDefine.Evaluator ev in this.workflowManager.WorkFlow.Evaluators)
                    {
                        HitAndRun toAdd = new HitAndRun(ev.Id);

                        toAdd.HitCount = (from u in tc.Trace
                                          where u.Node.Value.ProcessId == ev.Id &&
                                          (u.Node.Value.Status == ActivityStatusOptions.Rule_Evaluating ||
                                           u.Node.Value.Status == ActivityStatusOptions.Rule_NotRun_Cached ||
                                           u.Node.Value.Status == ActivityStatusOptions.Rule_NotRun_ShortCircuit
                                          ) select u).Count();
                        toAdd.RunCount = (from u in tc.Trace
                                          where u.Node.Value.ProcessId == ev.Id &&
                                          (u.Node.Value.Status == ActivityStatusOptions.Rule_Evaluating
                                          )
                                          select u).Count();

                        tc.HitAndRuns.Add(toAdd);
                    }
                    foreach (WorkDefine.ActionDefinition ad in this.workflowManager.WorkFlow.Actions)
                    {
                        HitAndRun toAdd = new HitAndRun(ad.Id);

                        toAdd.HitCount = (from u in tc.Trace
                                          where u.Node.Value.ProcessId == ad.Id &&
                                          (u.Node.Value.Status == ActivityStatusOptions.Action_Running
                                          )
                                          select u).Count();
                        toAdd.RunCount = (from u in tc.Trace
                                          where u.Node.Value.ProcessId == ad.Id &&
                                          (u.Node.Value.Status == ActivityStatusOptions.Action_Running
                                          )
                                          select u).Count();

                        tc.HitAndRuns.Add(toAdd);
                    }
                });
            });
        }
コード例 #2
0
        internal List <HitAndRun> AggregateHitAndRuns(List <ActivityTest> tests)
        {
            List <HitAndRun> toReturn = new List <HitAndRun>();

            tests.ForEach(t =>
            {
                t.TestCases.ForEach(tc =>
                {
                    foreach (LogicDefine.Evaluator ev in this.workflowManager.WorkFlow.Evaluators)
                    {
                        HitAndRun toAdd = toReturn.FirstOrDefault(i => i.Id == ev.Id);
                        if (toAdd == null)
                        {
                            toAdd = new HitAndRun(ev.Id);
                            toReturn.Add(toAdd);
                        }
                        HitAndRun fromTC = tc.HitAndRuns.First(h => h.Id == ev.Id);
                        toAdd.HitCount  += fromTC.HitCount;
                        toAdd.RunCount  += fromTC.RunCount;
                    }
                    foreach (WorkDefine.ActionDefinition ad in this.workflowManager.WorkFlow.Actions)
                    {
                        HitAndRun toAdd = toReturn.FirstOrDefault(i => i.Id == ad.Id);
                        if (toAdd == null)
                        {
                            toAdd = new HitAndRun(ad.Id);
                            toReturn.Add(toAdd);
                        }
                        HitAndRun fromTC = tc.HitAndRuns.First(h => h.Id == ad.Id);
                        toAdd.HitCount  += fromTC.HitCount;
                        toAdd.RunCount  += fromTC.RunCount;
                    }
                });
            });

            return(toReturn);
        }