nunit 2.5.0.9122 → 2.5.1.9189
Sign up to get free protection for your applications and to get access to all the features.
- data/docs/addinsDialog.html +1 -1
- data/docs/assertions.html +1 -1
- data/docs/attributes.html +58 -58
- data/docs/category.html +1 -1
- data/docs/collectionAssert.html +1 -1
- data/docs/collectionConstraints.html +1 -1
- data/docs/combinatorial.html +3 -3
- data/docs/comparisonAsserts.html +1 -1
- data/docs/comparisonConstraints.html +1 -1
- data/docs/compoundConstraints.html +1 -1
- data/docs/conditionAsserts.html +1 -1
- data/docs/conditionConstraints.html +1 -1
- data/docs/configEditor.html +1 -1
- data/docs/configFiles.html +1 -1
- data/docs/consoleCommandLine.html +11 -5
- data/docs/constraintModel.html +1 -1
- data/docs/contextMenu.html +1 -1
- data/docs/culture.html +1 -1
- data/docs/customConstraints.html +24 -24
- data/docs/datapoint.html +1 -1
- data/docs/datapointProviders.html +29 -5
- data/docs/delayedConstraint.html +1 -1
- data/docs/description.html +1 -1
- data/docs/directoryAssert.html +1 -1
- data/docs/equalConstraint.html +1 -1
- data/docs/equalityAsserts.html +1 -1
- data/docs/eventListeners.html +1 -1
- data/docs/exception.html +56 -56
- data/docs/exceptionAsserts.html +5 -5
- data/docs/explicit.html +1 -1
- data/docs/extensibility.html +1 -1
- data/docs/extensionTips.html +1 -1
- data/docs/fileAssert.html +1 -1
- data/docs/fixtureSetup.html +1 -1
- data/docs/fixtureTeardown.html +1 -1
- data/docs/getStarted.html +1 -1
- data/docs/guiCommandLine.html +1 -1
- data/docs/identityAsserts.html +1 -1
- data/docs/ignore.html +1 -1
- data/docs/img/generalSettings.jpg +0 -0
- data/docs/img/gui-screenshot.jpg +0 -0
- data/docs/img/gui-verify.jpg +0 -0
- data/docs/img/miniGui.jpg +0 -0
- data/docs/index.html +3 -3
- data/docs/installation.html +2 -2
- data/docs/license.html +3 -3
- data/docs/listMapper.html +1 -1
- data/docs/mainMenu.html +1 -1
- data/docs/maxtime.html +1 -1
- data/docs/multiAssembly.html +1 -1
- data/docs/nunit-console.html +1 -1
- data/docs/nunit-gui.html +1 -1
- data/docs/nunitAddins.html +1 -1
- data/docs/pairwise.html +1 -1
- data/docs/parameterizedTests.html +20 -1
- data/docs/pathConstraints.html +1 -1
- data/docs/platform.html +1 -1
- data/docs/pnunit.html +1 -1
- data/docs/projectEditor.html +1 -1
- data/docs/property.html +1 -1
- data/docs/propertyConstraint.html +1 -1
- data/docs/quickStart.html +1 -1
- data/docs/random.html +1 -1
- data/docs/range.html +1 -1
- data/docs/releaseNotes.html +824 -411
- data/docs/repeat.html +1 -1
- data/docs/requiredAddin.html +1 -1
- data/docs/requiresMTA.html +1 -1
- data/docs/requiresSTA.html +1 -1
- data/docs/requiresThread.html +1 -1
- data/docs/sameasConstraint.html +1 -1
- data/docs/samples.html +1 -1
- data/docs/sequential.html +1 -1
- data/docs/setCulture.html +1 -1
- data/docs/settingsDialog.html +7 -1
- data/docs/setup.html +1 -1
- data/docs/setupFixture.html +1 -1
- data/docs/stringAssert.html +1 -1
- data/docs/stringConstraints.html +154 -23
- data/docs/suite.html +1 -1
- data/docs/suiteBuilders.html +1 -1
- data/docs/teardown.html +1 -1
- data/docs/test.html +1 -1
- data/docs/testCase.html +56 -56
- data/docs/testCaseSource.html +24 -11
- data/docs/testDecorators.html +1 -1
- data/docs/testFixture.html +11 -11
- data/docs/testProperties.html +1 -1
- data/docs/testcaseBuilders.html +1 -1
- data/docs/testcaseProviders.html +28 -5
- data/docs/theory.html +1 -1
- data/docs/throwsConstraint.html +46 -17
- data/docs/timeout.html +1 -1
- data/docs/typeAsserts.html +1 -1
- data/docs/typeConstraints.html +1 -1
- data/docs/upgrade.html +1 -1
- data/docs/utilityAsserts.html +1 -1
- data/docs/valueSource.html +19 -10
- data/docs/values.html +3 -3
- data/docs/vsSupport.html +1 -1
- data/lib/net-1.1/framework/nunit.framework.dll +0 -0
- data/lib/net-1.1/framework/nunit.framework.xml +105 -19
- data/lib/net-1.1/framework/nunit.mocks.dll +0 -0
- data/lib/net-1.1/framework/pnunit.framework.dll +0 -0
- data/lib/net-1.1/lib/nunit-console-runner.dll +0 -0
- data/lib/net-1.1/lib/nunit.core.dll +0 -0
- data/lib/net-1.1/lib/nunit.core.interfaces.dll +0 -0
- data/lib/net-1.1/lib/nunit.fixtures.dll +0 -0
- data/lib/net-1.1/lib/nunit.util.dll +0 -0
- data/lib/net-1.1/nunit-agent.exe +0 -0
- data/lib/net-1.1/nunit-console.exe +0 -0
- data/lib/net-1.1/nunit.framework.dll +0 -0
- data/lib/net-1.1/pnunit-agent.exe +0 -0
- data/lib/net-1.1/pnunit-launcher.exe +0 -0
- data/lib/net-1.1/pnunit.framework.dll +0 -0
- data/lib/net-1.1/pnunit.tests.dll +0 -0
- data/lib/net-1.1/tests/loadtest-assembly.dll +0 -0
- data/lib/net-1.1/tests/mock-assembly.dll +0 -0
- data/lib/net-1.1/tests/nonamespace-assembly.dll +0 -0
- data/lib/net-1.1/tests/nunit-console.tests.dll +0 -0
- data/lib/net-1.1/tests/nunit.core.tests.dll +0 -0
- data/lib/net-1.1/tests/nunit.fixtures.tests.dll +0 -0
- data/lib/net-1.1/tests/nunit.framework.dll +0 -0
- data/lib/net-1.1/tests/nunit.framework.tests.dll +0 -0
- data/lib/net-1.1/tests/nunit.mocks.tests.dll +0 -0
- data/lib/net-1.1/tests/nunit.util.tests.dll +0 -0
- data/lib/net-1.1/tests/test-assembly.dll +0 -0
- data/lib/net-1.1/tests/test-utilities.dll +0 -0
- data/lib/net-1.1/tests/timing-tests.dll +0 -0
- data/lib/net-2.0/framework/nunit.framework.dll +0 -0
- data/lib/net-2.0/framework/nunit.framework.xml +113 -19
- data/lib/net-2.0/framework/nunit.mocks.dll +0 -0
- data/lib/net-2.0/framework/pnunit.framework.dll +0 -0
- data/lib/net-2.0/lib/Failure.png +0 -0
- data/lib/net-2.0/lib/Ignored.png +0 -0
- data/lib/net-2.0/lib/Inconclusive.png +0 -0
- data/lib/net-2.0/lib/Skipped.png +0 -0
- data/lib/net-2.0/lib/Success.png +0 -0
- data/lib/net-2.0/lib/nunit-console-runner.dll +0 -0
- data/lib/net-2.0/lib/nunit-gui-runner.dll +0 -0
- data/lib/net-2.0/lib/nunit.core.dll +0 -0
- data/lib/net-2.0/lib/nunit.core.interfaces.dll +0 -0
- data/lib/net-2.0/lib/nunit.fixtures.dll +0 -0
- data/lib/net-2.0/lib/nunit.uiexception.dll +0 -0
- data/lib/net-2.0/lib/nunit.uikit.dll +0 -0
- data/lib/net-2.0/lib/nunit.util.dll +0 -0
- data/lib/net-2.0/nunit-agent.exe +0 -0
- data/lib/net-2.0/nunit-console-x86.exe +0 -0
- data/lib/net-2.0/nunit-console.exe +0 -0
- data/lib/net-2.0/nunit-x86.exe +0 -0
- data/lib/net-2.0/nunit.exe +0 -0
- data/lib/net-2.0/nunit.framework.dll +0 -0
- data/lib/net-2.0/pnunit-agent.exe +0 -0
- data/lib/net-2.0/pnunit-launcher.exe +0 -0
- data/lib/net-2.0/pnunit.framework.dll +0 -0
- data/lib/net-2.0/pnunit.tests.dll +0 -0
- data/lib/net-2.0/tests/loadtest-assembly.dll +0 -0
- data/lib/net-2.0/tests/mock-assembly.dll +0 -0
- data/lib/net-2.0/tests/nonamespace-assembly.dll +0 -0
- data/lib/net-2.0/tests/nunit-console.tests.dll +0 -0
- data/lib/net-2.0/tests/nunit-gui.tests.dll +0 -0
- data/lib/net-2.0/tests/nunit.core.tests.dll +0 -0
- data/lib/net-2.0/tests/nunit.fixtures.tests.dll +0 -0
- data/lib/net-2.0/tests/nunit.framework.dll +0 -0
- data/lib/net-2.0/tests/nunit.framework.tests.dll +0 -0
- data/lib/net-2.0/tests/nunit.mocks.tests.dll +0 -0
- data/lib/net-2.0/tests/nunit.uiexception.tests.dll +0 -0
- data/lib/net-2.0/tests/nunit.uikit.tests.dll +0 -0
- data/lib/net-2.0/tests/nunit.util.tests.dll +0 -0
- data/lib/net-2.0/tests/test-assembly.dll +0 -0
- data/lib/net-2.0/tests/test-utilities.dll +0 -0
- data/lib/net-2.0/tests/timing-tests.dll +0 -0
- metadata +9 -8
- data/lib/net-2.0/lib/Failure.jpg +0 -0
- data/lib/net-2.0/lib/Gray.jpg +0 -0
- data/lib/net-2.0/lib/Ignored.jpg +0 -0
- data/lib/net-2.0/lib/Success.jpg +0 -0
data/docs/testCaseSource.html
CHANGED
@@ -40,7 +40,12 @@ TestCaseSourceAttribute(string sourceName);
|
|
40
40
|
</div>
|
41
41
|
|
42
42
|
<p>If <b>sourceType</b> is specified, it represents the class that provides
|
43
|
-
the test cases.
|
43
|
+
the test cases. It must have a default constructor.
|
44
|
+
|
45
|
+
<p>If <b>sourceType</b> is not specified, the class containing the test
|
46
|
+
method is used. NUnit will construct it using either the default constructor
|
47
|
+
or - if arguments are provided - the appropriate constructor for those
|
48
|
+
arguments.
|
44
49
|
|
45
50
|
<p>The <b>sourceName</b> argument represents the name of the source used
|
46
51
|
to provide test cases. It has the following characteristics:
|
@@ -53,7 +58,8 @@ to provide test cases. It has the following characteristics:
|
|
53
58
|
The rules for this are described in the next section.
|
54
59
|
</ul>
|
55
60
|
|
56
|
-
<
|
61
|
+
<h3>Constructing Test Cases</h3>
|
62
|
+
|
57
63
|
<p>In constructing tests, NUnit uses each item test case returned by
|
58
64
|
the enumerator as follows:
|
59
65
|
<ol>
|
@@ -126,7 +132,9 @@ and any public fields or properties with the following names are used:
|
|
126
132
|
<dd>Provides a name for the test. If not specified, a name is generated based on
|
127
133
|
the method name and the arguments provided
|
128
134
|
</dl>
|
129
|
-
|
135
|
+
|
136
|
+
<h3>TestCaseData Class</h3>
|
137
|
+
|
130
138
|
<p>Although any object with the required fields or properties may be used,
|
131
139
|
NUnit provides the <b>TestCaseData</b> class for this purpose. The following
|
132
140
|
example returns <b>TestCaseData</b> instances from a data source in
|
@@ -137,9 +145,9 @@ and any public fields or properties with the following names are used:
|
|
137
145
|
public class MyTests
|
138
146
|
{
|
139
147
|
[Test,TestCaseSource(typeof(MyFactoryClass),"TestCases")]
|
140
|
-
public void DivideTest(int n, int d
|
148
|
+
public void DivideTest(int n, int d)
|
141
149
|
{
|
142
|
-
|
150
|
+
return n/d;
|
143
151
|
}
|
144
152
|
|
145
153
|
...
|
@@ -199,14 +207,19 @@ and methods, which may be appended to an instance in any order.
|
|
199
207
|
<dd>Specifies a the Type or FullName of an exception that should be thrown by this invocation
|
200
208
|
</dl>
|
201
209
|
|
202
|
-
<
|
210
|
+
<h3>Note on Object Construction</h3>
|
211
|
+
|
203
212
|
<p>NUnit locates the test cases at the time the tests are loaded, creates
|
204
213
|
instances of each class with non-static sources and builds a list of
|
205
214
|
tests to be executed. Each source object is only created once at this
|
206
|
-
time and is destroyed after all tests are loaded.
|
207
|
-
|
208
|
-
|
209
|
-
using
|
215
|
+
time and is destroyed after all tests are loaded.
|
216
|
+
|
217
|
+
<p>If the data source is in the test fixture itself, the object is created
|
218
|
+
using the appropriate constructor for the fixture parameters provided, or
|
219
|
+
the default constructor if no parameters were specified. Since this object
|
220
|
+
is destroyed before the tests are run, no communication is possible between
|
221
|
+
these two phases - or between different runs - except through the parameters
|
222
|
+
themselves.
|
210
223
|
|
211
224
|
|
212
225
|
|
@@ -215,7 +228,7 @@ using non-static members of the class.
|
|
215
228
|
<!-- Submenu -->
|
216
229
|
<div id="subnav">
|
217
230
|
<ul>
|
218
|
-
<li><a href="index.html">NUnit 2.5</a></li>
|
231
|
+
<li><a href="index.html">NUnit 2.5.1</a></li>
|
219
232
|
<ul>
|
220
233
|
<li><a href="getStarted.html">Getting Started</a></li>
|
221
234
|
<li><a href="assertions.html">Assertions</a></li>
|
data/docs/testDecorators.html
CHANGED
@@ -72,7 +72,7 @@ standard values are defined for use if desired:
|
|
72
72
|
<!-- Submenu -->
|
73
73
|
<div id="subnav">
|
74
74
|
<ul>
|
75
|
-
<li><a href="index.html">NUnit 2.5</a></li>
|
75
|
+
<li><a href="index.html">NUnit 2.5.1</a></li>
|
76
76
|
<ul>
|
77
77
|
<li><a href="getStarted.html">Getting Started</a></li>
|
78
78
|
<li><a href="assertions.html">Assertions</a></li>
|
data/docs/testFixture.html
CHANGED
@@ -49,7 +49,7 @@
|
|
49
49
|
since NUnit may construct the object multiple times in the course of a session.</li>
|
50
50
|
|
51
51
|
<p>Beginning with NUnit 2.5, the <b>TestFixture</b> attribute is optional
|
52
|
-
for non-
|
52
|
+
for non-parameterized, non-generic fixtures, so long as the class contains
|
53
53
|
at least one method marked with the <b>Test</b>,
|
54
54
|
<b>TestCase</b> or <b>TestCaseSource</b> attribute.
|
55
55
|
|
@@ -232,7 +232,7 @@ public class IList_Tests<TList> where TList : IList, new()
|
|
232
232
|
<div class="code"><pre>
|
233
233
|
[TestFixture(typeof(double), typeof(int), 100.0, 42)]
|
234
234
|
[TestFixture(typeof(int) typeof(double), 42, 100.0)]
|
235
|
-
public class SpecifyBothSetsOfArgs
|
235
|
+
public class SpecifyBothSetsOfArgs<T1, T2>
|
236
236
|
{
|
237
237
|
T1 t1;
|
238
238
|
T2 t2;
|
@@ -246,8 +246,8 @@ public class SpecifyBothSetsOfArgs<T1, T2>
|
|
246
246
|
[TestCase(5, 7)]
|
247
247
|
public void TestMyArgTypes(T1 t1, T2 t2)
|
248
248
|
{
|
249
|
-
Assert.That(t1, Is.TypeOf
|
250
|
-
Assert.That(t2, Is.TypeOf
|
249
|
+
Assert.That(t1, Is.TypeOf<T1>());
|
250
|
+
Assert.That(t2, Is.TypeOf<T2>());
|
251
251
|
}
|
252
252
|
}</pre></div>
|
253
253
|
|
@@ -259,7 +259,7 @@ public class SpecifyBothSetsOfArgs<T1, T2>
|
|
259
259
|
<div class="code" style="width: 40em"><pre>
|
260
260
|
[TestFixture(100.0, 42, TypeArgs=new Type[] {typeof(double), typeof(int) } )]
|
261
261
|
[TestFixture(42, 100.0, TypeArgs=new Type[] {typeof(int), typeof(double) } )]
|
262
|
-
public class SpecifyTypeArgsSeparately
|
262
|
+
public class SpecifyTypeArgsSeparately<T1, T2>
|
263
263
|
{
|
264
264
|
T1 t1;
|
265
265
|
T2 t2;
|
@@ -273,8 +273,8 @@ public class SpecifyTypeArgsSeparately<T1, T2>
|
|
273
273
|
[TestCase(5, 7)]
|
274
274
|
public void TestMyArgTypes(T1 t1, T2 t2)
|
275
275
|
{
|
276
|
-
Assert.That(t1, Is.TypeOf
|
277
|
-
Assert.That(t2, Is.TypeOf
|
276
|
+
Assert.That(t1, Is.TypeOf<T1>());
|
277
|
+
Assert.That(t2, Is.TypeOf<T2>());
|
278
278
|
}
|
279
279
|
}</pre></div>
|
280
280
|
|
@@ -286,7 +286,7 @@ public class SpecifyTypeArgsSeparately<T1, T2>
|
|
286
286
|
<div class="code"><pre>
|
287
287
|
[TestFixture(100.0, 42)]
|
288
288
|
[TestFixture(42, 100.0)]
|
289
|
-
public class DeduceTypeArgsFromArgs
|
289
|
+
public class DeduceTypeArgsFromArgs<T1, T2>
|
290
290
|
{
|
291
291
|
T1 t1;
|
292
292
|
T2 t2;
|
@@ -300,8 +300,8 @@ public class DeduceTypeArgsFromArgs<T1, T2>
|
|
300
300
|
[TestCase(5, 7)]
|
301
301
|
public void TestMyArgTypes(T1 t1, T2 t2)
|
302
302
|
{
|
303
|
-
Assert.That(t1, Is.TypeOf
|
304
|
-
Assert.That(t2, Is.TypeOf
|
303
|
+
Assert.That(t1, Is.TypeOf<T1>());
|
304
|
+
Assert.That(t2, Is.TypeOf<T2>());
|
305
305
|
}
|
306
306
|
}</pre></div>
|
307
307
|
</ol>
|
@@ -311,7 +311,7 @@ public class DeduceTypeArgsFromArgs<T1, T2>
|
|
311
311
|
<!-- Submenu -->
|
312
312
|
<div id="subnav">
|
313
313
|
<ul>
|
314
|
-
<li><a href="index.html">NUnit 2.5</a></li>
|
314
|
+
<li><a href="index.html">NUnit 2.5.1</a></li>
|
315
315
|
<ul>
|
316
316
|
<li><a href="getStarted.html">Getting Started</a></li>
|
317
317
|
<li><a href="assertions.html">Assertions</a></li>
|
data/docs/testProperties.html
CHANGED
@@ -39,7 +39,7 @@ which causes it to remain open as the user clicks on different tests.</p>
|
|
39
39
|
<!-- Submenu -->
|
40
40
|
<div id="subnav">
|
41
41
|
<ul>
|
42
|
-
<li><a href="index.html">NUnit 2.5</a></li>
|
42
|
+
<li><a href="index.html">NUnit 2.5.1</a></li>
|
43
43
|
<ul>
|
44
44
|
<li><a href="getStarted.html">Getting Started</a></li>
|
45
45
|
<li><a href="assertions.html">Assertions</a></li>
|
data/docs/testcaseBuilders.html
CHANGED
@@ -72,7 +72,7 @@ provided as an argument or null if the method cannot be used.
|
|
72
72
|
<!-- Submenu -->
|
73
73
|
<div id="subnav">
|
74
74
|
<ul>
|
75
|
-
<li><a href="index.html">NUnit 2.5</a></li>
|
75
|
+
<li><a href="index.html">NUnit 2.5.1</a></li>
|
76
76
|
<ul>
|
77
77
|
<li><a href="getStarted.html">Getting Started</a></li>
|
78
78
|
<li><a href="assertions.html">Assertions</a></li>
|
data/docs/testcaseProviders.html
CHANGED
@@ -37,7 +37,8 @@ specific test cases that will be used in calling the test.
|
|
37
37
|
IExtensionPoint listeners = host.GetExtensionPoint( "ParameterProviders" );</pre>
|
38
38
|
|
39
39
|
<h4>Interface</h4>
|
40
|
-
<p>The extension object passed to Install must implement the
|
40
|
+
<p>The extension object passed to Install must implement either the
|
41
|
+
<b>ITestCaseProvider</b> or the <b>ITestCaseProvider2</b> interface:
|
41
42
|
|
42
43
|
<pre>
|
43
44
|
public interface ITestCaseProvider
|
@@ -45,12 +46,21 @@ specific test cases that will be used in calling the test.
|
|
45
46
|
bool HasTestCasesFor( MethodInfo method );
|
46
47
|
IEnumerable GetTestCasesFor( MethodInfo method );
|
47
48
|
}
|
49
|
+
|
50
|
+
public interface ITestCaseProvider2 : ITestCaseProvider
|
51
|
+
{
|
52
|
+
bool HasTestCasesFor( MethodInfo method, Test suite );
|
53
|
+
IEnumerable GetTestCasesFor( MethodInfo method, Test suite );
|
54
|
+
}
|
48
55
|
</pre>
|
49
56
|
|
50
|
-
<p>
|
57
|
+
<p>NUnit will call <b>ITestCaseProvider2</b> if it is available. Otherwise
|
58
|
+
<b>ITestCaseProvider</b> will be used.
|
59
|
+
|
60
|
+
<p><b>HasTestCasesFor</b> should return true if the provider is able to supply test cases
|
51
61
|
for the specified method. If a provider only wants to be used on certain types
|
52
|
-
of tests, it
|
53
|
-
based on what it finds.
|
62
|
+
of tests, it can examine the provided MethodInfo and the suite for which the
|
63
|
+
test is being constructed and return true or false based on what it finds.
|
54
64
|
|
55
65
|
<p>The GetParametersFor method should return a list of individual test cases.
|
56
66
|
Each test case may be expressed as a ParameterSet, as an array of arguments
|
@@ -70,6 +80,19 @@ specific test cases that will be used in calling the test.
|
|
70
80
|
|
71
81
|
<p>The ParameterSet class provides all these properties and may be used
|
72
82
|
to avoid the overhead of reflecting on the properties.
|
83
|
+
|
84
|
+
<h4>Notes:</h4>
|
85
|
+
|
86
|
+
<ol>
|
87
|
+
<li>Most providers will delegate one of the interface implementations
|
88
|
+
to the other if they implement both.
|
89
|
+
<li>TestCaseProviders that use data from the fixture class should use
|
90
|
+
<b>ITestCaseProvider2</b> interface so that they are able to access any
|
91
|
+
arguments supplied for constructing the fixture object.
|
92
|
+
<li>Providers that acquire data from outside the fixture will usually
|
93
|
+
be able to work with <b>ITestCaseProvider</b> alone.
|
94
|
+
<li>The <b>ITestCaseProvider2</b> interface was added in the NUnit 2.5.1 release.
|
95
|
+
</ol>
|
73
96
|
|
74
97
|
|
75
98
|
</div>
|
@@ -77,7 +100,7 @@ to avoid the overhead of reflecting on the properties.
|
|
77
100
|
<!-- Submenu -->
|
78
101
|
<div id="subnav">
|
79
102
|
<ul>
|
80
|
-
<li><a href="index.html">NUnit 2.5</a></li>
|
103
|
+
<li><a href="index.html">NUnit 2.5.1</a></li>
|
81
104
|
<ul>
|
82
105
|
<li><a href="getStarted.html">Getting Started</a></li>
|
83
106
|
<li><a href="assertions.html">Assertions</a></li>
|
data/docs/theory.html
CHANGED
@@ -139,7 +139,7 @@ public class SqrtTests
|
|
139
139
|
<!-- Submenu -->
|
140
140
|
<div id="subnav">
|
141
141
|
<ul>
|
142
|
-
<li><a href="index.html">NUnit 2.5</a></li>
|
142
|
+
<li><a href="index.html">NUnit 2.5.1</a></li>
|
143
143
|
<ul>
|
144
144
|
<li><a href="getStarted.html">Getting Started</a></li>
|
145
145
|
<li><a href="assertions.html">Assertions</a></li>
|
data/docs/throwsConstraint.html
CHANGED
@@ -26,46 +26,75 @@
|
|
26
26
|
|
27
27
|
<h2>Throws Constraint (NUnit 2.5)</h2>
|
28
28
|
|
29
|
-
<p>ThrowsConstraint is used to test that some code, represented as a delegate,
|
29
|
+
<p><b>ThrowsConstraint</b> is used to test that some code, represented as a delegate,
|
30
30
|
throws a particular exception. It may be used alone, to merely test the type
|
31
31
|
of constraint, or with an additional constraint to be applied to the exception
|
32
32
|
specified as an argument.
|
33
33
|
|
34
|
-
<
|
35
|
-
|
36
|
-
<tr><td>Throws.Exception(Type)</td><td>ThrowsConstraint(Type)</td></td><td>tests that an exception of the specified type is thrown</td></tr>
|
37
|
-
<tr><td>Throws.Exception(Type,Constraint)</td><td>ThrowsConstraint(Type,Constraint)</td></td><td>tests that an exception of the specified type is thrown and that it satisifies the constrant provided as the second argument</td></tr>
|
38
|
-
<tr><td>Throws.Exception<T>()</td><td>ThrowsConstraint<T>()</td></td><td>tests that an exception of the specified type is thrown</td></tr>
|
39
|
-
<tr><td>Throws.Exception<T>(Constraint)</td><td>ThrowsConstraint<T>(Constraint)</td></td><td>tests that an exception of the specified type is thrown and that it satisifies the constrant provided as an argument</td></tr>
|
40
|
-
</table>
|
34
|
+
p>The related <b>ThrowsNothingConstraint</b> simply asserts that the delegate
|
35
|
+
does not throw an exception.
|
41
36
|
|
42
|
-
<h4>
|
37
|
+
<h4>Constructors</h4>
|
38
|
+
<div class="code"><pre>
|
39
|
+
ThrowsConstraint(Type expectedType)
|
40
|
+
ThrowsConstraint<T>()
|
41
|
+
ThrowsConstraint(Type expectedType, Constraint constraint)
|
42
|
+
ThrowsConstraint<T>(Constraint constraint)
|
43
|
+
ThrowsNothingConstraint()
|
44
|
+
</pre></div>
|
43
45
|
|
46
|
+
<h4>Syntax</h4>
|
44
47
|
<div class="code"><pre>
|
48
|
+
Throws.Exception
|
49
|
+
Throws.TypeOf(Type expectedType)
|
50
|
+
Throws.TypeOf<T>()
|
51
|
+
Throws.InstanceOf(Type expectedType)
|
52
|
+
Throws.InstanceOf<T>()
|
53
|
+
Throws.Nothing
|
54
|
+
</pre></div>
|
45
55
|
|
56
|
+
<h4>Examples of Use</h4>
|
57
|
+
<div class="code"><pre>
|
46
58
|
// .NET 1.1
|
47
59
|
Assert.That( new TestDelegate(SomeMethod),
|
48
|
-
Throws.
|
60
|
+
Throws.TypeOf(typeof(ArgumentException)));
|
61
|
+
Assert.That( new TestDelegate(SomeMethod),
|
62
|
+
Throws.Exception.TypeOf(typeof(ArgumentException)));
|
49
63
|
Assert.That( new TestDelegate(SomeMethod),
|
50
|
-
Throws.
|
51
|
-
|
64
|
+
Throws.TypeOf(typeof(ArgumentException))
|
65
|
+
.With.Property("Parameter").EqualTo("myParam"));
|
52
66
|
|
53
67
|
// .NET 2.0
|
54
68
|
Assert.That( SomeMethod,
|
55
|
-
Throws.
|
69
|
+
Throws.TypeOf<ArgumentException>());
|
56
70
|
Assert.That( SomeMethod,
|
57
|
-
Throws.Exception<ArgumentException>(
|
58
|
-
|
59
|
-
|
71
|
+
Throws.Exception.TypeOf<ArgumentException>());
|
72
|
+
Assert.That( SomeMethod,
|
73
|
+
Throws.TypeOf<ArgumentException>()
|
74
|
+
.With.Property("Parameter").EqualTo("myParam"));
|
60
75
|
</pre></div>
|
61
76
|
|
77
|
+
<h4>Notes</h4>
|
78
|
+
<ol>
|
79
|
+
<li><b>Throws.Exception</b> may be followed by further constraints,
|
80
|
+
which are applied to the exception itself as shown in the last two
|
81
|
+
examples above. It may also be used alone to verify that some
|
82
|
+
exception has been thrown, without regard to type. This is
|
83
|
+
not a recommended practice since you should normally know
|
84
|
+
what exception you are expecting.
|
85
|
+
<li><b>Throws.TypeOf</b> and <b>Throws.InstanceOf</b> are provided
|
86
|
+
as a shorter syntax for this common test. They work exactly like
|
87
|
+
the corresponding forms following <b>Throws.Exception</b>.
|
88
|
+
</ol>
|
89
|
+
|
90
|
+
|
62
91
|
|
63
92
|
</div>
|
64
93
|
|
65
94
|
<!-- Submenu -->
|
66
95
|
<div id="subnav">
|
67
96
|
<ul>
|
68
|
-
<li><a href="index.html">NUnit 2.5</a></li>
|
97
|
+
<li><a href="index.html">NUnit 2.5.1</a></li>
|
69
98
|
<ul>
|
70
99
|
<li><a href="getStarted.html">Getting Started</a></li>
|
71
100
|
<li><a href="assertions.html">Assertions</a></li>
|
data/docs/timeout.html
CHANGED
@@ -40,7 +40,7 @@
|
|
40
40
|
<!-- Submenu -->
|
41
41
|
<div id="subnav">
|
42
42
|
<ul>
|
43
|
-
<li><a href="index.html">NUnit 2.5</a></li>
|
43
|
+
<li><a href="index.html">NUnit 2.5.1</a></li>
|
44
44
|
<ul>
|
45
45
|
<li><a href="getStarted.html">Getting Started</a></li>
|
46
46
|
<li><a href="assertions.html">Assertions</a></li>
|
data/docs/typeAsserts.html
CHANGED
@@ -89,7 +89,7 @@ Assert.IsNotAssignableFrom<T>( object actual,
|
|
89
89
|
<!-- Submenu -->
|
90
90
|
<div id="subnav">
|
91
91
|
<ul>
|
92
|
-
<li><a href="index.html">NUnit 2.5</a></li>
|
92
|
+
<li><a href="index.html">NUnit 2.5.1</a></li>
|
93
93
|
<ul>
|
94
94
|
<li><a href="getStarted.html">Getting Started</a></li>
|
95
95
|
<li><a href="assertions.html">Assertions</a></li>
|
data/docs/typeConstraints.html
CHANGED
@@ -59,7 +59,7 @@ Expect( "Hello", AssignableFrom(typeOf(string)));
|
|
59
59
|
<!-- Submenu -->
|
60
60
|
<div id="subnav">
|
61
61
|
<ul>
|
62
|
-
<li><a href="index.html">NUnit 2.5</a></li>
|
62
|
+
<li><a href="index.html">NUnit 2.5.1</a></li>
|
63
63
|
<ul>
|
64
64
|
<li><a href="getStarted.html">Getting Started</a></li>
|
65
65
|
<li><a href="assertions.html">Assertions</a></li>
|
data/docs/upgrade.html
CHANGED
@@ -64,7 +64,7 @@ in order for your tests to load correctly.
|
|
64
64
|
<!-- Submenu -->
|
65
65
|
<div id="subnav">
|
66
66
|
<ul>
|
67
|
-
<li><a href="index.html">NUnit 2.5</a></li>
|
67
|
+
<li><a href="index.html">NUnit 2.5.1</a></li>
|
68
68
|
<ul>
|
69
69
|
<li><a href="getStarted.html">Getting Started</a></li>
|
70
70
|
<ul>
|
data/docs/utilityAsserts.html
CHANGED
@@ -85,7 +85,7 @@ public void AssertStringContains( string expected, string actual,
|
|
85
85
|
<!-- Submenu -->
|
86
86
|
<div id="subnav">
|
87
87
|
<ul>
|
88
|
-
<li><a href="index.html">NUnit 2.5</a></li>
|
88
|
+
<li><a href="index.html">NUnit 2.5.1</a></li>
|
89
89
|
<ul>
|
90
90
|
<li><a href="getStarted.html">Getting Started</a></li>
|
91
91
|
<li><a href="assertions.html">Assertions</a></li>
|
data/docs/valueSource.html
CHANGED
@@ -40,7 +40,12 @@ ValueSourceAttribute(string sourceName);
|
|
40
40
|
</div>
|
41
41
|
|
42
42
|
<p>If <b>sourceType</b> is specified, it represents the class that provides
|
43
|
-
the data.
|
43
|
+
the data. It must have a default constructor.
|
44
|
+
|
45
|
+
<p>If <b>sourceType</b> is not specified, the class containing the test
|
46
|
+
method is used. NUnit will construct it using either the default constructor
|
47
|
+
or - if arguments are provided - the appropriate constructor for those
|
48
|
+
arguments.
|
44
49
|
|
45
50
|
<p>The <b>sourceName</b>, represents the name of the source that will
|
46
51
|
provide the arguments. It should have the following characteristics:
|
@@ -53,22 +58,26 @@ provide the arguments. It should have the following characteristics:
|
|
53
58
|
<li>
|
54
59
|
</ul>
|
55
60
|
|
56
|
-
<
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
members of the class.
|
61
|
+
<h3>Note on Object Construction</h3>
|
62
|
+
|
63
|
+
<p>NUnit locates the test cases at the time the tests are loaded, creates
|
64
|
+
instances of each class with non-static sources and builds a list of
|
65
|
+
tests to be executed. Each source object is only created once at this
|
66
|
+
time and is destroyed after all tests are loaded.
|
63
67
|
|
64
|
-
|
68
|
+
<p>If the data source is in the test fixture itself, the object is created
|
69
|
+
using the appropriate constructor for the fixture parameters provided, or
|
70
|
+
the default constructor if no parameters were specified. Since this object
|
71
|
+
is destroyed before the tests are run, no communication is possible between
|
72
|
+
these two phases - or between different runs - except through the parameters
|
73
|
+
themselves.
|
65
74
|
|
66
75
|
</div>
|
67
76
|
|
68
77
|
<!-- Submenu -->
|
69
78
|
<div id="subnav">
|
70
79
|
<ul>
|
71
|
-
<li><a href="index.html">NUnit 2.5</a></li>
|
80
|
+
<li><a href="index.html">NUnit 2.5.1</a></li>
|
72
81
|
<ul>
|
73
82
|
<li><a href="getStarted.html">Getting Started</a></li>
|
74
83
|
<li><a href="assertions.html">Assertions</a></li>
|