~a-schlapsi/nunit-3.0/linux-makefile

« back to all changes in this revision

Viewing changes to src/framework/Internal/EventQueue.cs

  • Committer: Andreas Schlapsi
  • Date: 2010-01-23 23:14:05 UTC
  • mfrom: (18.1.137 work)
  • Revision ID: a.schlapsi@gmx.at-20100123231405-17deqoh18nfnbq1j
Merged with trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
using System;
25
25
using System.Collections;
26
26
using System.Threading;
 
27
using NUnit.Framework.Api;
27
28
 
28
 
namespace NUnit.Core
 
29
namespace NUnit.Framework.Internal
29
30
{
30
31
        #region Individual Event Classes
31
32
 
32
33
        /// <summary>
33
34
        /// NUnit.Core.Event is the abstract base for all stored events.
34
35
        /// An Event is the stored representation of a call to the 
35
 
        /// EventListener interface and is used to record such calls
 
36
        /// ITestListener interface and is used to record such calls
36
37
        /// or to queue them for forwarding on another thread or at
37
38
        /// a later time.
38
39
        /// </summary>
41
42
                abstract public void Send( ITestListener listener );
42
43
        }
43
44
 
44
 
        public class RunStartedEvent : Event
45
 
        {
46
 
                TestName testName;
47
 
                int testCount;
48
 
 
49
 
                public RunStartedEvent( TestName testName, int testCount )
50
 
                {
51
 
                        this.testName = testName;
52
 
                        this.testCount = testCount;
53
 
                }
54
 
 
55
 
                public override void Send( ITestListener listener )
56
 
                {
57
 
                        listener.RunStarted(testName, testCount);
58
 
                }
59
 
        }
60
 
 
61
 
        public class RunFinishedEvent : Event
62
 
        {
63
 
                TestResult result;
64
 
                Exception exception;
65
 
 
66
 
                public RunFinishedEvent( TestResult result )
67
 
                {
68
 
                        this.result = result;
69
 
                }
70
 
 
71
 
                public RunFinishedEvent( Exception exception )
72
 
                {
73
 
                        this.exception = exception;
74
 
                }
75
 
 
76
 
                public override void Send( ITestListener listener )
77
 
                {
78
 
                        if ( this.exception != null )
79
 
                                listener.RunFinished( this.exception );
80
 
                        else
81
 
                                listener.RunFinished( this.result );
82
 
                }
83
 
        }
84
 
 
85
45
        public class TestStartedEvent : Event
86
46
        {
87
 
                TestName testName;
 
47
                ITest test;
88
48
 
89
 
                public TestStartedEvent( TestName testName )
 
49
                public TestStartedEvent( ITest test )
90
50
                {
91
 
                        this.testName = testName;
 
51
                        this.test = test;
92
52
                }
93
53
 
94
54
                public override void Send( ITestListener listener )
95
55
                {
96
 
                        listener.TestStarted( this.testName );
 
56
                        listener.TestStarted( this.test );
97
57
                }
98
58
        }
99
59
                        
100
60
        public class TestFinishedEvent : Event
101
61
        {
102
 
                TestResult result;
 
62
                ITestResult result;
103
63
 
104
 
                public TestFinishedEvent( TestResult result )
 
64
                public TestFinishedEvent( ITestResult result )
105
65
                {
106
66
                        this.result = result;
107
67
                }
112
72
                }
113
73
        }
114
74
 
115
 
        public class SuiteStartedEvent : Event
116
 
        {
117
 
                TestName suiteName;
118
 
 
119
 
                public SuiteStartedEvent( TestName suiteName )
120
 
                {
121
 
                        this.suiteName = suiteName;
122
 
                }
123
 
 
124
 
                public override void Send( ITestListener listener )
125
 
                {
126
 
                        listener.SuiteStarted( this.suiteName );
127
 
                }
128
 
        }
129
 
 
130
 
        public class SuiteFinishedEvent : Event
131
 
        {
132
 
                TestResult result;
133
 
 
134
 
                public SuiteFinishedEvent( TestResult result )
135
 
                {
136
 
                        this.result = result;
137
 
                }
138
 
 
139
 
                public override void Send( ITestListener listener )
140
 
                {
141
 
                        listener.SuiteFinished( this.result );
142
 
                }
143
 
        }
144
 
 
145
 
        public class UnhandledExceptionEvent : Event
146
 
        {
147
 
                Exception exception;
148
 
 
149
 
                public UnhandledExceptionEvent( Exception exception )
150
 
                {
151
 
                        this.exception = exception;
152
 
                }
153
 
 
154
 
                public override void Send( ITestListener listener )
155
 
                {
156
 
                        listener.UnhandledException( this.exception );
157
 
                }
158
 
        }
159
 
 
160
75
        public class OutputEvent : Event
161
76
        {
162
77
                TestOutput output;