nunit 2.4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/docs/addinsDialog.html +74 -0
- data/docs/assertions.html +91 -0
- data/docs/attributes.html +89 -0
- data/docs/category.html +265 -0
- data/docs/classicModel.html +92 -0
- data/docs/codeFuncs.js +77 -0
- data/docs/collectionAssert.html +162 -0
- data/docs/collectionConstraints.html +130 -0
- data/docs/comparisonAsserts.html +271 -0
- data/docs/comparisonConstraints.html +109 -0
- data/docs/compoundConstraints.html +97 -0
- data/docs/conditionAsserts.html +123 -0
- data/docs/conditionConstraints.html +106 -0
- data/docs/configEditor.html +93 -0
- data/docs/configFiles.html +155 -0
- data/docs/consoleCommandLine.html +271 -0
- data/docs/constraintModel.html +134 -0
- data/docs/contextMenu.html +106 -0
- data/docs/culture.html +255 -0
- data/docs/customAsserts.html +115 -0
- data/docs/customConstraints.html +101 -0
- data/docs/description.html +178 -0
- data/docs/equalConstraint.html +139 -0
- data/docs/equalityAsserts.html +187 -0
- data/docs/exception.html +296 -0
- data/docs/explicit.html +256 -0
- data/docs/extensibility.html +83 -0
- data/docs/favicon.ico +0 -0
- data/docs/features.html +75 -0
- data/docs/fileAssert.html +114 -0
- data/docs/files/QuickStart.Spanish.doc +0 -0
- data/docs/files/QuickStart.doc +0 -0
- data/docs/files/Results.xsd +70 -0
- data/docs/files/Summary.xslt +47 -0
- data/docs/files/TestResult.xml +103 -0
- data/docs/files/Thumbs.db +0 -0
- data/docs/fixtureSetup.html +201 -0
- data/docs/fixtureTeardown.html +204 -0
- data/docs/getStarted.html +80 -0
- data/docs/guiCommandLine.html +183 -0
- data/docs/identityAsserts.html +99 -0
- data/docs/ignore.html +249 -0
- data/docs/img/addinsDialog.JPG +0 -0
- data/docs/img/assembliesTab.jpg +0 -0
- data/docs/img/assemblyReloadOptions.JPG +0 -0
- data/docs/img/bulletOff.gif +0 -0
- data/docs/img/bulletOn.gif +0 -0
- data/docs/img/configEditor.jpg +0 -0
- data/docs/img/console-mock.jpg +0 -0
- data/docs/img/displayTab.jpg +0 -0
- data/docs/img/generalOptions.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/langFilter.gif +0 -0
- data/docs/img/logo.gif +0 -0
- data/docs/img/miniGui.jpg +0 -0
- data/docs/img/optionsDialog.jpg +0 -0
- data/docs/img/resultTab.jpg +0 -0
- data/docs/img/testLoadOptions.jpg +0 -0
- data/docs/img/testOutputOptions.jpg +0 -0
- data/docs/img/testProperties.jpg +0 -0
- data/docs/img/testResultOptions.JPG +0 -0
- data/docs/img/testTab.jpg +0 -0
- data/docs/img/testsTab.JPG +0 -0
- data/docs/img/textOutputOptions.jpg +0 -0
- data/docs/img/treeDisplayOptions.JPG +0 -0
- data/docs/img/visualStudioOptions.JPG +0 -0
- data/docs/index.html +75 -0
- data/docs/installation.html +172 -0
- data/docs/license.html +88 -0
- data/docs/listMapper.html +100 -0
- data/docs/mainMenu.html +260 -0
- data/docs/multiAssembly.html +130 -0
- data/docs/nunit-console.html +84 -0
- data/docs/nunit-gui.html +115 -0
- data/docs/nunit.css +118 -0
- data/docs/nunitAddins.html +331 -0
- data/docs/optionsDialog.html +262 -0
- data/docs/platform.html +285 -0
- data/docs/platformSupport.html +99 -0
- data/docs/projectEditor.html +127 -0
- data/docs/property.html +219 -0
- data/docs/propertyConstraint.html +89 -0
- data/docs/quickStart.html +314 -0
- data/docs/releaseNotes.html +1235 -0
- data/docs/sameasConstraint.html +98 -0
- data/docs/samples.html +126 -0
- data/docs/setCulture.html +173 -0
- data/docs/setup.html +199 -0
- data/docs/setupFixture.html +198 -0
- data/docs/stringAssert.html +107 -0
- data/docs/stringConstraints.html +111 -0
- data/docs/suite.html +222 -0
- data/docs/teardown.html +204 -0
- data/docs/test.html +171 -0
- data/docs/testFixture.html +168 -0
- data/docs/testProperties.html +76 -0
- data/docs/typeAsserts.html +101 -0
- data/docs/typeConstraints.html +103 -0
- data/docs/upgrade.html +97 -0
- data/docs/utilityAsserts.html +108 -0
- data/docs/vsSupport.html +140 -0
- data/lib/net-1.1/Failure.jpg +0 -0
- data/lib/net-1.1/Ignored.jpg +0 -0
- data/lib/net-1.1/NUnitFitTests.html +277 -0
- data/lib/net-1.1/NUnitTests.config +84 -0
- data/lib/net-1.1/NUnitTests.nunit +14 -0
- data/lib/net-1.1/Success.jpg +0 -0
- data/lib/net-1.1/clr.bat +96 -0
- data/lib/net-1.1/fit.dll +0 -0
- data/lib/net-1.1/loadtest-assembly.dll +0 -0
- 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.exe +0 -0
- data/lib/net-1.1/nunit-console.exe.config +117 -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.exe.config +121 -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.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 +5622 -0
- 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/nunit.util.tests.dll +0 -0
- data/lib/net-1.1/runFile.exe +0 -0
- data/lib/net-1.1/runFile.exe.config +43 -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/NUnitFitTests.html +277 -0
- data/lib/net-2.0/NUnitTests.config +84 -0
- data/lib/net-2.0/NUnitTests.nunit +14 -0
- data/lib/net-2.0/Success.jpg +0 -0
- data/lib/net-2.0/clr.bat +96 -0
- data/lib/net-2.0/fit.dll +0 -0
- data/lib/net-2.0/loadtest-assembly.dll +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-x86.exe +0 -0
- data/lib/net-2.0/nunit-console-x86.exe.config +117 -0
- data/lib/net-2.0/nunit-console.exe +0 -0
- data/lib/net-2.0/nunit-console.exe.config +117 -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-x86.exe +0 -0
- data/lib/net-2.0/nunit-x86.exe.config +121 -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.exe +0 -0
- data/lib/net-2.0/nunit.exe.config +121 -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.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 +5622 -0
- 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/nunit.util.tests.dll +0 -0
- data/lib/net-2.0/runFile.exe +0 -0
- data/lib/net-2.0/runFile.exe.config +43 -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
- metadata +262 -0
data/docs/exception.html
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
|
|
2
|
+
<html>
|
|
3
|
+
<!-- Standard Head Part -->
|
|
4
|
+
<head>
|
|
5
|
+
<title>NUnit - Exception</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
|
+
<script language="JavaScript" src="codeFuncs.js" ></script> <!-- Do it this way for IE -->
|
|
28
|
+
|
|
29
|
+
<h3>ExpectedExceptionAttribute (NUnit 2.0 plus Updates)</h3>
|
|
30
|
+
|
|
31
|
+
<p>This is the way to specify that the execution of a test will throw an
|
|
32
|
+
exception. This attribute has a number of positional and
|
|
33
|
+
named parameters, which we will discuss in separate sections
|
|
34
|
+
according to the purpose they serve.</p>
|
|
35
|
+
|
|
36
|
+
<h4>Specifying the Expected Exception Type</h4>
|
|
37
|
+
|
|
38
|
+
<p>The original attribute, introduced with NUnit 2.0 took a single
|
|
39
|
+
argument giving the exact type of the expected exception. For example...</p>
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
<div class="code"><pre>[ExpectedException( typeof( ArgumentException ) )]
|
|
43
|
+
public void TestMethod()
|
|
44
|
+
{
|
|
45
|
+
...</pre></div>
|
|
46
|
+
|
|
47
|
+
<p>Beginning with NUnit 2.2.4, it became possible to specify the type
|
|
48
|
+
of exception as a string, avoiding the need for a reference to the
|
|
49
|
+
defining assembly...</p>
|
|
50
|
+
|
|
51
|
+
<div class="code"><pre>[ExpectedException( "System.ArgumentException" ) )]
|
|
52
|
+
public void TestMethod()
|
|
53
|
+
{
|
|
54
|
+
...</pre></div>
|
|
55
|
+
|
|
56
|
+
<p>The above two examples function identically: the test only succeeds if a
|
|
57
|
+
System.Argument exception is thrown.</p>
|
|
58
|
+
|
|
59
|
+
<h4>Specifying the Expected Message</h4>
|
|
60
|
+
|
|
61
|
+
<p>NUnit 2.1 introduced a constructor with a second argument, specifying the
|
|
62
|
+
exact text of the message property of the exception. After NUnit 2.2.4, the
|
|
63
|
+
same extension was made to the constructor taking a string argument. With
|
|
64
|
+
NUnit 2.4, these arguments are marked obsolete, and a named parameter
|
|
65
|
+
is provided instead...</p>
|
|
66
|
+
|
|
67
|
+
<div class="code" style="width: 44em"><pre>// Obsolete form:
|
|
68
|
+
[ExpectedException( typeof( ArgumentException ), "expected message" )]
|
|
69
|
+
[ExpectedException( "System.ArgumentException", "expected message" )]
|
|
70
|
+
|
|
71
|
+
// Prefered form:
|
|
72
|
+
[ExpectedException( typeof( ArgumentException ), ExpectedMessage="expected message" )]
|
|
73
|
+
[ExpectedException( "System.ArgumentException", ExpectedMessage="expected message" )]</pre></div>
|
|
74
|
+
|
|
75
|
+
<p>With NUnit 2.4, it is possible to specify additional tests on the
|
|
76
|
+
exception message, beyond a simple exact match. This is done using the
|
|
77
|
+
MatchType named parameter, whose argument is an enumeration, defined as
|
|
78
|
+
follows:</p>
|
|
79
|
+
|
|
80
|
+
<div class="code">
|
|
81
|
+
<pre>public enum MessageMatch
|
|
82
|
+
{
|
|
83
|
+
/// Expect an exact match
|
|
84
|
+
Exact,
|
|
85
|
+
/// Expect a message containing the parameter string
|
|
86
|
+
Contains,
|
|
87
|
+
/// Match the regular expression provided as a parameter
|
|
88
|
+
Regex
|
|
89
|
+
}</pre></div>
|
|
90
|
+
|
|
91
|
+
<p>The following example is for a test that passes only if an ArgumentException
|
|
92
|
+
with a message containing "unspecified" is received.</p>
|
|
93
|
+
|
|
94
|
+
<div class="code" style="width: 57em">
|
|
95
|
+
<pre>[ExpectedException( typeof( ArgumentException), ExpectedMessage="unspecified", MatchType=MessageMatch.Contains )]
|
|
96
|
+
public void TestMethod()
|
|
97
|
+
{
|
|
98
|
+
...</pre></div>
|
|
99
|
+
|
|
100
|
+
<p>If MatchType is not specified, an exact match is used as before.</p>
|
|
101
|
+
|
|
102
|
+
<h4>Specifying a Custom Error Message</h4>
|
|
103
|
+
|
|
104
|
+
<p>With NUnit 2.4, it is possible to specify a custom message to be
|
|
105
|
+
displayed if the ExpectedException attribute is not satisfied. This
|
|
106
|
+
is done through the UserMessage named parameter...</p>
|
|
107
|
+
|
|
108
|
+
<div class="code" style="width: 41em">
|
|
109
|
+
<pre>[ExpectedException( typeof( ArgumentException ), UserMessage="Custom message" )]
|
|
110
|
+
public void TestMethod()
|
|
111
|
+
{
|
|
112
|
+
...</pre>
|
|
113
|
+
</div>
|
|
114
|
+
|
|
115
|
+
<h4>Handling the Exception in Code</h4>
|
|
116
|
+
|
|
117
|
+
<p>If the processing required for an exception is too complex to express
|
|
118
|
+
in the attribute declaration, the normal practice is to process it in the
|
|
119
|
+
test code using a try/catch block. As an alternative, NUnit 2.4 allows
|
|
120
|
+
designating a method that will be called to process the exception. This
|
|
121
|
+
is particularly useful when multiple exceptions need to be processed
|
|
122
|
+
in the same way.</p>
|
|
123
|
+
|
|
124
|
+
<p>An common exception handler may be designated by implementing the
|
|
125
|
+
<b>IExpectExceptionInterface</b>, which is defined as follows...</p>
|
|
126
|
+
|
|
127
|
+
<div class="code">
|
|
128
|
+
<pre>public interface IExpectException
|
|
129
|
+
{
|
|
130
|
+
void HandleException( System.Exception ex );
|
|
131
|
+
}</pre>
|
|
132
|
+
</div>
|
|
133
|
+
|
|
134
|
+
<p>The exception handler is only called for methods marked with
|
|
135
|
+
the <b>ExpectedException</b> attribute. If all checks - including
|
|
136
|
+
the type of the exception - are to be performed in code, the
|
|
137
|
+
attribute may be specified without any arguments in order to
|
|
138
|
+
indicate that an exception is expected.</p>
|
|
139
|
+
|
|
140
|
+
<p>An handler may be designated for a particular method
|
|
141
|
+
using the <b>Handler</b> named parameter.</p>
|
|
142
|
+
|
|
143
|
+
<div class="code"><pre>[ExpectedException( Handler="HandlerMethod" )]
|
|
144
|
+
public void TestMethod()
|
|
145
|
+
{
|
|
146
|
+
...
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
public void HandlerMethod( System.Exception ex )
|
|
150
|
+
{
|
|
151
|
+
...
|
|
152
|
+
}</pre></div>
|
|
153
|
+
|
|
154
|
+
<p>This technique may be
|
|
155
|
+
used without implementing <b>IExpectException</b> or in
|
|
156
|
+
combination with it. In the latter case, the designated handler
|
|
157
|
+
applies to any method that specifies it, while the normal
|
|
158
|
+
exception handler applies to any other methods that specify
|
|
159
|
+
an <b>ExpectedException</b>.</p>
|
|
160
|
+
|
|
161
|
+
<p>However it is specified, the handler method should examine the exception and
|
|
162
|
+
<b>Assert</b> on whatever properties are relevant. Any resulting failure message
|
|
163
|
+
will then be consistent in format with other assertions performed in the tests.</p>
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
<h4>Example:</h4>
|
|
167
|
+
|
|
168
|
+
<div class="code">
|
|
169
|
+
|
|
170
|
+
<div class="langFilter">
|
|
171
|
+
<a href="javascript:Show('DD1')" onmouseover="Show('DD1')"><img src="img/langFilter.gif" width="14" height="14" alt="Language Filter"></a>
|
|
172
|
+
<div id="DD1" class="dropdown" style="display: none" onclick="Hide('DD1')">
|
|
173
|
+
<a href="javascript:ShowCS()">C#</a><br>
|
|
174
|
+
<a href="javascript:ShowVB()">VB</a><br>
|
|
175
|
+
<a href="javascript:ShowMC()">C++</a><br>
|
|
176
|
+
</div>
|
|
177
|
+
</div>
|
|
178
|
+
|
|
179
|
+
<pre class="cs">namespace NUnit.Tests
|
|
180
|
+
{
|
|
181
|
+
using System;
|
|
182
|
+
using NUnit.Framework;
|
|
183
|
+
|
|
184
|
+
[TestFixture]
|
|
185
|
+
public class SuccessTests
|
|
186
|
+
{
|
|
187
|
+
[Test]
|
|
188
|
+
[ExpectedException(typeof(InvalidOperationException))]
|
|
189
|
+
public void ExpectAnExceptionByType()
|
|
190
|
+
{ /* ... */ }
|
|
191
|
+
|
|
192
|
+
[Test]
|
|
193
|
+
[ExpectedException("System.InvalidOperationException")]
|
|
194
|
+
public void ExpectAnExceptionByName()
|
|
195
|
+
{ /* ... */ }
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
</pre>
|
|
199
|
+
|
|
200
|
+
<pre class="vb">Imports System
|
|
201
|
+
Imports Nunit.Framework
|
|
202
|
+
|
|
203
|
+
Namespace Nunit.Tests
|
|
204
|
+
|
|
205
|
+
<TestFixture()> Public Class SuccessTests
|
|
206
|
+
<Test(), ExpectedException(GetType(Exception))>
|
|
207
|
+
Public Sub ExpectAnExceptionByType()
|
|
208
|
+
' ...
|
|
209
|
+
End Sub
|
|
210
|
+
|
|
211
|
+
<TestFixture()> Public Class SuccessTests
|
|
212
|
+
<Test(), ExpectedException("System.Exception")>
|
|
213
|
+
Public Sub ExpectAnExceptionByName()
|
|
214
|
+
' ...
|
|
215
|
+
End Sub
|
|
216
|
+
End Class
|
|
217
|
+
End Namespace
|
|
218
|
+
</pre>
|
|
219
|
+
|
|
220
|
+
<pre class="mc">#using <Nunit.Framework.dll>
|
|
221
|
+
using namespace System;
|
|
222
|
+
using namespace NUnit::Framework;
|
|
223
|
+
|
|
224
|
+
namespace NUnitTests
|
|
225
|
+
{
|
|
226
|
+
[TestFixture]
|
|
227
|
+
public __gc class SuccessTests
|
|
228
|
+
{
|
|
229
|
+
[Test]
|
|
230
|
+
[ExpectedException(__typeof(InvalidOperationException))]
|
|
231
|
+
void ExpectAnExceptionByType();
|
|
232
|
+
|
|
233
|
+
[Test]
|
|
234
|
+
[ExpectedException(S"SystemInvalidOperationException")]
|
|
235
|
+
void ExpectAnExceptionByName();
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
#include "cppsample.h"
|
|
240
|
+
|
|
241
|
+
namespace NUnitTests {
|
|
242
|
+
// ...
|
|
243
|
+
}
|
|
244
|
+
</pre>
|
|
245
|
+
|
|
246
|
+
</div>
|
|
247
|
+
|
|
248
|
+
</div>
|
|
249
|
+
|
|
250
|
+
<!-- Submenu -->
|
|
251
|
+
<div id="subnav">
|
|
252
|
+
<ul>
|
|
253
|
+
<li><a href="index.html">NUnit 2.4.8</a></li>
|
|
254
|
+
<ul>
|
|
255
|
+
<li><a href="getStarted.html">Getting Started</a></li>
|
|
256
|
+
<li><a href="assertions.html">Assertions</a></li>
|
|
257
|
+
<li><a href="attributes.html">Attributes</a></li>
|
|
258
|
+
<ul>
|
|
259
|
+
<li><a href="category.html">Category</a></li>
|
|
260
|
+
<li><a href="culture.html">Culture</a></li>
|
|
261
|
+
<li><a href="description.html">Description</a></li>
|
|
262
|
+
<li id="current"><a href="exception.html">Expected Exception</a></li>
|
|
263
|
+
<li><a href="explicit.html">Explicit</a></li>
|
|
264
|
+
<li><a href="ignore.html">Ignore</a></li>
|
|
265
|
+
<li><a href="platform.html">Platform</a></li>
|
|
266
|
+
<li><a href="property.html">Property</a></li>
|
|
267
|
+
<li><a href="setCulture.html">SetCulture</a></li>
|
|
268
|
+
<li><a href="setup.html">Setup</a></li>
|
|
269
|
+
<li><a href="setupFixture.html">SetUp Fixture</a></li>
|
|
270
|
+
<li><a href="suite.html">Suite</a></li>
|
|
271
|
+
<li><a href="teardown.html">Teardown</a></li>
|
|
272
|
+
<li><a href="test.html">Test</a></li>
|
|
273
|
+
<li><a href="testFixture.html">Test Fixture</a></li>
|
|
274
|
+
<li><a href="fixtureSetup.html">Test Fixture SetUp</a></li>
|
|
275
|
+
<li><a href="fixtureTeardown.html">Test Fixture TearDown</a></li>
|
|
276
|
+
</ul>
|
|
277
|
+
<li><a href="nunit-console.html">Console Runner</a></li>
|
|
278
|
+
<li><a href="nunit-gui.html">Gui Runner</a></li>
|
|
279
|
+
<li><a href="features.html">Other Features</a></li>
|
|
280
|
+
<li><a href="releaseNotes.html">Release Notes</a></li>
|
|
281
|
+
<li><a href="samples.html">Samples</a></li>
|
|
282
|
+
<li><a href="license.html">License</a></li>
|
|
283
|
+
</ul>
|
|
284
|
+
</ul>
|
|
285
|
+
</div>
|
|
286
|
+
<!-- End of Submenu -->
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
<!-- Standard Footer for NUnit.org -->
|
|
290
|
+
<div id="footer">
|
|
291
|
+
Copyright © 2008 Charlie Poole. All Rights Reserved.
|
|
292
|
+
</div>
|
|
293
|
+
<!-- End of Footer -->
|
|
294
|
+
|
|
295
|
+
</body>
|
|
296
|
+
</html>
|
data/docs/explicit.html
ADDED
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
|
|
2
|
+
<html>
|
|
3
|
+
<!-- Standard Head Part -->
|
|
4
|
+
<head>
|
|
5
|
+
<title>NUnit - Explicit</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
|
+
<script language="JavaScript" src="codeFuncs.js" ></script> <!-- Do it this way for IE -->
|
|
28
|
+
|
|
29
|
+
<h3>ExplicitAttribute (NUnit 2.2)</h3>
|
|
30
|
+
|
|
31
|
+
<p>The Explicit attribute causes a test or test fixture to be ignored unless it is
|
|
32
|
+
explicitly selected for running. The test or fixture will be run if it is
|
|
33
|
+
selected in the gui, if its name is specified on the console runner command
|
|
34
|
+
line as the fixture to run or if it is included by use of a Category filter.</p>
|
|
35
|
+
|
|
36
|
+
<p>An optional string argument may be used to give the reason for marking
|
|
37
|
+
the test Explicit.</p>
|
|
38
|
+
|
|
39
|
+
<p>If a test or fixture with the Explicit attribute is encountered in the course of
|
|
40
|
+
running tests, it is skipped unless it has been specifically selected by one
|
|
41
|
+
of the above means. The test does not affect the outcome of the run at all:
|
|
42
|
+
it is not considered as ignored and is not even counted in the total number
|
|
43
|
+
of tests. In the gui, the tree node for the test remains gray and the
|
|
44
|
+
status bar color is not affected.</p>
|
|
45
|
+
|
|
46
|
+
<blockquote><i><b>Note:</b> In versions of NUnit prior to 2.4, these tests were
|
|
47
|
+
shown as ignored.</i></blockquote>
|
|
48
|
+
|
|
49
|
+
<h4>Test Fixture Syntax</h4>
|
|
50
|
+
|
|
51
|
+
<div id="trace">
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<div class="code cs">
|
|
55
|
+
|
|
56
|
+
<div class="langFilter">
|
|
57
|
+
<a href="javascript:Show('DD1')" onmouseover="Show('DD1')"><img src="img/langFilter.gif" width="14" height="14" alt="Language Filter"></a>
|
|
58
|
+
<div id="DD1" class="dropdown" style="display: none;" onclick="Hide('DD1')">
|
|
59
|
+
<a href="javascript:ShowCS()">C#</a><br>
|
|
60
|
+
<a href="javascript:ShowVB()">VB</a><br>
|
|
61
|
+
<a href="javascript:ShowMC()">C++</a><br>
|
|
62
|
+
<a href="javascript:ShowJS()">J#</a><br>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
<pre class="cs">namespace NUnit.Tests
|
|
67
|
+
{
|
|
68
|
+
using System;
|
|
69
|
+
using NUnit.Framework;
|
|
70
|
+
|
|
71
|
+
[TestFixture, Explicit]
|
|
72
|
+
public class ExplicitTests
|
|
73
|
+
{
|
|
74
|
+
// ...
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
</pre>
|
|
78
|
+
|
|
79
|
+
<pre class="vb">Imports System
|
|
80
|
+
Imports Nunit.Framework
|
|
81
|
+
|
|
82
|
+
Namespace Nunit.Tests
|
|
83
|
+
|
|
84
|
+
<TestFixture(), Explicit()>
|
|
85
|
+
Public Class ExplicitTests
|
|
86
|
+
' ...
|
|
87
|
+
End Class
|
|
88
|
+
End Namespace
|
|
89
|
+
</pre>
|
|
90
|
+
|
|
91
|
+
<pre class="mc">#using <Nunit.Framework.dll>
|
|
92
|
+
using namespace System;
|
|
93
|
+
using namespace NUnit::Framework;
|
|
94
|
+
|
|
95
|
+
namespace NUnitTests
|
|
96
|
+
{
|
|
97
|
+
[TestFixture]
|
|
98
|
+
[Explicit]
|
|
99
|
+
public __gc class ExplicitTests
|
|
100
|
+
{
|
|
101
|
+
// ...
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
#include "cppsample.h"
|
|
106
|
+
|
|
107
|
+
namespace NUnitTests {
|
|
108
|
+
// ...
|
|
109
|
+
}
|
|
110
|
+
</pre>
|
|
111
|
+
|
|
112
|
+
<pre class="js">package NUnit.Tests;
|
|
113
|
+
|
|
114
|
+
import System.*;
|
|
115
|
+
import NUnit.Framework.TestFixture;
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
/** @attribute NUnit.Framework.TestFixture() */
|
|
119
|
+
/** @attribute NUnit.Framework.Explicit() */
|
|
120
|
+
public class ExplicitTests
|
|
121
|
+
{
|
|
122
|
+
// ...
|
|
123
|
+
}
|
|
124
|
+
</pre>
|
|
125
|
+
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
<h4>Test Syntax</h4>
|
|
129
|
+
|
|
130
|
+
<div class="code">
|
|
131
|
+
|
|
132
|
+
<div class="langFilter">
|
|
133
|
+
<a href="javascript:Show('DD2')" onmouseover="Show('DD2')"><img src="img/langFilter.gif" width="14" height="14" alt="Language Filter"></a>
|
|
134
|
+
<div id="DD2" class="dropdown" style="display: none;" onclick="Hide('DD2')">
|
|
135
|
+
<a href="javascript:ShowCS()">C#</a><br>
|
|
136
|
+
<a href="javascript:ShowVB()">VB</a><br>
|
|
137
|
+
<a href="javascript:ShowMC()">C++</a><br>
|
|
138
|
+
<a href="javascript:ShowJS()">J#</a><br>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
|
|
142
|
+
<pre class="cs">namespace NUnit.Tests
|
|
143
|
+
{
|
|
144
|
+
using System;
|
|
145
|
+
using NUnit.Framework;
|
|
146
|
+
|
|
147
|
+
[TestFixture]
|
|
148
|
+
public class SuccessTests
|
|
149
|
+
{
|
|
150
|
+
[Test, Explicit]
|
|
151
|
+
public void ExplicitTest()
|
|
152
|
+
{ /* ... */ }
|
|
153
|
+
}
|
|
154
|
+
</pre>
|
|
155
|
+
|
|
156
|
+
<pre class="vb">Imports System
|
|
157
|
+
Imports Nunit.Framework
|
|
158
|
+
|
|
159
|
+
Namespace Nunit.Tests
|
|
160
|
+
|
|
161
|
+
<TestFixture()>
|
|
162
|
+
Public Class SuccessTests
|
|
163
|
+
<Test(), Explicit()> Public Sub ExplicitTest()
|
|
164
|
+
' ...
|
|
165
|
+
End Sub
|
|
166
|
+
End Class
|
|
167
|
+
End Namespace
|
|
168
|
+
</pre>
|
|
169
|
+
|
|
170
|
+
<pre class="mc">#using <Nunit.Framework.dll>
|
|
171
|
+
using namespace System;
|
|
172
|
+
using namespace NUnit::Framework;
|
|
173
|
+
|
|
174
|
+
namespace NUnitTests
|
|
175
|
+
{
|
|
176
|
+
[TestFixture]
|
|
177
|
+
public __gc class SuccessTests
|
|
178
|
+
{
|
|
179
|
+
[Test][Explicit] void ExplicitTest();
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
#include "cppsample.h"
|
|
184
|
+
|
|
185
|
+
namespace NUnitTests {
|
|
186
|
+
// ...
|
|
187
|
+
}
|
|
188
|
+
</pre>
|
|
189
|
+
|
|
190
|
+
<pre class="js">package NUnit.Tests;
|
|
191
|
+
|
|
192
|
+
import System.*;
|
|
193
|
+
import NUnit.Framework.TestFixture;
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
/** @attribute NUnit.Framework.TestFixture() */
|
|
197
|
+
public class SuccessTests
|
|
198
|
+
{
|
|
199
|
+
/** @attribute NUnit.Framework.Test() */
|
|
200
|
+
/** @attribute NUnit.Framework.Explicit() */
|
|
201
|
+
public void ExplicitTest()
|
|
202
|
+
{ /* ... */ }
|
|
203
|
+
}
|
|
204
|
+
</pre>
|
|
205
|
+
|
|
206
|
+
</div>
|
|
207
|
+
|
|
208
|
+
</div>
|
|
209
|
+
|
|
210
|
+
<!-- Submenu -->
|
|
211
|
+
<div id="subnav">
|
|
212
|
+
<ul>
|
|
213
|
+
<li><a href="index.html">NUnit 2.4.8</a></li>
|
|
214
|
+
<ul>
|
|
215
|
+
<li><a href="getStarted.html">Getting Started</a></li>
|
|
216
|
+
<li><a href="assertions.html">Assertions</a></li>
|
|
217
|
+
<li><a href="attributes.html">Attributes</a></li>
|
|
218
|
+
<ul>
|
|
219
|
+
<li><a href="category.html">Category</a></li>
|
|
220
|
+
<li><a href="culture.html">Culture</a></li>
|
|
221
|
+
<li><a href="description.html">Description</a></li>
|
|
222
|
+
<li><a href="exception.html">Expected Exception</a></li>
|
|
223
|
+
<li id="current"><a href="explicit.html">Explicit</a></li>
|
|
224
|
+
<li><a href="ignore.html">Ignore</a></li>
|
|
225
|
+
<li><a href="platform.html">Platform</a></li>
|
|
226
|
+
<li><a href="property.html">Property</a></li>
|
|
227
|
+
<li><a href="setCulture.html">SetCulture</a></li>
|
|
228
|
+
<li><a href="setup.html">Setup</a></li>
|
|
229
|
+
<li><a href="setupFixture.html">SetUp Fixture</a></li>
|
|
230
|
+
<li><a href="suite.html">Suite</a></li>
|
|
231
|
+
<li><a href="teardown.html">Teardown</a></li>
|
|
232
|
+
<li><a href="test.html">Test</a></li>
|
|
233
|
+
<li><a href="testFixture.html">Test Fixture</a></li>
|
|
234
|
+
<li><a href="fixtureSetup.html">Test Fixture SetUp</a></li>
|
|
235
|
+
<li><a href="fixtureTeardown.html">Test Fixture TearDown</a></li>
|
|
236
|
+
</ul>
|
|
237
|
+
<li><a href="nunit-console.html">Console Runner</a></li>
|
|
238
|
+
<li><a href="nunit-gui.html">Gui Runner</a></li>
|
|
239
|
+
<li><a href="features.html">Other Features</a></li>
|
|
240
|
+
<li><a href="releaseNotes.html">Release Notes</a></li>
|
|
241
|
+
<li><a href="samples.html">Samples</a></li>
|
|
242
|
+
<li><a href="license.html">License</a></li>
|
|
243
|
+
</ul>
|
|
244
|
+
</ul>
|
|
245
|
+
</div>
|
|
246
|
+
<!-- End of Submenu -->
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
<!-- Standard Footer for NUnit.org -->
|
|
250
|
+
<div id="footer">
|
|
251
|
+
Copyright © 2008 Charlie Poole. All Rights Reserved.
|
|
252
|
+
</div>
|
|
253
|
+
<!-- End of Footer -->
|
|
254
|
+
|
|
255
|
+
</body>
|
|
256
|
+
</html>
|