Beispiel #1
0
        /// <inheritdoc />
        protected override void Initialize()
        {
            var testCaseSteps = new GallioHashSet <string>();

            Events.AnnotationDiscovered += delegate(object sender, AnnotationDiscoveredEventArgs e)
            {
                LogAnnotation(e.Annotation);
            };

            Events.TestStepStarted += delegate(object sender, TestStepStartedEventArgs e)
            {
                if (e.TestStepRun.Step.IsTestCase)
                {
                    testCaseSteps.Add(e.TestStepRun.Step.Id);

                    LogTestCaseStarted(e);
                }
                else
                {
                    string parentId = e.TestStepRun.Step.ParentId;
                    if (parentId != null && testCaseSteps.Contains(parentId))
                    {
                        testCaseSteps.Add(e.TestStepRun.Step.Id);
                    }
                }
            };

            Events.TestStepFinished += delegate(object sender, TestStepFinishedEventArgs e)
            {
                if (e.TestStepRun.Step.IsTestCase)
                {
                    testCaseSteps.Remove(e.TestStepRun.Step.Id);

                    LogTestCaseFinished(e);
                }
                else
                {
                    if (!testCaseSteps.Contains(e.TestStepRun.Step.Id))
                    {
                        if (e.TestStepRun.Result.Outcome.Status != TestStatus.Passed &&
                            (e.TestStepRun.TestLog.GetStream(MarkupStreamNames.Warnings) != null ||
                             e.TestStepRun.TestLog.GetStream(MarkupStreamNames.Failures) != null))
                        {
                            LogNonTestCaseProblem(e);
                        }
                    }
                    else
                    {
                        testCaseSteps.Remove(e.TestStepRun.Step.Id);
                    }
                }
            };
        }
Beispiel #2
0
        private void Add(int hash)
        {
            if (one.Contains(hash))
            {
                one.Remove(hash);
                two.Add(hash);
            }
            else if (two.Contains(hash))
            {
                two.Remove(hash);
                more.Add(hash, 3);
            }
            else
            {
                int n;

                if (more.TryGetValue(hash, out n))
                {
                    more[hash] = 1 + n;
                }
                else
                {
                    one.Add(hash);
                }
            }
        }
Beispiel #3
0
        private void HandleTaskTerminated(object sender, TaskEventArgs e)
        {
            try
            {
                EventHandler <TaskEventArgs> cachedChain;
                lock (this)
                {
                    cachedChain = terminated;
                }

                EventHandlerPolicy.SafeInvoke(cachedChain, this, e);
            }
            finally
            {
                // Do this last to ensure that all event handlers have executed
                // before we remove the task from the list.  This helps to ensure
                // that JoinAll fully synchronizes with the task and with any
                // final event-based processing that needs to occur.
                lock (this)
                {
                    activeTasks.Remove(e.Task);
                }
            }
        }