1
// ****************************************************************
2
// This is free software licensed under the NUnit license. You
3
// may obtain a copy of the license as well as information regarding
4
// copyright ownership at http://nunit.org.
5
// ****************************************************************
15
/// Constant definitions for the mock-assembly dll.
17
public class MockAssembly
19
#if CLR_2_0 || CLR_4_0
20
public static int Classes = 9;
22
public static int Classes = 8;
24
public static int NamespaceSuites = 6; // assembly, NUnit, Tests, Assemblies, Singletons, TestAssembly
26
public static int Tests = MockTestFixture.Tests
27
+ Singletons.OneTestCase.Tests
28
+ TestAssembly.MockTestFixture.Tests
29
+ IgnoredFixture.Tests
30
+ ExplicitFixture.Tests
32
+ FixtureWithTestCases.Tests
33
+ ParameterizedFixture.Tests
34
+ GenericFixtureConstants.Tests;
36
public static int Suites = MockTestFixture.Suites
37
+ Singletons.OneTestCase.Suites
38
+ TestAssembly.MockTestFixture.Suites
39
+ IgnoredFixture.Suites
40
+ ExplicitFixture.Suites
42
+ FixtureWithTestCases.Suites
43
+ ParameterizedFixture.Suites
44
+ GenericFixtureConstants.Suites
47
public static readonly int Nodes = Tests + Suites;
49
public static int ExplicitFixtures = 1;
50
public static int SuitesRun = Suites - ExplicitFixtures;
52
public static int Ignored = MockTestFixture.Ignored + IgnoredFixture.Tests;
53
public static int Explicit = MockTestFixture.Explicit + ExplicitFixture.Tests;
54
public static int NotRunnable = MockTestFixture.NotRunnable + BadFixture.Tests;
55
public static int NotRun = Ignored + Explicit + NotRunnable;
56
public static int TestsRun = Tests - NotRun;
57
public static int ResultCount = Tests - Explicit;
59
public static int Errors = MockTestFixture.Errors;
60
public static int Failures = MockTestFixture.Failures;
61
public static int ErrorsAndFailures = Errors + Failures;
63
public static int Categories = MockTestFixture.Categories;
65
public static string AssemblyPath = AssemblyHelper.GetAssemblyPath(typeof(MockAssembly));
68
public class MockSuite
71
public static TestSuite Suite
75
return new TestSuite( "MockSuite" );
80
[TestFixture(Description="Fake Test Fixture")]
81
[Category("FixtureCategory")]
82
public class MockTestFixture
84
public static readonly int Tests = 11;
85
public static readonly int Suites = 1;
87
public static readonly int Ignored = 1;
88
public static readonly int Explicit = 1;
89
public static readonly int NotRunnable = 2;
90
public static readonly int NotRun = Ignored + Explicit + NotRunnable;
91
public static readonly int TestsRun = Tests - NotRun;
92
public static readonly int ResultCount = Tests - Explicit;
94
public static readonly int Failures = 1;
95
public static readonly int Errors = 1;
96
public static readonly int ErrorsAndFailures = Errors + Failures;
98
public static readonly int Categories = 5;
99
public static readonly int MockCategoryTests = 2;
101
[Test(Description="Mock Test #1")]
102
public void MockTest1()
106
[Category("MockCategory")]
107
[Property("Severity","Critical")]
108
[Description("This is a really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really long description")]
109
public void MockTest2()
113
[Category("MockCategory")]
114
[Category("AnotherCategory")]
115
public void MockTest3()
116
{ Assert.Pass("Succeeded!"); }
119
protected static void MockTest5()
123
public void FailingTest()
125
Assert.Fail("Intentional failure");
128
[Test, Property("TargetMethod", "SomeClassName"), Property("Size", 5), /*Property("TargetType", typeof( System.Threading.Thread ))*/]
129
public void TestWithManyProperties()
133
[Ignore("ignoring this test method for now")]
135
public void MockTest4()
139
[Category( "Special" )]
140
public void ExplicitlyRunTest()
144
public void NotRunnableTest( int a, int b)
149
public void InconclusiveTest()
151
Assert.Inconclusive("No valid data");
155
public void TestWithException()
157
MethodThrowsException();
160
private void MethodThrowsException()
162
throw new ApplicationException("Intentional Exception");
170
public class OneTestCase
172
public static readonly int Tests = 1;
173
public static readonly int Suites = 1;
176
public virtual void TestCase()
181
namespace TestAssembly
184
public class MockTestFixture
186
public static readonly int Tests = 1;
187
public static readonly int Suites = 1;
196
[TestFixture, Ignore]
197
public class IgnoredFixture
199
public static readonly int Tests = 3;
200
public static readonly int Suites = 1;
203
public void Test1() { }
206
public void Test2() { }
209
public void Test3() { }
212
[TestFixture,Explicit]
213
public class ExplicitFixture
215
public static readonly int Tests = 2;
216
public static readonly int Suites = 1;
217
public static readonly int Nodes = Tests + Suites;
220
public void Test1() { }
223
public void Test2() { }
227
public class BadFixture
229
public static readonly int Tests = 1;
230
public static readonly int Suites = 1;
232
public BadFixture(int val) { }
235
public void SomeTest() { }
239
public class FixtureWithTestCases
241
#if CLR_2_0 || CLR_4_0
242
public static readonly int Tests = 4;
243
public static readonly int Suites = 3;
245
public static readonly int Tests = 2;
246
public static readonly int Suites = 2;
249
[TestCase(2, 2, Result=4)]
250
[TestCase(9, 11, Result=20)]
251
public int MethodWithParameters(int x, int y)
256
#if CLR_2_0 || CLR_4_0
258
[TestCase(9.2, 11.7)]
259
public void GenericMethod<T>(T x, T y)
267
public class ParameterizedFixture
269
public static readonly int Tests = 4;
270
public static readonly int Suites = 3;
272
public ParameterizedFixture(int num) { }
275
public void Test1() { }
278
public void Test2() { }
281
public class GenericFixtureConstants
283
#if CLR_2_0 || CLR_4_0
284
public static readonly int Tests = 4;
285
public static readonly int Suites = 3;
287
public static readonly int Tests = 0;
288
public static readonly int Suites = 0;
292
#if CLR_2_0 || CLR_4_0
295
public class GenericFixture<T>
297
public GenericFixture(T num){ }
300
public void Test1() { }
303
public void Test2() { }
1
// ****************************************************************
2
// This is free software licensed under the NUnit license. You
3
// may obtain a copy of the license as well as information regarding
4
// copyright ownership at http://nunit.org.
5
// ****************************************************************
15
/// Constant definitions for the mock-assembly dll.
17
public class MockAssembly
19
#if CLR_2_0 || CLR_4_0
20
public static int Classes = 9;
22
public static int Classes = 8;
24
public static int NamespaceSuites = 6; // assembly, NUnit, Tests, Assemblies, Singletons, TestAssembly
26
public static int Tests = MockTestFixture.Tests
27
+ Singletons.OneTestCase.Tests
28
+ TestAssembly.MockTestFixture.Tests
29
+ IgnoredFixture.Tests
30
+ ExplicitFixture.Tests
32
+ FixtureWithTestCases.Tests
33
+ ParameterizedFixture.Tests
34
+ GenericFixtureConstants.Tests;
36
public static int Suites = MockTestFixture.Suites
37
+ Singletons.OneTestCase.Suites
38
+ TestAssembly.MockTestFixture.Suites
39
+ IgnoredFixture.Suites
40
+ ExplicitFixture.Suites
42
+ FixtureWithTestCases.Suites
43
+ ParameterizedFixture.Suites
44
+ GenericFixtureConstants.Suites
47
public static readonly int Nodes = Tests + Suites;
49
public static int ExplicitFixtures = 1;
50
public static int SuitesRun = Suites - ExplicitFixtures;
52
public static int Ignored = MockTestFixture.Ignored + IgnoredFixture.Tests;
53
public static int Explicit = MockTestFixture.Explicit + ExplicitFixture.Tests;
54
public static int NotRunnable = MockTestFixture.NotRunnable + BadFixture.Tests;
55
public static int NotRun = Ignored + Explicit + NotRunnable;
56
public static int TestsRun = Tests - NotRun;
57
public static int ResultCount = Tests - Explicit;
59
public static int Errors = MockTestFixture.Errors;
60
public static int Failures = MockTestFixture.Failures;
62
public static int Categories = MockTestFixture.Categories;
64
public static string AssemblyPath = AssemblyHelper.GetAssemblyPath(typeof(MockAssembly));
67
public class MockSuite
70
public static TestSuite Suite
74
return new TestSuite( "MockSuite" );
79
[TestFixture(Description="Fake Test Fixture")]
80
[Category("FixtureCategory")]
81
public class MockTestFixture
83
public static readonly int Tests = 11;
84
public static readonly int Suites = 1;
86
public static readonly int Ignored = 1;
87
public static readonly int Explicit = 1;
88
public static readonly int NotRunnable = 2;
89
public static readonly int NotRun = Ignored + Explicit + NotRunnable;
90
public static readonly int TestsRun = Tests - NotRun;
91
public static readonly int ResultCount = Tests - Explicit;
93
public static readonly int Failures = 1;
94
public static readonly int Errors = 1;
96
public static readonly int Categories = 5;
97
public static readonly int MockCategoryTests = 2;
99
[Test(Description="Mock Test #1")]
100
public void MockTest1()
104
[Category("MockCategory")]
105
[Property("Severity","Critical")]
106
[Description("This is a really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really long description")]
107
public void MockTest2()
111
[Category("MockCategory")]
112
[Category("AnotherCategory")]
113
public void MockTest3()
114
{ Assert.Pass("Succeeded!"); }
117
protected static void MockTest5()
121
public void FailingTest()
123
Assert.Fail("Intentional failure");
126
[Test, Property("TargetMethod", "SomeClassName"), Property("Size", 5), /*Property("TargetType", typeof( System.Threading.Thread ))*/]
127
public void TestWithManyProperties()
131
[Ignore("ignoring this test method for now")]
133
public void MockTest4()
137
[Category( "Special" )]
138
public void ExplicitlyRunTest()
142
public void NotRunnableTest( int a, int b)
147
public void InconclusiveTest()
149
Assert.Inconclusive("No valid data");
153
public void TestWithException()
155
MethodThrowsException();
158
private void MethodThrowsException()
160
throw new ApplicationException("Intentional Exception");
168
public class OneTestCase
170
public static readonly int Tests = 1;
171
public static readonly int Suites = 1;
174
public virtual void TestCase()
179
namespace TestAssembly
182
public class MockTestFixture
184
public static readonly int Tests = 1;
185
public static readonly int Suites = 1;
194
[TestFixture, Ignore]
195
public class IgnoredFixture
197
public static readonly int Tests = 3;
198
public static readonly int Suites = 1;
201
public void Test1() { }
204
public void Test2() { }
207
public void Test3() { }
210
[TestFixture,Explicit]
211
public class ExplicitFixture
213
public static readonly int Tests = 2;
214
public static readonly int Suites = 1;
215
public static readonly int Nodes = Tests + Suites;
218
public void Test1() { }
221
public void Test2() { }
225
public class BadFixture
227
public static readonly int Tests = 1;
228
public static readonly int Suites = 1;
230
public BadFixture(int val) { }
233
public void SomeTest() { }
237
public class FixtureWithTestCases
239
#if CLR_2_0 || CLR_4_0
240
public static readonly int Tests = 4;
241
public static readonly int Suites = 3;
243
public static readonly int Tests = 2;
244
public static readonly int Suites = 2;
247
[TestCase(2, 2, Result=4)]
248
[TestCase(9, 11, Result=20)]
249
public int MethodWithParameters(int x, int y)
254
#if CLR_2_0 || CLR_4_0
256
[TestCase(9.2, 11.7)]
257
public void GenericMethod<T>(T x, T y)
265
public class ParameterizedFixture
267
public static readonly int Tests = 4;
268
public static readonly int Suites = 3;
270
public ParameterizedFixture(int num) { }
273
public void Test1() { }
276
public void Test2() { }
279
public class GenericFixtureConstants
281
#if CLR_2_0 || CLR_4_0
282
public static readonly int Tests = 4;
283
public static readonly int Suites = 3;
285
public static readonly int Tests = 0;
286
public static readonly int Suites = 0;
290
#if CLR_2_0 || CLR_4_0
293
public class GenericFixture<T>
295
public GenericFixture(T num){ }
298
public void Test1() { }
301
public void Test2() { }