nunit 2.4.8.0 → 2.5.0.9122
Sign up to get free protection for your applications and to get access to all the features.
- data/docs/addinsDialog.html +36 -6
- data/docs/assertions.html +31 -12
- data/docs/attributes.html +59 -36
- data/docs/category.html +32 -9
- data/docs/collectionAssert.html +30 -12
- data/docs/collectionConstraints.html +242 -44
- data/docs/combinatorial.html +130 -0
- data/docs/comparisonAsserts.html +12 -9
- data/docs/comparisonConstraints.html +159 -25
- data/docs/compoundConstraints.html +12 -9
- data/docs/conditionAsserts.html +36 -12
- data/docs/conditionConstraints.html +131 -25
- data/docs/configEditor.html +10 -5
- data/docs/configFiles.html +5 -6
- data/docs/consoleCommandLine.html +51 -24
- data/docs/constraintModel.html +56 -19
- data/docs/contextMenu.html +10 -5
- data/docs/culture.html +32 -9
- data/docs/customConstraints.html +53 -37
- data/docs/datapoint.html +124 -0
- data/docs/datapointProviders.html +105 -0
- data/docs/delayedConstraint.html +98 -0
- data/docs/description.html +32 -9
- data/docs/directoryAssert.html +151 -0
- data/docs/equalConstraint.html +167 -47
- data/docs/equalityAsserts.html +12 -9
- data/docs/eventListeners.html +110 -0
- data/docs/exception.html +61 -36
- data/docs/exceptionAsserts.html +210 -0
- data/docs/explicit.html +32 -9
- data/docs/extensibility.html +8 -8
- data/docs/extensionTips.html +100 -0
- data/docs/fileAssert.html +12 -9
- data/docs/files/TestResult.xml +99 -67
- data/docs/fixtureSetup.html +60 -18
- data/docs/fixtureTeardown.html +56 -17
- data/docs/getStarted.html +9 -4
- data/docs/guiCommandLine.html +10 -5
- data/docs/identityAsserts.html +12 -9
- data/docs/ignore.html +32 -9
- data/docs/img/addinsDialog.JPG +0 -0
- data/docs/img/advancedSettings.jpg +0 -0
- data/docs/img/assembliesTab.jpg +0 -0
- data/docs/img/assemblyReloadSettings.JPG +0 -0
- data/docs/img/configEditor.jpg +0 -0
- data/docs/img/console-mock.jpg +0 -0
- data/docs/img/generalSettings.jpg +0 -0
- data/docs/img/generalTab.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/img/testLoadSettings.jpg +0 -0
- data/docs/img/testOutputSettings.jpg +0 -0
- data/docs/img/testProperties.jpg +0 -0
- data/docs/img/testResultSettings.JPG +0 -0
- data/docs/img/textOutputSettings.jpg +0 -0
- data/docs/img/treeDisplaySettings.jpg +0 -0
- data/docs/img/visualStudioSettings.jpg +0 -0
- data/docs/index.html +15 -8
- data/docs/installation.html +33 -75
- data/docs/license.html +9 -4
- data/docs/listMapper.html +12 -9
- data/docs/mainMenu.html +18 -8
- data/docs/maxtime.html +109 -0
- data/docs/multiAssembly.html +5 -6
- data/docs/nunit-console.html +9 -4
- data/docs/nunit-gui.html +32 -15
- data/docs/nunit.css +3 -3
- data/docs/nunitAddins.html +41 -144
- data/docs/pairwise.html +114 -0
- data/docs/parameterizedTests.html +141 -0
- data/docs/pathConstraints.html +162 -0
- data/docs/platform.html +37 -9
- data/docs/pnunit.html +93 -0
- data/docs/projectEditor.html +82 -11
- data/docs/property.html +39 -10
- data/docs/propertyConstraint.html +12 -9
- data/docs/quickStart.html +9 -4
- data/docs/random.html +138 -0
- data/docs/range.html +149 -0
- data/docs/releaseDetail.html +861 -0
- data/docs/releaseNotes.html +457 -1133
- data/docs/repeat.html +104 -0
- data/docs/requiredAddin.html +153 -0
- data/docs/requiresMTA.html +152 -0
- data/docs/requiresSTA.html +153 -0
- data/docs/requiresThread.html +153 -0
- data/docs/sameasConstraint.html +23 -17
- data/docs/samples.html +12 -9
- data/docs/sequential.html +132 -0
- data/docs/setCulture.html +32 -9
- data/docs/{optionsDialog.html → settingsDialog.html} +89 -53
- data/docs/setup.html +61 -16
- data/docs/setupFixture.html +32 -9
- data/docs/stringAssert.html +15 -12
- data/docs/stringConstraints.html +12 -9
- data/docs/suite.html +32 -11
- data/docs/suiteBuilders.html +106 -0
- data/docs/teardown.html +56 -16
- data/docs/test.html +67 -18
- data/docs/testCase.html +168 -0
- data/docs/testCaseSource.html +284 -0
- data/docs/testDecorators.html +117 -0
- data/docs/testFixture.html +228 -16
- data/docs/testProperties.html +10 -5
- data/docs/testcaseBuilders.html +117 -0
- data/docs/testcaseProviders.html +122 -0
- data/docs/theory.html +208 -0
- data/docs/throwsConstraint.html +112 -0
- data/docs/timeout.html +109 -0
- data/docs/typeAsserts.html +47 -14
- data/docs/typeConstraints.html +12 -9
- data/docs/upgrade.html +23 -17
- data/docs/utilityAsserts.html +38 -16
- data/docs/valueSource.html +137 -0
- data/docs/values.html +136 -0
- data/docs/vsSupport.html +5 -6
- data/lib/net-1.1/NUnitTests.config +2 -2
- data/lib/net-1.1/NUnitTests.nunit +8 -11
- data/lib/net-1.1/agent.conf +4 -0
- data/lib/net-1.1/agent.log.conf +18 -0
- data/lib/net-1.1/framework/nunit.framework.dll +0 -0
- data/lib/net-1.1/framework/nunit.framework.xml +9321 -0
- 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/launcher.log.conf +18 -0
- data/lib/net-1.1/{fit.dll → lib/fit.dll} +0 -0
- data/lib/net-1.1/lib/log4net.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.exe.config → nunit-agent.exe.config} +21 -55
- data/lib/net-1.1/nunit-console.exe +0 -0
- data/lib/net-1.1/nunit-console.exe.config +19 -49
- 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-agent.exe.config +87 -0
- data/lib/net-1.1/pnunit-launcher.exe +0 -0
- data/lib/net-1.1/pnunit-launcher.exe.config +87 -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/runpnunit.bat +2 -0
- data/lib/net-1.1/test.conf +24 -0
- data/lib/net-1.1/{loadtest-assembly.dll → 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/{nunit.util.tests.dll → 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/NUnitTests.config +2 -2
- data/lib/net-2.0/NUnitTests.nunit +11 -11
- data/lib/net-2.0/agent.conf +4 -0
- data/lib/net-2.0/agent.log.conf +18 -0
- data/lib/net-2.0/framework/nunit.framework.dll +0 -0
- data/lib/net-2.0/framework/nunit.framework.xml +9803 -0
- 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/launcher.log.conf +18 -0
- data/lib/{net-1.1 → net-2.0/lib}/Failure.jpg +0 -0
- data/lib/net-2.0/{Success.jpg → lib/Gray.jpg} +0 -0
- data/lib/{net-1.1 → net-2.0/lib}/Ignored.jpg +0 -0
- data/lib/{net-1.1 → net-2.0/lib}/Success.jpg +0 -0
- data/lib/net-2.0/{fit.dll → lib/fit.dll} +0 -0
- data/lib/net-2.0/lib/log4net.dll +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-agent.exe.config +87 -0
- data/lib/net-2.0/nunit-console-x86.exe +0 -0
- data/lib/net-2.0/nunit-console-x86.exe.config +19 -49
- data/lib/net-2.0/nunit-console.exe +0 -0
- data/lib/net-2.0/nunit-console.exe.config +19 -49
- data/lib/net-2.0/nunit-x86.exe +0 -0
- data/lib/net-2.0/nunit-x86.exe.config +48 -74
- data/lib/net-2.0/nunit.exe +0 -0
- data/lib/net-2.0/nunit.exe.config +48 -74
- 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-agent.exe.config +87 -0
- data/lib/net-2.0/pnunit-launcher.exe +0 -0
- data/lib/net-2.0/pnunit-launcher.exe.config +87 -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/runpnunit.bat +2 -0
- data/lib/net-2.0/test.conf +24 -0
- data/lib/net-2.0/{loadtest-assembly.dll → 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/{nunit.util.tests.dll → 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 +131 -74
- data/docs/classicModel.html +0 -92
- data/docs/customAsserts.html +0 -115
- data/docs/features.html +0 -75
- data/docs/files/Thumbs.db +0 -0
- data/docs/platformSupport.html +0 -99
- data/lib/net-1.1/mock-assembly.dll +0 -0
- data/lib/net-1.1/nonamespace-assembly.dll +0 -0
- data/lib/net-1.1/notestfixtures-assembly.dll +0 -0
- data/lib/net-1.1/nunit-console-runner.dll +0 -0
- data/lib/net-1.1/nunit-console.tests.dll +0 -0
- data/lib/net-1.1/nunit-gui-runner.dll +0 -0
- data/lib/net-1.1/nunit-gui.tests.dll +0 -0
- data/lib/net-1.1/nunit.core.dll +0 -0
- data/lib/net-1.1/nunit.core.extensions.dll +0 -0
- data/lib/net-1.1/nunit.core.interfaces.dll +0 -0
- data/lib/net-1.1/nunit.core.tests.dll +0 -0
- data/lib/net-1.1/nunit.exe +0 -0
- data/lib/net-1.1/nunit.extensions.tests.dll +0 -0
- data/lib/net-1.1/nunit.fixtures.dll +0 -0
- data/lib/net-1.1/nunit.fixtures.tests.dll +0 -0
- data/lib/net-1.1/nunit.framework.extensions.dll +0 -0
- data/lib/net-1.1/nunit.framework.tests.dll +0 -0
- data/lib/net-1.1/nunit.framework.xml +0 -5622
- data/lib/net-1.1/nunit.mocks.dll +0 -0
- data/lib/net-1.1/nunit.mocks.tests.dll +0 -0
- data/lib/net-1.1/nunit.uikit.dll +0 -0
- data/lib/net-1.1/nunit.uikit.tests.dll +0 -0
- data/lib/net-1.1/nunit.util.dll +0 -0
- data/lib/net-1.1/test-assembly.dll +0 -0
- data/lib/net-1.1/test-utilities.dll +0 -0
- data/lib/net-1.1/timing-tests.dll +0 -0
- data/lib/net-2.0/Failure.jpg +0 -0
- data/lib/net-2.0/Ignored.jpg +0 -0
- data/lib/net-2.0/mock-assembly.dll +0 -0
- data/lib/net-2.0/nonamespace-assembly.dll +0 -0
- data/lib/net-2.0/notestfixtures-assembly.dll +0 -0
- data/lib/net-2.0/nunit-console-runner.dll +0 -0
- data/lib/net-2.0/nunit-console.tests.dll +0 -0
- data/lib/net-2.0/nunit-gui-runner.dll +0 -0
- data/lib/net-2.0/nunit-gui.tests.dll +0 -0
- data/lib/net-2.0/nunit.core.dll +0 -0
- data/lib/net-2.0/nunit.core.extensions.dll +0 -0
- data/lib/net-2.0/nunit.core.interfaces.dll +0 -0
- data/lib/net-2.0/nunit.core.tests.dll +0 -0
- data/lib/net-2.0/nunit.extensions.tests.dll +0 -0
- data/lib/net-2.0/nunit.fixtures.dll +0 -0
- data/lib/net-2.0/nunit.fixtures.tests.dll +0 -0
- data/lib/net-2.0/nunit.framework.extensions.dll +0 -0
- data/lib/net-2.0/nunit.framework.tests.dll +0 -0
- data/lib/net-2.0/nunit.framework.xml +0 -5622
- data/lib/net-2.0/nunit.mocks.dll +0 -0
- data/lib/net-2.0/nunit.mocks.tests.dll +0 -0
- data/lib/net-2.0/nunit.uikit.dll +0 -0
- data/lib/net-2.0/nunit.uikit.tests.dll +0 -0
- data/lib/net-2.0/nunit.util.dll +0 -0
- data/lib/net-2.0/test-assembly.dll +0 -0
- data/lib/net-2.0/test-utilities.dll +0 -0
- data/lib/net-2.0/timing-tests.dll +0 -0
@@ -0,0 +1,117 @@
|
|
1
|
+
<!-- saved from url=(0014)about:internet --><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
|
2
|
+
<html>
|
3
|
+
<!-- Standard Head Part -->
|
4
|
+
<head>
|
5
|
+
<title>NUnit - TestDecorators</title>
|
6
|
+
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
|
7
|
+
<meta http-equiv="Content-Language" content="en-US">
|
8
|
+
<link rel="stylesheet" type="text/css" href="nunit.css">
|
9
|
+
<link rel="shortcut icon" href="favicon.ico">
|
10
|
+
</head>
|
11
|
+
<!-- End Standard Head Part -->
|
12
|
+
|
13
|
+
<body>
|
14
|
+
|
15
|
+
<!-- Standard Header for NUnit.org -->
|
16
|
+
<div id="header">
|
17
|
+
<a id="logo" href="http://www.nunit.org"><img src="img/logo.gif" alt="NUnit.org" title="NUnit.org"></a>
|
18
|
+
<div id="nav">
|
19
|
+
<a href="http://www.nunit.org">NUnit</a>
|
20
|
+
<a class="active" href="index.html">Documentation</a>
|
21
|
+
</div>
|
22
|
+
</div>
|
23
|
+
<!-- End of Header -->
|
24
|
+
|
25
|
+
<div id="content">
|
26
|
+
|
27
|
+
<h3>TestDecorators (NUnit 2.4)</h3>
|
28
|
+
|
29
|
+
<h4>Purpose</h4>
|
30
|
+
<p>TestDecorators are able to modify a test after it has been constructed.
|
31
|
+
|
32
|
+
<h4>Extension Point</h4>
|
33
|
+
<p>Addins use the host to access this extension point by name:
|
34
|
+
|
35
|
+
<pre>
|
36
|
+
IExtensionPoint testDecorators = host.GetExtensionPoint( "TestDecorators" );</pre>
|
37
|
+
|
38
|
+
<h4>Interface</h4>
|
39
|
+
<p>The extension object passed to Install must implement the ITestDecorator interface:
|
40
|
+
|
41
|
+
<pre>
|
42
|
+
public interface ITestDecorator
|
43
|
+
{
|
44
|
+
Test Decorate( Test test, MemberInfo member );
|
45
|
+
}
|
46
|
+
</pre>
|
47
|
+
|
48
|
+
<p>The Decorate method may do several things, depending on what it needs
|
49
|
+
to accomplish:
|
50
|
+
<ol>
|
51
|
+
<li>Return test unmodified
|
52
|
+
<li>Modify properties of the test object and return it
|
53
|
+
<li>Replace test with another object, either discarding the
|
54
|
+
original or aggregating it in the new test.
|
55
|
+
</ol>
|
56
|
+
|
57
|
+
<p>Depending on what the decorator does, it may need to run
|
58
|
+
ahead of other decorators or after them. Decorators should
|
59
|
+
be installed using the Install method overload that takes
|
60
|
+
a priority. The priorities range from 1 to 9 and decorators
|
61
|
+
with lower priority values are installed first. The following
|
62
|
+
standard values are defined for use if desired:
|
63
|
+
<ul>
|
64
|
+
<li>DecoratorPriority.Default = 0
|
65
|
+
<li>DecoratorPriority.First = 1
|
66
|
+
<li>DecoratorPriority.Normal = 5
|
67
|
+
<li>DecoratorPriority.Last = 9
|
68
|
+
</ul>
|
69
|
+
|
70
|
+
</div>
|
71
|
+
|
72
|
+
<!-- Submenu -->
|
73
|
+
<div id="subnav">
|
74
|
+
<ul>
|
75
|
+
<li><a href="index.html">NUnit 2.5</a></li>
|
76
|
+
<ul>
|
77
|
+
<li><a href="getStarted.html">Getting Started</a></li>
|
78
|
+
<li><a href="assertions.html">Assertions</a></li>
|
79
|
+
<li><a href="constraintModel.html">Constraints</a></li>
|
80
|
+
<li><a href="attributes.html">Attributes</a></li>
|
81
|
+
<li><a href="nunit-console.html">Console Runner</a></li>
|
82
|
+
<li><a href="nunit-gui.html">Gui Runner</a></li>
|
83
|
+
<li><a href="configFiles.html">Configuration Files</a></li>
|
84
|
+
<li><a href="pnunit.html">PNUnit</a></li>
|
85
|
+
<li><a href="multiAssembly.html">Multiple Assemblies</a></li>
|
86
|
+
<li><a href="vsSupport.html">Visual Studio Support</a></li>
|
87
|
+
<li><a href="extensibility.html">Extensibility</a></li>
|
88
|
+
<ul>
|
89
|
+
<li><a href="customConstraints.html">Custom Constraints</a></li>
|
90
|
+
<li><a href="nunitAddins.html">NUnit Addins</a></li>
|
91
|
+
<ul>
|
92
|
+
<li><a href="suiteBuilders.html">SuiteBuilders</a></li>
|
93
|
+
<li><a href="testcaseBuilders.html">TestcaseBuilders</a></li>
|
94
|
+
<li id="current"><a href="testDecorators.html">TestDecorators</a></li>
|
95
|
+
<li><a href="testcaseProviders.html">TestcaseProviders</a></li>
|
96
|
+
<li><a href="datapointProviders.html">DatapointProviders</a></li>
|
97
|
+
<li><a href="eventListeners.html">EventListeners</a></li>
|
98
|
+
</ul>
|
99
|
+
<li><a href="extensionTips.html">Tips for Extenders</a></li>
|
100
|
+
</ul>
|
101
|
+
<li><a href="releaseNotes.html">Release Notes</a></li>
|
102
|
+
<li><a href="samples.html">Samples</a></li>
|
103
|
+
<li><a href="license.html">License</a></li>
|
104
|
+
</ul>
|
105
|
+
</ul>
|
106
|
+
</div>
|
107
|
+
<!-- End of Submenu -->
|
108
|
+
|
109
|
+
|
110
|
+
<!-- Standard Footer for NUnit.org -->
|
111
|
+
<div id="footer">
|
112
|
+
Copyright © 2009 Charlie Poole. All Rights Reserved.
|
113
|
+
</div>
|
114
|
+
<!-- End of Footer -->
|
115
|
+
|
116
|
+
</body>
|
117
|
+
</html>
|
data/docs/testFixture.html
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
<!-- saved from url=(0014)about:internet --><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
|
2
2
|
<html>
|
3
3
|
<!-- Standard Head Part -->
|
4
4
|
<head>
|
@@ -26,25 +26,33 @@
|
|
26
26
|
|
27
27
|
<script language="JavaScript" src="codeFuncs.js" ></script> <!-- Do it this way for IE -->
|
28
28
|
|
29
|
-
<h3>TestFixtureAttribute (NUnit 2.0)</h3>
|
29
|
+
<h3>TestFixtureAttribute (NUnit 2.0 / 2.5)</h3>
|
30
|
+
|
30
31
|
<p>This is the attribute that marks a class that contains tests and, optionally,
|
31
|
-
setup or teardown methods
|
32
|
+
setup or teardown methods. NUnit 2.5 introduces parameterized and generic
|
33
|
+
test fixtures - see below.</p>
|
34
|
+
|
32
35
|
<p>There are a few restrictions on a class that is used as a test fixture.
|
33
36
|
<ul>
|
34
37
|
<li>It must be a publicly exported type.</li>
|
35
38
|
<li>It must have not be abstract.</li>
|
36
|
-
<li>
|
37
|
-
<li>
|
38
|
-
|
39
|
+
<li>A non-parameterized fixture must have a default constructor.
|
40
|
+
<li>A parameterized fixture must have a constructor that matches
|
41
|
+
the parameters provided.
|
39
42
|
</ul>
|
40
43
|
</p>
|
41
44
|
|
42
|
-
<p>If any of these restrictions are violated, the class
|
43
|
-
|
45
|
+
<p>If any of these restrictions are violated, the class is not runnable
|
46
|
+
as a test and will display as an error in the Gui.</p>
|
44
47
|
|
45
48
|
<p>In addition, it is advisable that the constructor not have any side effects,
|
46
49
|
since NUnit may construct the object multiple times in the course of a session.</li>
|
47
50
|
|
51
|
+
<p>Beginning with NUnit 2.5, the <b>TestFixture</b> attribute is optional
|
52
|
+
for non-paramterized, non-generic fixtures, so long as the class contains
|
53
|
+
at least one method marked with the <b>Test</b>,
|
54
|
+
<b>TestCase</b> or <b>TestCaseSource</b> attribute.
|
55
|
+
|
48
56
|
<h4>Example:</h4>
|
49
57
|
|
50
58
|
<div class="code">
|
@@ -115,40 +123,244 @@ public class SuccessTests
|
|
115
123
|
// ...
|
116
124
|
}
|
117
125
|
</pre>
|
126
|
+
|
118
127
|
</div>
|
119
128
|
|
129
|
+
<h3>Parameterized Test Fixtures (NUnit 2.5)</h3>
|
130
|
+
|
131
|
+
<p>Beginning with NUnit 2.5, test fixtures may take constructor arguments.
|
132
|
+
Argument values are specified as arguments to the <b>TestFixture</b>
|
133
|
+
attribute. NUnit will construct a separate instance of the fixture
|
134
|
+
for each set of arguments.
|
135
|
+
|
136
|
+
<h4>Example</h4>
|
137
|
+
|
138
|
+
<p>The following test fixture would be instantiated by NUnit three times,
|
139
|
+
passing in each set of arguments to the appropriate constructor. Note
|
140
|
+
that there are three different constructors, matching the data types
|
141
|
+
provided as arguments.
|
142
|
+
|
143
|
+
<div class="code"><pre>
|
144
|
+
[TestFixture("hello", "hello", "goodbye")]
|
145
|
+
[TestFixture("zip", "zip")]
|
146
|
+
[TestFixture(42, 42, 99)]
|
147
|
+
public class ParameterizedTestFixture
|
148
|
+
{
|
149
|
+
private string eq1;
|
150
|
+
private string eq2;
|
151
|
+
private string neq;
|
152
|
+
|
153
|
+
public ParameterizedTestFixture(string eq1, string eq2, string neq)
|
154
|
+
{
|
155
|
+
this.eq1 = eq1;
|
156
|
+
this.eq2 = eq2;
|
157
|
+
this.neq = neq;
|
158
|
+
}
|
159
|
+
|
160
|
+
public ParameterizedTestFixture(string eq1, string eq2)
|
161
|
+
: this(eq1, eq2, null) { }
|
162
|
+
|
163
|
+
public ParameterizedTestFixture(int eq1, int eq2, int neq)
|
164
|
+
{
|
165
|
+
this.eq1 = eq1.ToString();
|
166
|
+
this.eq2 = eq2.ToString();
|
167
|
+
this.neq = neq.ToString();
|
168
|
+
}
|
169
|
+
|
170
|
+
[Test]
|
171
|
+
public void TestEquality()
|
172
|
+
{
|
173
|
+
Assert.AreEqual(eq1, eq2);
|
174
|
+
if (eq1 != null && eq2 != null)
|
175
|
+
Assert.AreEqual(eq1.GetHashCode(), eq2.GetHashCode());
|
176
|
+
}
|
177
|
+
|
178
|
+
[Test]
|
179
|
+
public void TestInequality()
|
180
|
+
{
|
181
|
+
Assert.AreNotEqual(eq1, neq);
|
182
|
+
if (eq1 != null && neq != null)
|
183
|
+
Assert.AreNotEqual(eq1.GetHashCode(), neq.GetHashCode());
|
184
|
+
}
|
185
|
+
}
|
186
|
+
</pre></div>
|
187
|
+
|
188
|
+
<h3>Generic Test Fixtures (NUnit 2.5)</h3>
|
189
|
+
|
190
|
+
<p>Beginning with NUnit 2.5, you may use a generic class as a test fixture.
|
191
|
+
In order for NUnit to instantiate the fixture, you must specify the
|
192
|
+
types to be used as arguments to <b>TestFixtureAttribute</b>, which
|
193
|
+
may now appear multiple times on the class.
|
194
|
+
|
195
|
+
<h4>Example</h4>
|
196
|
+
|
197
|
+
<p>The following test fixture would be instantiated by NUnit twice,
|
198
|
+
once using an ArrayList and once using a List<int>.
|
199
|
+
|
200
|
+
<div class="code"><pre>
|
201
|
+
[TestFixture(typeof(ArrayList))]
|
202
|
+
[TestFixture(typeof(List<int>))]
|
203
|
+
public class IList_Tests<TList> where TList : IList, new()
|
204
|
+
{
|
205
|
+
private IList list;
|
206
|
+
|
207
|
+
[SetUp]
|
208
|
+
public void CreateList()
|
209
|
+
{
|
210
|
+
this.list = new TList();
|
211
|
+
}
|
212
|
+
|
213
|
+
[Test]
|
214
|
+
public void CanAddToList()
|
215
|
+
{
|
216
|
+
list.Add(1); list.Add(2); list.Add(3);
|
217
|
+
Assert.AreEqual(3, list.Count);
|
218
|
+
}
|
219
|
+
}</pre></div>
|
220
|
+
|
221
|
+
<h3>Generic Test Fixtures with Parameters (NUnit 2.5)</h3>
|
222
|
+
|
223
|
+
<p>If a Generic fixture, uses constructor arguments, there are three
|
224
|
+
approaches to telling NUnit which arguments are type parameters
|
225
|
+
and which are normal constructor parameters.
|
226
|
+
<ol>
|
227
|
+
<li>Specify both sets of parameters as arguments to the <b>TestFixtureAttribute</b>.
|
228
|
+
Leading <b>System.Type</b> arguments are used as type parameters, while
|
229
|
+
any remaining arguments are used to construct the instance. In the
|
230
|
+
following example, this leads to some obvious duplication...
|
231
|
+
|
232
|
+
<div class="code"><pre>
|
233
|
+
[TestFixture(typeof(double), typeof(int), 100.0, 42)]
|
234
|
+
[TestFixture(typeof(int) typeof(double), 42, 100.0)]
|
235
|
+
public class SpecifyBothSetsOfArgs<T1, T2>
|
236
|
+
{
|
237
|
+
T1 t1;
|
238
|
+
T2 t2;
|
239
|
+
|
240
|
+
public SpecifyBothSetsOfArgs(T1 t1, T2 t2)
|
241
|
+
{
|
242
|
+
this.t1 = t1;
|
243
|
+
this.t2 = t2;
|
244
|
+
}
|
245
|
+
|
246
|
+
[TestCase(5, 7)]
|
247
|
+
public void TestMyArgTypes(T1 t1, T2 t2)
|
248
|
+
{
|
249
|
+
Assert.That(t1, Is.TypeOf<T1>());
|
250
|
+
Assert.That(t2, Is.TypeOf<T2>());
|
251
|
+
}
|
252
|
+
}</pre></div>
|
253
|
+
|
254
|
+
<li>Specify normal parameters as arguments to <b>TestFixtureAttribute</b>
|
255
|
+
and use the named parameter <b>TypeArgs=</b> to specify the type
|
256
|
+
arguments. Again, for this example, the type info is duplicated, but
|
257
|
+
it is at least more cleanly separated from the normal arguments...
|
258
|
+
|
259
|
+
<div class="code" style="width: 40em"><pre>
|
260
|
+
[TestFixture(100.0, 42, TypeArgs=new Type[] {typeof(double), typeof(int) } )]
|
261
|
+
[TestFixture(42, 100.0, TypeArgs=new Type[] {typeof(int), typeof(double) } )]
|
262
|
+
public class SpecifyTypeArgsSeparately<T1, T2>
|
263
|
+
{
|
264
|
+
T1 t1;
|
265
|
+
T2 t2;
|
266
|
+
|
267
|
+
public SpecifyTypeArgsSeparately(T1 t1, T2 t2)
|
268
|
+
{
|
269
|
+
this.t1 = t1;
|
270
|
+
this.t2 = t2;
|
271
|
+
}
|
272
|
+
|
273
|
+
[TestCase(5, 7)]
|
274
|
+
public void TestMyArgTypes(T1 t1, T2 t2)
|
275
|
+
{
|
276
|
+
Assert.That(t1, Is.TypeOf<T1>());
|
277
|
+
Assert.That(t2, Is.TypeOf<T2>());
|
278
|
+
}
|
279
|
+
}</pre></div>
|
280
|
+
|
281
|
+
<li>In some cases, when the constructor makes use of all the type parameters
|
282
|
+
NUnit may simply be able to deduce them from the arguments provided.
|
283
|
+
That's the case here and the following is the preferred way to
|
284
|
+
write this example...
|
285
|
+
|
286
|
+
<div class="code"><pre>
|
287
|
+
[TestFixture(100.0, 42)]
|
288
|
+
[TestFixture(42, 100.0)]
|
289
|
+
public class DeduceTypeArgsFromArgs<T1, T2>
|
290
|
+
{
|
291
|
+
T1 t1;
|
292
|
+
T2 t2;
|
293
|
+
|
294
|
+
public DeduceTypeArgsFromArgs(T1 t1, T2 t2)
|
295
|
+
{
|
296
|
+
this.t1 = t1;
|
297
|
+
this.t2 = t2;
|
298
|
+
}
|
299
|
+
|
300
|
+
[TestCase(5, 7)]
|
301
|
+
public void TestMyArgTypes(T1 t1, T2 t2)
|
302
|
+
{
|
303
|
+
Assert.That(t1, Is.TypeOf<T1>());
|
304
|
+
Assert.That(t2, Is.TypeOf<T2>());
|
305
|
+
}
|
306
|
+
}</pre></div>
|
307
|
+
</ol>
|
308
|
+
|
120
309
|
</div>
|
121
310
|
|
122
311
|
<!-- Submenu -->
|
123
312
|
<div id="subnav">
|
124
313
|
<ul>
|
125
|
-
<li><a href="index.html">NUnit 2.
|
314
|
+
<li><a href="index.html">NUnit 2.5</a></li>
|
126
315
|
<ul>
|
127
316
|
<li><a href="getStarted.html">Getting Started</a></li>
|
128
317
|
<li><a href="assertions.html">Assertions</a></li>
|
318
|
+
<li><a href="constraintModel.html">Constraints</a></li>
|
129
319
|
<li><a href="attributes.html">Attributes</a></li>
|
130
320
|
<ul>
|
131
321
|
<li><a href="category.html">Category</a></li>
|
322
|
+
<li><a href="combinatorial.html">Combinatorial</a></li>
|
132
323
|
<li><a href="culture.html">Culture</a></li>
|
324
|
+
<li><a href="datapoint.html">Datapoint(s)</a></li>
|
133
325
|
<li><a href="description.html">Description</a></li>
|
134
|
-
<li><a href="exception.html">
|
326
|
+
<li><a href="exception.html">Exception</a></li>
|
135
327
|
<li><a href="explicit.html">Explicit</a></li>
|
136
328
|
<li><a href="ignore.html">Ignore</a></li>
|
329
|
+
<li><a href="maxtime.html">Maxtime</a></li>
|
330
|
+
<li><a href="pairwise.html">Pairwise</a></li>
|
137
331
|
<li><a href="platform.html">Platform</a></li>
|
138
332
|
<li><a href="property.html">Property</a></li>
|
333
|
+
<li><a href="random.html">Random</a></li>
|
334
|
+
<li><a href="range.html">Range</a></li>
|
335
|
+
<li><a href="repeat.html">Repeat</a></li>
|
336
|
+
<li><a href="requiredAddin.html">RequiredAddin</a></li>
|
337
|
+
<li><a href="requiresMTA.html">Requires MTA</a></li>
|
338
|
+
<li><a href="requiresSTA.html">Requires STA</a></li>
|
339
|
+
<li><a href="requiresThread.html">Requires Thread</a></li>
|
340
|
+
<li><a href="sequential.html">Sequential</a></li>
|
139
341
|
<li><a href="setCulture.html">SetCulture</a></li>
|
140
342
|
<li><a href="setup.html">Setup</a></li>
|
141
|
-
<li><a href="setupFixture.html">
|
343
|
+
<li><a href="setupFixture.html">SetupFixture</a></li>
|
142
344
|
<li><a href="suite.html">Suite</a></li>
|
143
345
|
<li><a href="teardown.html">Teardown</a></li>
|
144
346
|
<li><a href="test.html">Test</a></li>
|
145
|
-
<li
|
146
|
-
<li><a href="
|
147
|
-
<li><a href="
|
347
|
+
<li><a href="testCase.html">TestCase</a></li>
|
348
|
+
<li><a href="testCaseSource.html">TestCaseSource</a></li>
|
349
|
+
<li id="current"><a href="testFixture.html">TestFixture</a></li>
|
350
|
+
<li><a href="fixtureSetup.html">TestFixtureSetUp</a></li>
|
351
|
+
<li><a href="fixtureTeardown.html">TestFixtureTearDown</a></li>
|
352
|
+
<li><a href="theory.html">Theory</a></li>
|
353
|
+
<li><a href="timeout.html">Timeout</a></li>
|
354
|
+
<li><a href="values.html">Values</a></li>
|
355
|
+
<li><a href="valueSource.html">ValueSource</a></li>
|
148
356
|
</ul>
|
149
357
|
<li><a href="nunit-console.html">Console Runner</a></li>
|
150
358
|
<li><a href="nunit-gui.html">Gui Runner</a></li>
|
151
|
-
<li><a href="
|
359
|
+
<li><a href="configFiles.html">Configuration Files</a></li>
|
360
|
+
<li><a href="pnunit.html">PNUnit</a></li>
|
361
|
+
<li><a href="multiAssembly.html">Multiple Assemblies</a></li>
|
362
|
+
<li><a href="vsSupport.html">Visual Studio Support</a></li>
|
363
|
+
<li><a href="extensibility.html">Extensibility</a></li>
|
152
364
|
<li><a href="releaseNotes.html">Release Notes</a></li>
|
153
365
|
<li><a href="samples.html">Samples</a></li>
|
154
366
|
<li><a href="license.html">License</a></li>
|
@@ -160,7 +372,7 @@ public class SuccessTests
|
|
160
372
|
|
161
373
|
<!-- Standard Footer for NUnit.org -->
|
162
374
|
<div id="footer">
|
163
|
-
Copyright ©
|
375
|
+
Copyright © 2009 Charlie Poole. All Rights Reserved.
|
164
376
|
</div>
|
165
377
|
<!-- End of Footer -->
|
166
378
|
|
data/docs/testProperties.html
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
<!-- saved from url=(0014)about:internet --><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
|
2
2
|
<html>
|
3
3
|
<!-- Standard Head Part -->
|
4
4
|
<head>
|
@@ -39,10 +39,11 @@ 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.
|
42
|
+
<li><a href="index.html">NUnit 2.5</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>
|
46
|
+
<li><a href="constraintModel.html">Constraints</a></li>
|
46
47
|
<li><a href="attributes.html">Attributes</a></li>
|
47
48
|
<li><a href="nunit-console.html">Console Runner</a></li>
|
48
49
|
<li><a href="nunit-gui.html">Gui Runner</a></li>
|
@@ -50,13 +51,17 @@ which causes it to remain open as the user clicks on different tests.</p>
|
|
50
51
|
<li><a href="guiCommandLine.html">Command-Line</a></li>
|
51
52
|
<li><a href="mainMenu.html">Main Menu</a></li>
|
52
53
|
<li><a href="contextMenu.html">Context Menu</a></li>
|
53
|
-
<li><a href="
|
54
|
+
<li><a href="settingsDialog.html">Settings Dialog</a></li>
|
54
55
|
<li><a href="addinsDialog.html">Addins Dialog</a></li>
|
55
56
|
<li id="current"><a href="testProperties.html">Test Properties</a></li>
|
56
57
|
<li><a href="configEditor.html">Configuration Editor</a></li>
|
57
58
|
<li><a href="projectEditor.html">Project Editor</a></li>
|
58
59
|
</ul>
|
59
|
-
<li><a href="
|
60
|
+
<li><a href="configFiles.html">Configuration Files</a></li>
|
61
|
+
<li><a href="pnunit.html">PNUnit</a></li>
|
62
|
+
<li><a href="multiAssembly.html">Multiple Assemblies</a></li>
|
63
|
+
<li><a href="vsSupport.html">Visual Studio Support</a></li>
|
64
|
+
<li><a href="extensibility.html">Extensibility</a></li>
|
60
65
|
<li><a href="releaseNotes.html">Release Notes</a></li>
|
61
66
|
<li><a href="samples.html">Samples</a></li>
|
62
67
|
<li><a href="license.html">License</a></li>
|
@@ -68,7 +73,7 @@ which causes it to remain open as the user clicks on different tests.</p>
|
|
68
73
|
|
69
74
|
<!-- Standard Footer for NUnit.org -->
|
70
75
|
<div id="footer">
|
71
|
-
Copyright ©
|
76
|
+
Copyright © 2009 Charlie Poole. All Rights Reserved.
|
72
77
|
</div>
|
73
78
|
<!-- End of Footer -->
|
74
79
|
|