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
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
|
|
2
|
+
<html>
|
|
3
|
+
<!-- Standard Head Part -->
|
|
4
|
+
<head>
|
|
5
|
+
<title>NUnit - Description</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>Description (NUnit 2.4)</h3>
|
|
30
|
+
|
|
31
|
+
<p>The Description attribute is used to apply descriptive text to a Test,
|
|
32
|
+
TestFixture or Assembly. The text appears in the XML output file and is
|
|
33
|
+
shown in the Test Properties dialog.</p>
|
|
34
|
+
|
|
35
|
+
<h4>Example:</h4>
|
|
36
|
+
|
|
37
|
+
<div class="code">
|
|
38
|
+
|
|
39
|
+
<div class="langFilter">
|
|
40
|
+
<a href="javascript:Show('DD1')" onmouseover="Show('DD1')"><img src="img/langFilter.gif" width="14" height="14" alt="Language Filter"></a>
|
|
41
|
+
<div id="DD1" class="dropdown" style="display: none;" onclick="Hide('DD1')">
|
|
42
|
+
<a href="javascript:ShowCS()">C#</a><br>
|
|
43
|
+
<a href="javascript:ShowVB()">VB</a><br>
|
|
44
|
+
<a href="javascript:ShowMC()">C++</a><br>
|
|
45
|
+
<a href="javascript:ShowJS()">J#</a><br>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<pre class="cs">[assembly: Description("Assembly description here")]
|
|
50
|
+
|
|
51
|
+
namespace NUnit.Tests
|
|
52
|
+
{
|
|
53
|
+
using System;
|
|
54
|
+
using NUnit.Framework;
|
|
55
|
+
|
|
56
|
+
[TestFixture, Description("Fixture description here")]
|
|
57
|
+
public class SomeTests
|
|
58
|
+
{
|
|
59
|
+
[Test, Description("Test description here")]
|
|
60
|
+
public void OneTest()
|
|
61
|
+
{ /* ... */ }
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
</pre>
|
|
65
|
+
<pre class="vb"><assembly: Description("Assembly description here")>
|
|
66
|
+
|
|
67
|
+
Imports System
|
|
68
|
+
Imports Nunit.Framework
|
|
69
|
+
|
|
70
|
+
Namespace Nunit.Tests
|
|
71
|
+
|
|
72
|
+
<TestFixture(), Description("Fixture description here")>_
|
|
73
|
+
Public Class SomeTests
|
|
74
|
+
<Test(), Description("Test description here")>_
|
|
75
|
+
Public Sub OneTest()
|
|
76
|
+
' ...
|
|
77
|
+
End Sub
|
|
78
|
+
End Class
|
|
79
|
+
End Namespace
|
|
80
|
+
</pre>
|
|
81
|
+
<pre class="mc">[assembly:Description("Assembly description here")]
|
|
82
|
+
|
|
83
|
+
#using <Nunit.Framework.dll>
|
|
84
|
+
using namespace System;
|
|
85
|
+
using namespace NUnit::Framework;
|
|
86
|
+
|
|
87
|
+
namespace NUnitTests
|
|
88
|
+
{
|
|
89
|
+
[TestFixture, Description("Fixture description here")]
|
|
90
|
+
public __gc class SomeTests
|
|
91
|
+
{
|
|
92
|
+
[Test, Description("Test description here")]
|
|
93
|
+
void OneTest();
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
#include "cppsample.h"
|
|
98
|
+
|
|
99
|
+
namespace NUnitTests {
|
|
100
|
+
// ...
|
|
101
|
+
}
|
|
102
|
+
</pre>
|
|
103
|
+
|
|
104
|
+
<pre class="js">/** @assembly NUnit.Framework.Description("Assembly description here") */
|
|
105
|
+
|
|
106
|
+
package NUnit.Tests;
|
|
107
|
+
|
|
108
|
+
import System.*;
|
|
109
|
+
import NUnit.Framework.TestFixture;
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
/** @attribute NUnit.Framework.TestFixture() */
|
|
113
|
+
/** @attribute NUnit.Framework.Description("Fixture description here") */
|
|
114
|
+
public class SomeTests
|
|
115
|
+
{
|
|
116
|
+
/** @attribute NUnit.Framework.Test() */
|
|
117
|
+
/** @attribute NUnit.Framework.Description("Test description here") */
|
|
118
|
+
public void OneTest()
|
|
119
|
+
{ /* ... */ }
|
|
120
|
+
}
|
|
121
|
+
</pre>
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
<p><b>Note:</b> The Test and TestFixture attributes continue to support an
|
|
125
|
+
optional Description property. The Description attribute should be used for
|
|
126
|
+
new applciations. If both are used, the Description attribute takes precedence.</p>
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
</div>
|
|
131
|
+
|
|
132
|
+
<!-- Submenu -->
|
|
133
|
+
<div id="subnav">
|
|
134
|
+
<ul>
|
|
135
|
+
<li><a href="index.html">NUnit 2.4.8</a></li>
|
|
136
|
+
<ul>
|
|
137
|
+
<li><a href="getStarted.html">Getting Started</a></li>
|
|
138
|
+
<li><a href="assertions.html">Assertions</a></li>
|
|
139
|
+
<li><a href="attributes.html">Attributes</a></li>
|
|
140
|
+
<ul>
|
|
141
|
+
<li><a href="category.html">Category</a></li>
|
|
142
|
+
<li><a href="culture.html">Culture</a></li>
|
|
143
|
+
<li id="current"><a href="description.html">Description</a></li>
|
|
144
|
+
<li><a href="exception.html">Expected Exception</a></li>
|
|
145
|
+
<li><a href="explicit.html">Explicit</a></li>
|
|
146
|
+
<li><a href="ignore.html">Ignore</a></li>
|
|
147
|
+
<li><a href="platform.html">Platform</a></li>
|
|
148
|
+
<li><a href="property.html">Property</a></li>
|
|
149
|
+
<li><a href="setCulture.html">SetCulture</a></li>
|
|
150
|
+
<li><a href="setup.html">Setup</a></li>
|
|
151
|
+
<li><a href="setupFixture.html">SetUp Fixture</a></li>
|
|
152
|
+
<li><a href="suite.html">Suite</a></li>
|
|
153
|
+
<li><a href="teardown.html">Teardown</a></li>
|
|
154
|
+
<li><a href="test.html">Test</a></li>
|
|
155
|
+
<li><a href="testFixture.html">Test Fixture</a></li>
|
|
156
|
+
<li><a href="fixtureSetup.html">Test Fixture SetUp</a></li>
|
|
157
|
+
<li><a href="fixtureTeardown.html">Test Fixture TearDown</a></li>
|
|
158
|
+
</ul>
|
|
159
|
+
<li><a href="nunit-console.html">Console Runner</a></li>
|
|
160
|
+
<li><a href="nunit-gui.html">Gui Runner</a></li>
|
|
161
|
+
<li><a href="features.html">Other Features</a></li>
|
|
162
|
+
<li><a href="releaseNotes.html">Release Notes</a></li>
|
|
163
|
+
<li><a href="samples.html">Samples</a></li>
|
|
164
|
+
<li><a href="license.html">License</a></li>
|
|
165
|
+
</ul>
|
|
166
|
+
</ul>
|
|
167
|
+
</div>
|
|
168
|
+
<!-- End of Submenu -->
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
<!-- Standard Footer for NUnit.org -->
|
|
172
|
+
<div id="footer">
|
|
173
|
+
Copyright © 2008 Charlie Poole. All Rights Reserved.
|
|
174
|
+
</div>
|
|
175
|
+
<!-- End of Footer -->
|
|
176
|
+
|
|
177
|
+
</body>
|
|
178
|
+
</html>
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
|
|
2
|
+
<html>
|
|
3
|
+
<!-- Standard Head Part -->
|
|
4
|
+
<head>
|
|
5
|
+
<title>NUnit - EqualConstraint</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
|
+
<h2>Equal Constraint (NUnit 2.4)</h2>
|
|
28
|
+
|
|
29
|
+
<p>An EqualConstraint is used to test whether an actual value
|
|
30
|
+
is equal to the expected value supplied in its constructor.
|
|
31
|
+
|
|
32
|
+
<table class="constraints">
|
|
33
|
+
<tr><th>Syntax Helper</th><th>Constructor</th><th>Operation</th></tr>
|
|
34
|
+
<tr><td>Is.EqualTo( object )</td><td>EqualConstraint( null )</td></td><td>tests that two objects are equal</td></tr>
|
|
35
|
+
</table>
|
|
36
|
+
|
|
37
|
+
<h4>Notes</h4>
|
|
38
|
+
<ol>
|
|
39
|
+
<li>Numerics of different types compare successfully if their values are equal.
|
|
40
|
+
<li>Values of type float and double are normally compared using an additional
|
|
41
|
+
argument that indicates a tolerance within which they will be considered
|
|
42
|
+
as equal. The <b>Within</b> modifier is used for this purpose. Beginning with
|
|
43
|
+
NUnit 2.4.2, a tolerance may be specified for other numeric types as well.
|
|
44
|
+
<li>Unlike normal floating point arithmetic, floating NaN comparisons succeed
|
|
45
|
+
if both values are NaN. See the note on
|
|
46
|
+
<a href="equalityAsserts.html">Equality Asserts</a>.
|
|
47
|
+
<li>You may use this constraint to compare arrays with the same number of dimensions,
|
|
48
|
+
two collections or an single-dimensioned array and collection. If you want to
|
|
49
|
+
treat the arrays being compared as simple collections, use the <b>AsCollection</b>
|
|
50
|
+
modifier, which causes the comparison to be made element by element, without
|
|
51
|
+
regard for the rank or dimensions of the array. Jagged arrays (arrays of arrays)
|
|
52
|
+
are compared recursively and must match in shape exactly for the comparison
|
|
53
|
+
to succeed.
|
|
54
|
+
<li>In order to assert that two strings are equal ignoring case, use the <b>IgnoreCase</b>
|
|
55
|
+
modifier. It may also be used when comparing arrays or collections of strings.
|
|
56
|
+
</ol>
|
|
57
|
+
|
|
58
|
+
<h4>Examples of Use</h4>
|
|
59
|
+
|
|
60
|
+
<div class="code" style="width: 40em"><pre>
|
|
61
|
+
Assert.That(2 + 2, Is.EqualTo(4));
|
|
62
|
+
Assert.That(2 + 2 == 4);
|
|
63
|
+
Assert.That(2 + 2, Is.Not.EqualTo(5));
|
|
64
|
+
Assert.That(2 + 2 != 5);
|
|
65
|
+
Assert.That( 5.0, Is.EqualTo( 5 );
|
|
66
|
+
Assert.That( 2.1 + 1.2, Is.EqualTo( 3.3 ).Within( .0005 );
|
|
67
|
+
Assert.That( double.PositiveInfinity, Is.EqualTo( double.PositiveInfinity ) );
|
|
68
|
+
Assert.That( double.NegativeInfinity, Is.EqualTo( double.NegativeInfinity ) );
|
|
69
|
+
Assert.That( double.NaN, Is.EqualTo( double.NaN ) );
|
|
70
|
+
|
|
71
|
+
int[] i3 = new int[] { 1, 2, 3 };
|
|
72
|
+
double[] d3 = new double[] { 1.0, 2.0, 3.0 };
|
|
73
|
+
int[] iunequal = new int[] { 1, 3, 2 };
|
|
74
|
+
Assert.That(i3, Is.EqualTo(d3));
|
|
75
|
+
Assert.That(i3, Is.Not.EqualTo(iunequal));
|
|
76
|
+
|
|
77
|
+
int array2x2 = new int[,] { { 1, 2 } { 3, 4 } };
|
|
78
|
+
int array4 = new int[] { 1, 2, 3, 4 };
|
|
79
|
+
Assert.That( array2x2, Is.EqualTo( array4 ) ); // Fails
|
|
80
|
+
Assert.That( array2x2, Is.EqualTo( array4 ).AsCollection ); // Succeeds
|
|
81
|
+
|
|
82
|
+
Assert.That( "Hello!", Is.EqualTo( "HELLO!" ).IgnoreCase );
|
|
83
|
+
|
|
84
|
+
string[] expected = new string[] { "Hello", World" };
|
|
85
|
+
string[] actual = new string[] { "HELLO", "world" };
|
|
86
|
+
Assert.That( actual, Is.EqualTo( expected ).IgnoreCase;
|
|
87
|
+
|
|
88
|
+
// Using inheritance
|
|
89
|
+
Expect( i3, EqualTo( d3 ) );
|
|
90
|
+
Expect( i3, Not.EqualTo( iunequal ) );
|
|
91
|
+
</pre></div>
|
|
92
|
+
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<!-- Submenu -->
|
|
96
|
+
<div id="subnav">
|
|
97
|
+
<ul>
|
|
98
|
+
<li><a href="index.html">NUnit 2.4.8</a></li>
|
|
99
|
+
<ul>
|
|
100
|
+
<li><a href="getStarted.html">Getting Started</a></li>
|
|
101
|
+
<li><a href="assertions.html">Assertions</a></li>
|
|
102
|
+
<ul>
|
|
103
|
+
<li><a href="classicModel.html">Classic Model</a></li>
|
|
104
|
+
<li><a href="constraintModel.html">Constraint Model</a></li>
|
|
105
|
+
<ul>
|
|
106
|
+
<li id="current"><a href="equalConstraint.html">Equal Constraint</a></li>
|
|
107
|
+
<li><a href="sameasConstraint.html">SameAs Constraint</a></li>
|
|
108
|
+
<li><a href="conditionConstraints.html">Condition Constraints</a></li>
|
|
109
|
+
<li><a href="comparisonConstraints.html">Comparison Constrants</a></li>
|
|
110
|
+
<li><a href="typeConstraints.html">Type Constraints</a></li>
|
|
111
|
+
<li><a href="stringConstraints.html">String Constraints</a></li>
|
|
112
|
+
<li><a href="collectionConstraints.html">Collection Constraints</a></li>
|
|
113
|
+
<li><a href="propertyConstraint.html">Property Constraint</a></li>
|
|
114
|
+
<li><a href="compoundConstraints.html">Compound Constraints</a></li>
|
|
115
|
+
<li><a href="customConstraints.html">Custom Constraints</a></li>
|
|
116
|
+
<li><a href="listMapper.html">List Mapper</a></li>
|
|
117
|
+
</ul>
|
|
118
|
+
</ul>
|
|
119
|
+
<li><a href="attributes.html">Attributes</a></li>
|
|
120
|
+
<li><a href="nunit-console.html">Console Runner</a></li>
|
|
121
|
+
<li><a href="nunit-gui.html">Gui Runner</a></li>
|
|
122
|
+
<li><a href="features.html">Other Features</a></li>
|
|
123
|
+
<li><a href="releaseNotes.html">Release Notes</a></li>
|
|
124
|
+
<li><a href="samples.html">Samples</a></li>
|
|
125
|
+
<li><a href="license.html">License</a></li>
|
|
126
|
+
</ul>
|
|
127
|
+
</ul>
|
|
128
|
+
</div>
|
|
129
|
+
<!-- End of Submenu -->
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
<!-- Standard Footer for NUnit.org -->
|
|
133
|
+
<div id="footer">
|
|
134
|
+
Copyright © 2008 Charlie Poole. All Rights Reserved.
|
|
135
|
+
</div>
|
|
136
|
+
<!-- End of Footer -->
|
|
137
|
+
|
|
138
|
+
</body>
|
|
139
|
+
</html>
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
|
|
2
|
+
<html>
|
|
3
|
+
<!-- Standard Head Part -->
|
|
4
|
+
<head>
|
|
5
|
+
<title>NUnit - EqualityAsserts</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
|
+
<h2>Equality Asserts</h2>
|
|
28
|
+
|
|
29
|
+
<p>These methods test whether the two arguments are equal. Overloaded
|
|
30
|
+
methods are provided for common value types so that languages that don't
|
|
31
|
+
automatically box values can use them directly.</p>
|
|
32
|
+
|
|
33
|
+
<div class="code" style="width: 36em" >
|
|
34
|
+
<pre>Assert.AreEqual( int expected, int actual );
|
|
35
|
+
Assert.AreEqual( int expected, int actual, string message );
|
|
36
|
+
Assert.AreEqual( int expected, int actual, string message,
|
|
37
|
+
params object[] parms );
|
|
38
|
+
|
|
39
|
+
Assert.AreEqual( uint expected, uint actual );
|
|
40
|
+
Assert.AreEqual( uint expected, uint actual, string message );
|
|
41
|
+
Assert.AreEqual( uint expected, uint actual, string message,
|
|
42
|
+
params object[] parms );
|
|
43
|
+
|
|
44
|
+
Assert.AreEqual( decimal expected, decimal actual );
|
|
45
|
+
Assert.AreEqual( decimal expected, decimal actual, string message );
|
|
46
|
+
Assert.AreEqual( decimal expected, decimal actual, string message,
|
|
47
|
+
params object[] parms );
|
|
48
|
+
|
|
49
|
+
Assert.AreEqual( float expected, float actual, float tolerance );
|
|
50
|
+
Assert.AreEqual( float expected, float actual, float tolerance,
|
|
51
|
+
string message );
|
|
52
|
+
Assert.AreEqual( float expected, float actual, float tolerance,
|
|
53
|
+
string message, params object[] parms );
|
|
54
|
+
|
|
55
|
+
Assert.AreEqual( double expected, double actual, double tolerance );
|
|
56
|
+
Assert.AreEqual( double expected, double actual, double tolerance,
|
|
57
|
+
string message );
|
|
58
|
+
Assert.AreEqual( double expected, double actual, double tolerance,
|
|
59
|
+
string message, params object[] parms );
|
|
60
|
+
|
|
61
|
+
Assert.AreEqual( object expected, object actual );
|
|
62
|
+
Assert.AreEqual( object expected, object actual, string message );
|
|
63
|
+
Assert.AreEqual( object expected, object actual, string message,
|
|
64
|
+
params object[] parms );
|
|
65
|
+
|
|
66
|
+
Assert.AreNotEqual( int expected, int actual );
|
|
67
|
+
Assert.AreNotEqual( int expected, int actual, string message );
|
|
68
|
+
Assert.AreNotEqual( int expected, int actual, string message,
|
|
69
|
+
params object[] parms );
|
|
70
|
+
|
|
71
|
+
Assert.AreNotEqual( long expected, long actual );
|
|
72
|
+
Assert.AreNotEqual( long expected, long actual, string message );
|
|
73
|
+
Assert.AreNotEqual( long expected, long actual, string message,
|
|
74
|
+
params object[] parms );
|
|
75
|
+
|
|
76
|
+
Assert.AreNotEqual( uint expected, uint actual );
|
|
77
|
+
Assert.AreNotEqual( uint expected, uint actual, string message );
|
|
78
|
+
Assert.AreNotEqual( uint expected, uint actual, string message,
|
|
79
|
+
params object[] parms );
|
|
80
|
+
|
|
81
|
+
Assert.AreNotEqual( ulong expected, ulong actual );
|
|
82
|
+
Assert.AreNotEqual( ulong expected, ulong actual, string message );
|
|
83
|
+
Assert.AreNotEqual( ulong expected, ulong actual, string message,
|
|
84
|
+
params object[] parms );
|
|
85
|
+
|
|
86
|
+
Assert.AreNotEqual( decimal expected, decimal actual );
|
|
87
|
+
Assert.AreNotEqual( decimal expected, decimal actual, string message );
|
|
88
|
+
Assert.AreNotEqual( decimal expected, decimal actual, string message,
|
|
89
|
+
params object[] parms );
|
|
90
|
+
|
|
91
|
+
Assert.AreNotEqual( float expected, float actual );
|
|
92
|
+
Assert.AreNotEqual( float expected, float actual, string message );
|
|
93
|
+
Assert.AreNotEqual( float expected, float actual, string message,
|
|
94
|
+
params object[] parms );
|
|
95
|
+
|
|
96
|
+
Assert.AreNotEqual( double expected, double actual );
|
|
97
|
+
Assert.AreNotEqual( double expected, double actual, string message );
|
|
98
|
+
Assert.AreNotEqual( double expected, double actual, string message,
|
|
99
|
+
params object[] parms );
|
|
100
|
+
|
|
101
|
+
Assert.AreNotEqual( object expected, object actual );
|
|
102
|
+
Assert.AreNotEqual( object expected, object actual, string message );
|
|
103
|
+
Assert.AreNotEqual( object expected, object actual, string message,
|
|
104
|
+
params object[] parms );</pre>
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
<h4>Comparing Numerics of Different Types</h4>
|
|
108
|
+
|
|
109
|
+
<p>The method overloads that compare two objects make special provision so that numeric
|
|
110
|
+
values of different types compare as expected. This assert succeeds:
|
|
111
|
+
<pre> Assert.AreEqual( 5, 5.0 );</pre>
|
|
112
|
+
</p>
|
|
113
|
+
|
|
114
|
+
<h4>Comparing Floating Point Values</h4>
|
|
115
|
+
|
|
116
|
+
<p>Values of type float and double are normally compared using an additional
|
|
117
|
+
argument that indicates a tolerance within which they will be considered
|
|
118
|
+
as equal. Beginning with NUnit 2.4.4, the value of
|
|
119
|
+
<b>GlobalSettings.DefaultFloatingPointTolerance</b> is used if a third argument
|
|
120
|
+
is not provided. In earlier versions, or if the default has not been set,
|
|
121
|
+
values are tested for exact equality.
|
|
122
|
+
|
|
123
|
+
<p>Special values are handled so that the following Asserts succeed:</p>
|
|
124
|
+
|
|
125
|
+
<pre> Assert.AreEqual( double.PositiveInfinity, double.PositiveInfinity );
|
|
126
|
+
Assert.AreEqual( double.NegativeInfinity, double.NegativeInfinity );
|
|
127
|
+
Assert.AreEqual( double.NaN, double.NaN );</pre>
|
|
128
|
+
|
|
129
|
+
<blockquote><i><b>Note:</b> The last example above represents a change with NUnit 2.2.3.
|
|
130
|
+
In earlier releases, the test would fail. We have made this change
|
|
131
|
+
because the new behavior seems to be more useful in tests. To avoid confusion,
|
|
132
|
+
we suggest using the new Assert.IsNaN method where appropriate.</i></blockquote>
|
|
133
|
+
|
|
134
|
+
<h4>Comparing Arrays and Collections</h4>
|
|
135
|
+
|
|
136
|
+
<p>Since version 2.2, NUnit has been able to compare two single-dimensioned arrays.
|
|
137
|
+
Beginning with version 2.4, multi-dimensioned arrays, nested arrays (arrays of arrays)
|
|
138
|
+
and collections may be compared. Two arrays or collections will be treated as equal
|
|
139
|
+
by Assert.AreEqual if they have the same dimensions and if each of the corresponding
|
|
140
|
+
elements is equal.</p>
|
|
141
|
+
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
|
|
145
|
+
<!-- Submenu -->
|
|
146
|
+
<div id="subnav">
|
|
147
|
+
<ul>
|
|
148
|
+
<li><a href="index.html">NUnit 2.4.8</a></li>
|
|
149
|
+
<ul>
|
|
150
|
+
<li><a href="getStarted.html">Getting Started</a></li>
|
|
151
|
+
<li><a href="assertions.html">Assertions</a></li>
|
|
152
|
+
<ul>
|
|
153
|
+
<li><a href="classicModel.html">Classic Model</a></li>
|
|
154
|
+
<ul>
|
|
155
|
+
<li id="current"><a href="equalityAsserts.html">Equality Asserts</a></li>
|
|
156
|
+
<li><a href="identityAsserts.html">Identity Asserts</a></li>
|
|
157
|
+
<li><a href="conditionAsserts.html">Condition Tests</a></li>
|
|
158
|
+
<li><a href="comparisonAsserts.html">Comparison Asserts</a></li>
|
|
159
|
+
<li><a href="typeAsserts.html">Type Asserts</a></li>
|
|
160
|
+
<li><a href="utilityAsserts.html">Utility Methods</a></li>
|
|
161
|
+
<li><a href="stringAssert.html">String Assert</a></li>
|
|
162
|
+
<li><a href="collectionAssert.html">Collection Assert</a></li>
|
|
163
|
+
<li><a href="fileAssert.html">File Assert</a></li>
|
|
164
|
+
</ul>
|
|
165
|
+
<li><a href="constraintModel.html">Constraint Model</a></li>
|
|
166
|
+
</ul>
|
|
167
|
+
<li><a href="attributes.html">Attributes</a></li>
|
|
168
|
+
<li><a href="nunit-console.html">Console Runner</a></li>
|
|
169
|
+
<li><a href="nunit-gui.html">Gui Runner</a></li>
|
|
170
|
+
<li><a href="features.html">Other Features</a></li>
|
|
171
|
+
<li><a href="releaseNotes.html">Release Notes</a></li>
|
|
172
|
+
<li><a href="samples.html">Samples</a></li>
|
|
173
|
+
<li><a href="license.html">License</a></li>
|
|
174
|
+
</ul>
|
|
175
|
+
</ul>
|
|
176
|
+
</div>
|
|
177
|
+
<!-- End of Submenu -->
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
<!-- Standard Footer for NUnit.org -->
|
|
181
|
+
<div id="footer">
|
|
182
|
+
Copyright © 2008 Charlie Poole. All Rights Reserved.
|
|
183
|
+
</div>
|
|
184
|
+
<!-- End of Footer -->
|
|
185
|
+
|
|
186
|
+
</body>
|
|
187
|
+
</html>
|