This commit is contained in:
charliepoole 2007-03-09 05:38:25 +00:00
Родитель ca245051a4
Коммит db67364efe
38 изменённых файлов: 1955 добавлений и 270 удалений

Просмотреть файл

@ -24,7 +24,7 @@
<div id="content">
<script language="JavaScript" src="codeFuncs.js" />
<script language="JavaScript" src="codeFuncs.js" ></script> <!-- Do it this way for IE -->
<h3>CategoryAttribute (NUnit 2.2)</h3>
<p>The Category attribute provides an alternative to suites for dealing with groups

100
doc/classicModel.html Normal file
Просмотреть файл

@ -0,0 +1,100 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<!-- Standard Head Part -->
<head>
<title>NUnit - ClassicModel</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-US">
<link rel="stylesheet" type="text/css" href="nunit.css">
<link rel="shortcut icon" href="favicon.ico">
</head>
<!-- End Standard Head Part -->
<body>
<!-- Standard Header for NUnit.org -->
<div id="header">
<a id="logo" href="http://www.nunit.org"><img src="img/logo.gif" alt="NUnit.org" title="NUnit.org"></a>
<div id="nav">
<a href="http://www.nunit.org">NUnit</a>
<a class="active" href="index.html">Documentation</a>
</div>
</div>
<!-- End of Header -->
<div id="content">
<h2>Classic Assert Model</h2>
<p>The classic Assert model uses a separate method to express each
individual assertion of which it is capable.
<p>Here's a simple assert using the classic model:
<pre> StringAssert.AreEqualIgnoringCase( "Hello", myString );</pre>
<p>The Assert class provides the most commonly used assertions. It provides
For convenience of presentation, we group Assert methods as follows:
<ul>
<li><a href="equalityAsserts.html">Equality Asserts</a> <li><a href="identityAsserts.html">Identity Asserts</a> <li><a href="comparisonAsserts.html">Comparison Asserts</a> <li><a href="typeAsserts.html">Type Asserts</a> <li><a href="conditionAsserts.html">Condition tests</a> <li><a href="utilityAsserts.html">Utility methods</a></ul></p>
<p>Beyond the basic facilities of Assert, additional assertions are provided by
the following classes:
<ul>
<li><a href="stringAssert.html">StringAssert</a> <li><a href="collectionAssert.html">CollectionAssert</a> <li><a href="fileAssert.html">FileAssert</a></ul></p>
<p><b>See also:</b> the
<a href="constraintModel.html">constraint-based model</a> of assertions.
</div>
<!-- Submenu -->
<div id="subnav">
<ul>
<li><a href="index.html">NUnit 2.4</a></li>
<ul>
<li><a href="getStarted.html">Getting&nbsp;Started</a></li>
<li><a href="platformSupport.html">Platform&nbsp;Support</a></li>
<li><a href="installation.html">Installation</a></li>
<li><a href="features.html">Core&nbsp;Features</a></li>
<ul>
<li><a href="assertions.html">Assertions</a></li>
<ul>
<li id="current"><a href="classicModel.html">Classic&nbsp;Model</a></li>
<ul>
<li><a href="equalityAsserts.html">Equality&nbsp;Asserts</a></li>
<li><a href="identityAsserts.html">Identity&nbsp;Asserts</a></li>
<li><a href="conditionAsserts.html">Condition&nbsp;Tests</a></li>
<li><a href="comparisonAsserts.html">Comparison&nbsp;Asserts</a></li>
<li><a href="typeAsserts.html">Type&nbsp;Asserts</a></li>
<li><a href="utilityAsserts.html">Utility&nbsp;Methods</a></li>
<li><a href="stringAssert.html">String&nbsp;Assert</a></li>
<li><a href="collectionAssert.html">Collection&nbsp;Assert</a></li>
<li><a href="fileAssert.html">File&nbsp;Assert</a></li>
</ul>
<li><a href="constraintModel.html">Constraint&nbsp;Model</a></li>
</ul>
<li><a href="attributes.html">Attributes</a></li>
<li><a href="configFiles.html">Configuration&nbsp;Files</a></li>
<li><a href="multiAssembly.html">Multiple&nbsp;Assemblies</a></li>
<li><a href="vsSupport.html">Visual&nbsp;Studio&nbsp;Support</a></li>
<li><a href="extensibility.html">Extensibility</a></li>
</ul>
<li><a href="nunit-console.html">Console&nbsp;Runner</a></li>
<li><a href="nunit-gui.html">Gui&nbsp;Runner</a></li>
<li><a href="releaseNotes.html">Release&nbsp;Notes</a></li>
<li><a href="samples.html">Samples</a></li>
<li><a href="license.html">License</a></li>
</ul>
</ul>
</div>
<!-- End of Submenu -->
<!-- Standard Footer for NUnit.org -->
<div id="footer">
Copyright &copy; 2006 Charlie Poole. All Rights Reserved.
</div>
<!-- End of Footer -->
</body>
</html>

Просмотреть файл

@ -0,0 +1,127 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<!-- Standard Head Part -->
<head>
<title>NUnit - CollectionConstraints</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-US">
<link rel="stylesheet" type="text/css" href="nunit.css">
<link rel="shortcut icon" href="favicon.ico">
</head>
<!-- End Standard Head Part -->
<body>
<!-- Standard Header for NUnit.org -->
<div id="header">
<a id="logo" href="http://www.nunit.org"><img src="img/logo.gif" alt="NUnit.org" title="NUnit.org"></a>
<div id="nav">
<a href="http://www.nunit.org">NUnit</a>
<a class="active" href="index.html">Documentation</a>
</div>
</div>
<!-- End of Header -->
<div id="content">
<h2>Collection Constraints (NUnit 2.4)</h2>
<p>Collection constraints perform tests that are specific to collections.
The following collection constraints are provided.
<table class="constraints">
<tr><th>Syntax Helper</th><th>Constructor</th><th>Operation</th></tr>
<tr><td>Is.All...</td><td>AllItemsConstraint( Constraint )</td></td><td>applies a constraint to each item in a collection</td></tr>
<tr><td>Is.Unique</td><td>UniqueItemsConstraint()</td></td><td>tests that a collection contains only unique items</td></tr>
<tr><td>List.Contains( object )</td><td>CollectionContainsConstraint( object )</td></td><td>tests that a collection contains an object</td></tr>
<tr><td>Is.EquivalentTo( ICollection )</td><td>CollectionEquivalentConstraint( ICollection )</td></td><td>tests that two collections are equivalent</td></tr>
<tr><td>Is.SubsetOf( ICollection )</td><td>CollectionSubsetConstraint( ICollection )</td></td><td>tests that one collection is a subset of another</td></tr>
</table>
<h4>Notes</h4>
<ol>
<li>Two collections are equivalent if they contain the same items, in any order.
<li>To compare collections for equality, use Is.EqualTo().
</ol>
<h4>Examples of Use</h4>
<div class="code" style="width: 38em"><pre>
int[] iarray = new int[] { 1, 2, 3 };
string[] sarray = new string[] { "a", "b", "c" };
Assert.That( iarray, Is.All.Not.Null );
Assert.That( sarray, Is.All.InstanceOfType(typeof(string)) );
Assert.That( iarray, Is.All.GreaterThan(0) );
Assert.That( sarray, Is.Unique );
Assert.That( iarray, List.Contains(3) );
Assert.That( sarray, List.Contains("b") );
Assert.That( sarray, List.Not.Contains("x") );
Assert.That( new string[] { "c", "a", "b" }, Is.EquivalentTo( sarray ) );
Assert.That( new int[] { 1, 2, 2 }, Is.Not.EquivalentTo( iarray ) );
Assert.That( new int[] { 1, 3 }, Is.SubsetOf( iarray ) );
// Using inheritance
Expect( iarray, All.GreaterThan( 0 ) );
Expect( sarray, Contains("b") );
Expect( new int[] { 1, 3 }, SubsetOf( iarray ) );
</pre></div>
</div>
<!-- Submenu -->
<div id="subnav">
<ul>
<li><a href="index.html">NUnit 2.4</a></li>
<ul>
<li><a href="getStarted.html">Getting&nbsp;Started</a></li>
<li><a href="platformSupport.html">Platform&nbsp;Support</a></li>
<li><a href="installation.html">Installation</a></li>
<li><a href="features.html">Core&nbsp;Features</a></li>
<ul>
<li><a href="assertions.html">Assertions</a></li>
<ul>
<li><a href="classicModel.html">Classic&nbsp;Model</a></li>
<li><a href="constraintModel.html">Constraint&nbsp;Model</a></li>
<ul>
<li><a href="equalConstraint.html">Equal&nbsp;Constraint</a></li>
<li><a href="sameasConstraint.html">SameAs&nbsp;Constraint</a></li>
<li><a href="conditionConstraints.html">Condition&nbsp;Constraints</a></li>
<li><a href="comparisonConstraints.html">Comparison&nbsp;Constrants</a></li>
<li><a href="typeConstraints.html">Type&nbsp;Constraints</a></li>
<li><a href="stringConstraints.html">String&nbsp;Constraints</a></li>
<li id="current"><a href="collectionConstraints.html">Collection&nbsp;Constraints</a></li>
<li><a href="compoundConstraints.html">Compound&nbsp;Constraints</a></li>
<li><a href="customConstraints.html">Custom&nbsp;Constraints</a></li>
</ul>
</ul>
<li><a href="attributes.html">Attributes</a></li>
<li><a href="configFiles.html">Configuration&nbsp;Files</a></li>
<li><a href="multiAssembly.html">Multiple&nbsp;Assemblies</a></li>
<li><a href="vsSupport.html">Visual&nbsp;Studio&nbsp;Support</a></li>
<li><a href="extensibility.html">Extensibility</a></li>
</ul>
<li><a href="nunit-console.html">Console&nbsp;Runner</a></li>
<li><a href="nunit-gui.html">Gui&nbsp;Runner</a></li>
<li><a href="releaseNotes.html">Release&nbsp;Notes</a></li>
<li><a href="samples.html">Samples</a></li>
<li><a href="license.html">License</a></li>
</ul>
</ul>
</div>
<!-- End of Submenu -->
<!-- Standard Footer for NUnit.org -->
<div id="footer">
Copyright &copy; 2006 Charlie Poole. All Rights Reserved.
</div>
<!-- End of Footer -->
</body>
</html>

Просмотреть файл

@ -0,0 +1,115 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<!-- Standard Head Part -->
<head>
<title>NUnit - ComparisonConstraints</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-US">
<link rel="stylesheet" type="text/css" href="nunit.css">
<link rel="shortcut icon" href="favicon.ico">
</head>
<!-- End Standard Head Part -->
<body>
<!-- Standard Header for NUnit.org -->
<div id="header">
<a id="logo" href="http://www.nunit.org"><img src="img/logo.gif" alt="NUnit.org" title="NUnit.org"></a>
<div id="nav">
<a href="http://www.nunit.org">NUnit</a>
<a class="active" href="index.html">Documentation</a>
</div>
</div>
<!-- End of Header -->
<div id="content">
<h2>Comparison Constraints (NUnit 2.4)</h2>
<p>Comparison constraints are able to test whether one value
is greater or less than another. Comparison constraints work
on numeric values, as well as other objects that implement IComparable.
<table class="constraints">
<tr><th>Syntax Helper</th><th>Constructor</th><th>Operation</th></tr>
<tr><td>Is.GreaterThan( IComparable )</td><td>GreaterThanConstraint( IComparable )</td></td><td>tests that one value is greater than another</td></tr>
<tr><td>Is.GreaterThanOrEqualTo( IComparable )</td><td>GreaterThanOrEqualConstraint( IComparable )</td></td><td>tests that one value is greater than or equal to another</td></tr>
<tr><td>Is.AtLeast( IComparable )</td><td>GreaterThanOrEqualConstraint( IComparable )</td></td><td>tests that one value is greater than or equal to another</td></tr>
<tr><td>Is.LessThan( IComparable )</td><td>LessThanConstraint( IComparable )</td></td><td>tests that one value is less than another</td></tr>
<tr><td>Is.LessThanOrEqualTo( IComparable )</td><td>LessThanOrEqualConstraint( IComparable )</td></td><td>tests that one value is less than or equal to another</td></tr>
<tr><td>Is.AtMost( IComparable )</td><td>LessThanOrEqualConstraint( IComparable )</td></td><td>tests that one value is less than or equal to another</td></tr>
</table>
<h4>Examples of Use</h4>
<div class="code"><pre>
Assert.That(7, Is.GreaterThan(3));
Assert.That(7, Is.GreaterThanOrEqualTo(3));
Assert.That(7, Is.AtLeast(3));
Assert.That(7, Is.GreaterThanOrEqualTo(7));
Assert.That(7, Is.AtLeast(7));
Assert.That(3, Is.LessThan(7));
Assert.That(3, Is.LessThanOrEqualTo(7));
Assert.That(3, Is.AtMost(7));
Assert.That(3, Is.LessThanOrEqualTo(3));
Assert.That(3, Is.AtMost(3));
// Using Inheritance
Expect( 7, GreaterThan(3));
Expect( 3, AtMost(7));
</pre></div>
</div>
<!-- Submenu -->
<div id="subnav">
<ul>
<li><a href="index.html">NUnit 2.4</a></li>
<ul>
<li><a href="getStarted.html">Getting&nbsp;Started</a></li>
<li><a href="platformSupport.html">Platform&nbsp;Support</a></li>
<li><a href="installation.html">Installation</a></li>
<li><a href="features.html">Core&nbsp;Features</a></li>
<ul>
<li><a href="assertions.html">Assertions</a></li>
<ul>
<li><a href="classicModel.html">Classic&nbsp;Model</a></li>
<li><a href="constraintModel.html">Constraint&nbsp;Model</a></li>
<ul>
<li><a href="equalConstraint.html">Equal&nbsp;Constraint</a></li>
<li><a href="sameasConstraint.html">SameAs&nbsp;Constraint</a></li>
<li><a href="conditionConstraints.html">Condition&nbsp;Constraints</a></li>
<li id="current"><a href="comparisonConstraints.html">Comparison&nbsp;Constrants</a></li>
<li><a href="typeConstraints.html">Type&nbsp;Constraints</a></li>
<li><a href="stringConstraints.html">String&nbsp;Constraints</a></li>
<li><a href="collectionConstraints.html">Collection&nbsp;Constraints</a></li>
<li><a href="compoundConstraints.html">Compound&nbsp;Constraints</a></li>
<li><a href="customConstraints.html">Custom&nbsp;Constraints</a></li>
</ul>
</ul>
<li><a href="attributes.html">Attributes</a></li>
<li><a href="configFiles.html">Configuration&nbsp;Files</a></li>
<li><a href="multiAssembly.html">Multiple&nbsp;Assemblies</a></li>
<li><a href="vsSupport.html">Visual&nbsp;Studio&nbsp;Support</a></li>
<li><a href="extensibility.html">Extensibility</a></li>
</ul>
<li><a href="nunit-console.html">Console&nbsp;Runner</a></li>
<li><a href="nunit-gui.html">Gui&nbsp;Runner</a></li>
<li><a href="releaseNotes.html">Release&nbsp;Notes</a></li>
<li><a href="samples.html">Samples</a></li>
<li><a href="license.html">License</a></li>
</ul>
</ul>
</div>
<!-- End of Submenu -->
<!-- Standard Footer for NUnit.org -->
<div id="footer">
Copyright &copy; 2006 Charlie Poole. All Rights Reserved.
</div>
<!-- End of Footer -->
</body>
</html>

Просмотреть файл

@ -0,0 +1,103 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<!-- Standard Head Part -->
<head>
<title>NUnit - CompoundConstraints</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-US">
<link rel="stylesheet" type="text/css" href="nunit.css">
<link rel="shortcut icon" href="favicon.ico">
</head>
<!-- End Standard Head Part -->
<body>
<!-- Standard Header for NUnit.org -->
<div id="header">
<a id="logo" href="http://www.nunit.org"><img src="img/logo.gif" alt="NUnit.org" title="NUnit.org"></a>
<div id="nav">
<a href="http://www.nunit.org">NUnit</a>
<a class="active" href="index.html">Documentation</a>
</div>
</div>
<!-- End of Header -->
<div id="content">
<h2>Compound Constraints (NUnit 2.4)</h2>
<p>Compound constraints are used to combine other constraints in various ways.
<table class="constraints">
<tr><th>Syntax Helper</th><th>Constructor</th><th>Operation</th></tr>
<tr><td>Is.Not...</td><td>NotConstraint( Constraint )</td></td><td>Negates or reverses the effect of a constraint</td></tr>
<tr><td>Is.All...</td><td>AllItemsConstraint( Constraint )</td></td><td>Negates or reverses the effect of a constraint</td></tr>
<tr><td>Constraint &amp; Constraint</td><td>AndConstraint( Constraint, Constraint )</td></td><td>Negates or reverses the effect of a constraint</td></tr>
<tr><td>Constraint | Constraint</td><td>OrConstraint( Constraint, Constraint )</td></td><td>Negates or reverses the effect of a constraint</td></tr>
</table>
<h4>Examples of Use</h4>
<div class="code"><pre>
Assert.That( 2 + 2, Is.Not.EqualTo( 5 );
Assert.That( new int[] { 1, 2, 3 }, Is.All.GreaterThan( 0 ) );
Assert.That( 2.3, Is.GreaterThan( 2.0 ) & Is.LessThan( 3.0 ) );
Assert.That( 3, Is.LessThan( 5 ) | Is.GreaterThan( 10 ) );
// Using inheritance
Expect( 2 + 2, Not.EqualTo( 5 ) );
Expect( 2.3, GreaterThan( 2.0 ) & LessThan( 3.0 ) );
</pre></div>
</div>
<!-- Submenu -->
<div id="subnav">
<ul>
<li><a href="index.html">NUnit 2.4</a></li>
<ul>
<li><a href="getStarted.html">Getting&nbsp;Started</a></li>
<li><a href="platformSupport.html">Platform&nbsp;Support</a></li>
<li><a href="installation.html">Installation</a></li>
<li><a href="features.html">Core&nbsp;Features</a></li>
<ul>
<li><a href="assertions.html">Assertions</a></li>
<ul>
<li><a href="classicModel.html">Classic&nbsp;Model</a></li>
<li><a href="constraintModel.html">Constraint&nbsp;Model</a></li>
<ul>
<li><a href="equalConstraint.html">Equal&nbsp;Constraint</a></li>
<li><a href="sameasConstraint.html">SameAs&nbsp;Constraint</a></li>
<li><a href="conditionConstraints.html">Condition&nbsp;Constraints</a></li>
<li><a href="comparisonConstraints.html">Comparison&nbsp;Constrants</a></li>
<li><a href="typeConstraints.html">Type&nbsp;Constraints</a></li>
<li><a href="stringConstraints.html">String&nbsp;Constraints</a></li>
<li><a href="collectionConstraints.html">Collection&nbsp;Constraints</a></li>
<li id="current"><a href="compoundConstraints.html">Compound&nbsp;Constraints</a></li>
<li><a href="customConstraints.html">Custom&nbsp;Constraints</a></li>
</ul>
</ul>
<li><a href="attributes.html">Attributes</a></li>
<li><a href="configFiles.html">Configuration&nbsp;Files</a></li>
<li><a href="multiAssembly.html">Multiple&nbsp;Assemblies</a></li>
<li><a href="vsSupport.html">Visual&nbsp;Studio&nbsp;Support</a></li>
<li><a href="extensibility.html">Extensibility</a></li>
</ul>
<li><a href="nunit-console.html">Console&nbsp;Runner</a></li>
<li><a href="nunit-gui.html">Gui&nbsp;Runner</a></li>
<li><a href="releaseNotes.html">Release&nbsp;Notes</a></li>
<li><a href="samples.html">Samples</a></li>
<li><a href="license.html">License</a></li>
</ul>
</ul>
</div>
<!-- End of Submenu -->
<!-- Standard Footer for NUnit.org -->
<div id="footer">
Copyright &copy; 2006 Charlie Poole. All Rights Reserved.
</div>
<!-- End of Footer -->
</body>
</html>

Просмотреть файл

@ -0,0 +1,112 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<!-- Standard Head Part -->
<head>
<title>NUnit - ConditionConstraints</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-US">
<link rel="stylesheet" type="text/css" href="nunit.css">
<link rel="shortcut icon" href="favicon.ico">
</head>
<!-- End Standard Head Part -->
<body>
<!-- Standard Header for NUnit.org -->
<div id="header">
<a id="logo" href="http://www.nunit.org"><img src="img/logo.gif" alt="NUnit.org" title="NUnit.org"></a>
<div id="nav">
<a href="http://www.nunit.org">NUnit</a>
<a class="active" href="index.html">Documentation</a>
</div>
</div>
<!-- End of Header -->
<div id="content">
<h2>Condition Constraints (NUnit 2.4)</h2>
<p>ConditionConstraints test a specific condition and are named for the condition
they test. They verify that the actual value satisfies the condition. The
following condition helpers are provided.
<table class="constraints">
<tr><th>Syntax Helper</th><th>Constructor</th><th>Operation</th></tr>
<tr><td>Is.Null</td><td>EqualConstraint( null )</td></td><td>tests for null</td></tr>
<tr><td>Is.True</td><td>EqualConstraint( true )</td></td><td>tests for <b>true</b></td></tr>
<tr><td>Is.False</td><td>EqualConstraint( false )</td></td><td>tests for <b>false</b></td></tr>
<tr><td>Is.NaN</td><td>EqualConstraint( double.NaN )<br>EqualConstraint( float.NaN )</td></td><td>tests for floating NaN</td></tr>
<tr><td>Is.Empty</td><td>EmptyConstraint()</td></td><td>tests for empty string or collection</td></tr>
<tr><td>Is.Unique</td><td>UniqueItemsConstraint()</td></td><td>tests that collection contains unique items</td></tr>
</table>
<h4>Examples</h4>
<div class="code"><pre>
Assert.That( anObject, Is.Null );
Assert.That( anObject, Is.Not.Null );
Assert.That( condition, Is.True );
Assert.That( condition, Is.False );
Assert.That( aDouble, Is.NaN );
Assert.That( aDouble, Is.Not.NaN );
Assert.That( aString, Is.Empty );
Assert.That( collection, Is.Empty );
Assert.That( collection, Is.Unique );
// Using inheritance
Expect( aDouble, NaN );
Expect( collection, Unique );
</pre></div>
</div>
<!-- Submenu -->
<div id="subnav">
<ul>
<li><a href="index.html">NUnit 2.4</a></li>
<ul>
<li><a href="getStarted.html">Getting&nbsp;Started</a></li>
<li><a href="platformSupport.html">Platform&nbsp;Support</a></li>
<li><a href="installation.html">Installation</a></li>
<li><a href="features.html">Core&nbsp;Features</a></li>
<ul>
<li><a href="assertions.html">Assertions</a></li>
<ul>
<li><a href="classicModel.html">Classic&nbsp;Model</a></li>
<li><a href="constraintModel.html">Constraint&nbsp;Model</a></li>
<ul>
<li><a href="equalConstraint.html">Equal&nbsp;Constraint</a></li>
<li><a href="sameasConstraint.html">SameAs&nbsp;Constraint</a></li>
<li id="current"><a href="conditionConstraints.html">Condition&nbsp;Constraints</a></li>
<li><a href="comparisonConstraints.html">Comparison&nbsp;Constrants</a></li>
<li><a href="typeConstraints.html">Type&nbsp;Constraints</a></li>
<li><a href="stringConstraints.html">String&nbsp;Constraints</a></li>
<li><a href="collectionConstraints.html">Collection&nbsp;Constraints</a></li>
<li><a href="compoundConstraints.html">Compound&nbsp;Constraints</a></li>
<li><a href="customConstraints.html">Custom&nbsp;Constraints</a></li>
</ul>
</ul>
<li><a href="attributes.html">Attributes</a></li>
<li><a href="configFiles.html">Configuration&nbsp;Files</a></li>
<li><a href="multiAssembly.html">Multiple&nbsp;Assemblies</a></li>
<li><a href="vsSupport.html">Visual&nbsp;Studio&nbsp;Support</a></li>
<li><a href="extensibility.html">Extensibility</a></li>
</ul>
<li><a href="nunit-console.html">Console&nbsp;Runner</a></li>
<li><a href="nunit-gui.html">Gui&nbsp;Runner</a></li>
<li><a href="releaseNotes.html">Release&nbsp;Notes</a></li>
<li><a href="samples.html">Samples</a></li>
<li><a href="license.html">License</a></li>
</ul>
</ul>
</div>
<!-- End of Submenu -->
<!-- Standard Footer for NUnit.org -->
<div id="footer">
Copyright &copy; 2006 Charlie Poole. All Rights Reserved.
</div>
<!-- End of Footer -->
</body>
</html>

141
doc/constraintModel.html Normal file
Просмотреть файл

@ -0,0 +1,141 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<!-- Standard Head Part -->
<head>
<title>NUnit - ConstraintModel</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-US">
<link rel="stylesheet" type="text/css" href="nunit.css">
<link rel="shortcut icon" href="favicon.ico">
</head>
<!-- End Standard Head Part -->
<body>
<!-- Standard Header for NUnit.org -->
<div id="header">
<a id="logo" href="http://www.nunit.org"><img src="img/logo.gif" alt="NUnit.org" title="NUnit.org"></a>
<div id="nav">
<a href="http://www.nunit.org">NUnit</a>
<a class="active" href="index.html">Documentation</a>
</div>
</div>
<!-- End of Header -->
<div id="content">
<h2>Constraint-Based Assert Model (NUnit 2.4)</h2>
<p>The constraint-based Assert model uses a single method of the Assert class
for all assertions. The logic necessary to carry out each assertion is
embedded in the constraint object passed as the second parameter to that
method.
<p>Here's a very simple assert using the constraint model:
<pre> Assert.That( myString, Is.EqualTo("Hello") );</pre>
<p>The second argument in this assertion uses one of NUnit's <b>syntax helpers</b>
to create an <b>EqualConstraint</b>. The same assertion could also be made in this form:
<pre> Assert.That( myString, new EqualConstraint("Hello") );</pre>
<p>Using this model, all assertions are made using one of the forms of the
Assert.That() method, which has a number of overloads...
<div class="code" style="width: 36em">
<pre>Assert.That( object actual, IConstraint constraint )
Assert.That( object actual, IConstraint constraint, string message )
Assert.That( object actual, IConstraint constraint, string message,
object[] parms )
Assert.That( bool condition );
Assert.That( bool condition, string message );
Assert.That( bool condition, string message, object[] parms );</pre>
</div>
<p>If you derive your test fixture class from <b>AssertionHelper</b>, the
Expect() method may be used in place of Assert.That()...
<div class="code" style="width: 36em">
<pre>Expect( object actual, IConstraint constraint )
Expect( object actual, IConstraint constraint, string message )
Expect( object actual, IConstraint constraint, string message,
object[] parms )
Expect( bool condition );
Expect( bool condition, string message );
Expect( bool condition, string message, object[] parms );</pre>
</div>
<p>In each case, the overloads that take a bool function identically to
Asser.IsTrue.
<p>For overloads taking a constraint, the argument must be a object implementing
the <b>IConstraint</b> interface, which supports performing a test
on an actual value and generating appropriate messages. This interface
is described in more detail under
<a href="customConstraints.html">Custom Constraints</a>.
<p>NUnit provides a number of constraint classes similar to the <b>EqualConstraint</b>
used in the example above. Generally, these classes may be used directly or
through a syntax helper. Test fixture classes inheriting from <b>AssertionHelper</b>
are able to use shorter forms. The valid forms are described on the pages related to
each constraint. Note that the menu items listed to the right generally reflect the
names of the syntax helpers.
<p><b>See also:</b> the
<a href="classicModel.html">classic model</a> of assertions.
</div>
<!-- Submenu -->
<div id="subnav">
<ul>
<li><a href="index.html">NUnit 2.4</a></li>
<ul>
<li><a href="getStarted.html">Getting&nbsp;Started</a></li>
<li><a href="platformSupport.html">Platform&nbsp;Support</a></li>
<li><a href="installation.html">Installation</a></li>
<li><a href="features.html">Core&nbsp;Features</a></li>
<ul>
<li><a href="assertions.html">Assertions</a></li>
<ul>
<li><a href="classicModel.html">Classic&nbsp;Model</a></li>
<li id="current"><a href="constraintModel.html">Constraint&nbsp;Model</a></li>
<ul>
<li><a href="equalConstraint.html">Equal&nbsp;Constraint</a></li>
<li><a href="sameasConstraint.html">SameAs&nbsp;Constraint</a></li>
<li><a href="conditionConstraints.html">Condition&nbsp;Constraints</a></li>
<li><a href="comparisonConstraints.html">Comparison&nbsp;Constrants</a></li>
<li><a href="typeConstraints.html">Type&nbsp;Constraints</a></li>
<li><a href="stringConstraints.html">String&nbsp;Constraints</a></li>
<li><a href="collectionConstraints.html">Collection&nbsp;Constraints</a></li>
<li><a href="compoundConstraints.html">Compound&nbsp;Constraints</a></li>
<li><a href="customConstraints.html">Custom&nbsp;Constraints</a></li>
</ul>
</ul>
<li><a href="attributes.html">Attributes</a></li>
<li><a href="configFiles.html">Configuration&nbsp;Files</a></li>
<li><a href="multiAssembly.html">Multiple&nbsp;Assemblies</a></li>
<li><a href="vsSupport.html">Visual&nbsp;Studio&nbsp;Support</a></li>
<li><a href="extensibility.html">Extensibility</a></li>
</ul>
<li><a href="nunit-console.html">Console&nbsp;Runner</a></li>
<li><a href="nunit-gui.html">Gui&nbsp;Runner</a></li>
<li><a href="releaseNotes.html">Release&nbsp;Notes</a></li>
<li><a href="samples.html">Samples</a></li>
<li><a href="license.html">License</a></li>
</ul>
</ul>
</div>
<!-- End of Submenu -->
<!-- Standard Footer for NUnit.org -->
<div id="footer">
Copyright &copy; 2006 Charlie Poole. All Rights Reserved.
</div>
<!-- End of Footer -->
</body>
</html>

108
doc/customConstraints.html Normal file
Просмотреть файл

@ -0,0 +1,108 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<!-- Standard Head Part -->
<head>
<title>NUnit - CustomConstraints</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-US">
<link rel="stylesheet" type="text/css" href="nunit.css">
<link rel="shortcut icon" href="favicon.ico">
</head>
<!-- End Standard Head Part -->
<body>
<!-- Standard Header for NUnit.org -->
<div id="header">
<a id="logo" href="http://www.nunit.org"><img src="img/logo.gif" alt="NUnit.org" title="NUnit.org"></a>
<div id="nav">
<a href="http://www.nunit.org">NUnit</a>
<a class="active" href="index.html">Documentation</a>
</div>
</div>
<!-- End of Header -->
<div id="content">
<h2>Custom Constraints (NUnit 2.4)</h2>
<p>You can implement your own custom constraints by creating a class
that implements the <b>IConstraint</b> interface, which supports performing a test
on an actual value and generating appropriate messages. The interface is
defined as follows:
<div class="code" style="width: 36em">
<pre>public interface IConstraint
{
bool Matches( object actual );
void WriteMessageTo( MessageWriter writer );
void WriteDescriptionTo( MessageWriter writer );
void WriteActualValueTo( MessageWriter writer );
}</pre>
</div>
<p>One approach is to derive from the abstract class Constraint, which
provides the <b>&amp;</b> and <b>|</b> operators as well as a default
implementation of the WriteMessageTo() and WriteActualValueTo() methods.
<p>Your derived class should save the actual argument to Matches for later use.
If deriving from Constraint, use the protected field actual for this purpose.
<p>The MessageWriter abstract class is implemented in the framework by
TextMessageWriter. Examining the source for some of the builtin constraints
should give you a good idea of how to use it.
</div>
<!-- Submenu -->
<div id="subnav">
<ul>
<li><a href="index.html">NUnit 2.4</a></li>
<ul>
<li><a href="getStarted.html">Getting&nbsp;Started</a></li>
<li><a href="platformSupport.html">Platform&nbsp;Support</a></li>
<li><a href="installation.html">Installation</a></li>
<li><a href="features.html">Core&nbsp;Features</a></li>
<ul>
<li><a href="assertions.html">Assertions</a></li>
<ul>
<li><a href="classicModel.html">Classic&nbsp;Model</a></li>
<li><a href="constraintModel.html">Constraint&nbsp;Model</a></li>
<ul>
<li><a href="equalConstraint.html">Equal&nbsp;Constraint</a></li>
<li><a href="sameasConstraint.html">SameAs&nbsp;Constraint</a></li>
<li><a href="conditionConstraints.html">Condition&nbsp;Constraints</a></li>
<li><a href="comparisonConstraints.html">Comparison&nbsp;Constrants</a></li>
<li><a href="typeConstraints.html">Type&nbsp;Constraints</a></li>
<li><a href="stringConstraints.html">String&nbsp;Constraints</a></li>
<li><a href="collectionConstraints.html">Collection&nbsp;Constraints</a></li>
<li><a href="compoundConstraints.html">Compound&nbsp;Constraints</a></li>
<li id="current"><a href="customConstraints.html">Custom&nbsp;Constraints</a></li>
</ul>
</ul>
<li><a href="attributes.html">Attributes</a></li>
<li><a href="configFiles.html">Configuration&nbsp;Files</a></li>
<li><a href="multiAssembly.html">Multiple&nbsp;Assemblies</a></li>
<li><a href="vsSupport.html">Visual&nbsp;Studio&nbsp;Support</a></li>
<li><a href="extensibility.html">Extensibility</a></li>
</ul>
<li><a href="nunit-console.html">Console&nbsp;Runner</a></li>
<li><a href="nunit-gui.html">Gui&nbsp;Runner</a></li>
<li><a href="releaseNotes.html">Release&nbsp;Notes</a></li>
<li><a href="samples.html">Samples</a></li>
<li><a href="license.html">License</a></li>
</ul>
</ul>
</div>
<!-- End of Submenu -->
<!-- Standard Footer for NUnit.org -->
<div id="footer">
Copyright &copy; 2006 Charlie Poole. All Rights Reserved.
</div>
<!-- End of Footer -->
</body>
</html>

184
doc/description.html Normal file
Просмотреть файл

@ -0,0 +1,184 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<!-- Standard Head Part -->
<head>
<title>NUnit - Description</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-US">
<link rel="stylesheet" type="text/css" href="nunit.css">
<link rel="shortcut icon" href="favicon.ico">
</head>
<!-- End Standard Head Part -->
<body>
<!-- Standard Header for NUnit.org -->
<div id="header">
<a id="logo" href="http://www.nunit.org"><img src="img/logo.gif" alt="NUnit.org" title="NUnit.org"></a>
<div id="nav">
<a href="http://www.nunit.org">NUnit</a>
<a class="active" href="index.html">Documentation</a>
</div>
</div>
<!-- End of Header -->
<div id="content">
<script language="JavaScript" src="codeFuncs.js" ></script> <!-- Do it this way for IE -->
<h3>Description (NUnit 2.4)</h3>
<p>The Description attribute is used to apply descriptive text to a Test,
TestFixture or Assembly. The text appears in the XML output file and is
shown in the Test Properties dialog.</p>
<h4>Example:</h4>
<div class="code">
<div class="langFilter">
<a href="javascript:Show('DD1')" onmouseover="Show('DD1')"><img src="img/langFilter.gif" width="14" height="14" alt="Language Filter"></a>
<div id="DD1" class="dropdown" style="display: none;" onclick="Hide('DD1')">
<a href="javascript:ShowCS()">C#</a><br>
<a href="javascript:ShowVB()">VB</a><br>
<a href="javascript:ShowMC()">C++</a><br>
<a href="javascript:ShowJS()">J#</a><br>
</div>
</div>
<pre class="cs">[assembly: Description("Assembly description here")]
namespace NUnit.Tests
{
using System;
using NUnit.Framework;
[TestFixture, Description("Fixture description here")]
public class SomeTests
{
[Test, Description("Test description here")]
public void OneTest()
{ /* ... */ }
}
}
</pre>
<pre class="vb">&lt;assembly: Description("Assembly description here")&gt;
Imports System
Imports Nunit.Framework
Namespace Nunit.Tests
&lt;TestFixture(), Description("Fixture description here")&gt;_
Public Class SomeTests
&lt;Test(), Description("Test description here")&gt;_
Public Sub OneTest()
' ...
End Sub
End Class
End Namespace
</pre>
<pre class="mc">[assembly:Description("Assembly description here")]
#using &lt;Nunit.Framework.dll&gt;
using namespace System;
using namespace NUnit::Framework;
namespace NUnitTests
{
[TestFixture, Description("Fixture description here")]
public __gc class SomeTests
{
[Test, Description("Test description here")]
void OneTest();
};
}
#include "cppsample.h"
namespace NUnitTests {
// ...
}
</pre>
<pre class="js">/** @assembly NUnit.Framework.Description("Assembly description here") */
package NUnit.Tests;
import System.*;
import NUnit.Framework.TestFixture;
/** @attribute NUnit.Framework.TestFixture() */
/** @attribute NUnit.Framework.Description("Fixture description here") */
public class SomeTests
{
/** @attribute NUnit.Framework.Test() */
/** @attribute NUnit.Framework.Description("Test description here") */
public void OneTest()
{ /* ... */ }
}
</pre>
</div>
<p><b>Note:</b> The Test and TestFixture attributes continue to support an
optional Description property. The Description attribute should be used for
new applciations. If both are used, the Description attribute takes precedence.</p>
</div>
<!-- Submenu -->
<div id="subnav">
<ul>
<li><a href="index.html">NUnit 2.4</a></li>
<ul>
<li><a href="getStarted.html">Getting&nbsp;Started</a></li>
<li><a href="platformSupport.html">Platform&nbsp;Support</a></li>
<li><a href="installation.html">Installation</a></li>
<li><a href="features.html">Core&nbsp;Features</a></li>
<ul>
<li><a href="assertions.html">Assertions</a></li>
<li><a href="attributes.html">Attributes</a></li>
<ul>
<li><a href="category.html">Category</a></li>
<li id="current"><a href="description.html">Description</a></li>
<li><a href="exception.html">Expected&nbsp;Exception</a></li>
<li><a href="explicit.html">Explicit</a></li>
<li><a href="ignore.html">Ignore</a></li>
<li><a href="platform.html">Platform</a></li>
<li><a href="property.html">Property</a></li>
<li><a href="setup.html">Setup</a></li>
<li><a href="setupFixture.html">SetUp&nbsp;Fixture</a></li>
<li><a href="suite.html">Suite</a></li>
<li><a href="teardown.html">Teardown</a></li>
<li><a href="test.html">Test</a></li>
<li><a href="testFixture.html">Test&nbsp;Fixture</a></li>
<li><a href="fixtureSetup.html">Test&nbsp;Fixture&nbsp;SetUp</a></li>
<li><a href="fixtureTeardown.html">Test&nbsp;Fixture&nbsp;TearDown</a></li>
</ul>
<li><a href="configFiles.html">Configuration&nbsp;Files</a></li>
<li><a href="multiAssembly.html">Multiple&nbsp;Assemblies</a></li>
<li><a href="vsSupport.html">Visual&nbsp;Studio&nbsp;Support</a></li>
<li><a href="extensibility.html">Extensibility</a></li>
</ul>
<li><a href="nunit-console.html">Console&nbsp;Runner</a></li>
<li><a href="nunit-gui.html">Gui&nbsp;Runner</a></li>
<li><a href="releaseNotes.html">Release&nbsp;Notes</a></li>
<li><a href="samples.html">Samples</a></li>
<li><a href="license.html">License</a></li>
</ul>
</ul>
</div>
<!-- End of Submenu -->
<!-- Standard Footer for NUnit.org -->
<div id="footer">
Copyright &copy; 2006 Charlie Poole. All Rights Reserved.
</div>
<!-- End of Footer -->
</body>
</html>

145
doc/equalConstraint.html Normal file
Просмотреть файл

@ -0,0 +1,145 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<!-- Standard Head Part -->
<head>
<title>NUnit - EqualConstraint</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-US">
<link rel="stylesheet" type="text/css" href="nunit.css">
<link rel="shortcut icon" href="favicon.ico">
</head>
<!-- End Standard Head Part -->
<body>
<!-- Standard Header for NUnit.org -->
<div id="header">
<a id="logo" href="http://www.nunit.org"><img src="img/logo.gif" alt="NUnit.org" title="NUnit.org"></a>
<div id="nav">
<a href="http://www.nunit.org">NUnit</a>
<a class="active" href="index.html">Documentation</a>
</div>
</div>
<!-- End of Header -->
<div id="content">
<h2>Equal Constraint (NUnit 2.4)</h2>
<p>An EqualConstraint is used to test whether an actual value
is equal to the expected value supplied in its constructor.
<table class="constraints">
<tr><th>Syntax Helper</th><th>Constructor</th><th>Operation</th></tr>
<tr><td>Is.EqualTo( object )</td><td>EqualConstraint( null )</td></td><td>tests that two objects are equal</td></tr>
</table>
<h4>Notes</h4>
<ol>
<li>Numerics of different types compare successfully if their values are equal.
<li>Values of type float and double are normally compared using an additional
argument that indicates a tolerance within which they will be considered
as equal. The Within modifier is used for this purpose. It is accepted
but ignored on comparisons other than float or double.
<li>Unlike normal floating point arithmetic, floating NaN comparisons succeed
if both values are NaN. See the note on
<a href="equalityAsserts.html">Equality Asserts</a>.
<li>You may use this constraint to compare arrays with the same number of dimensions,
two collections or an single-dimensioned array and collection. If you want to
treat the arrays being compared as simple collections, use the AsCollection
modifier, which causes the comparison to be made element by element, without
regard for the rank or dimensions of the array. Jagged arrays (arrays of arrays)
are compared recursively and must match in shape exactly for the comparison
to succeed.
<li>In order to assert that two strings are equal ignoring case, use the IgnoreCase
modifier. It may also be used when comparing arrays or collections of strings.
</ol>
<h4>Examples of Use</h4>
<div class="code" style="width: 40em"><pre>
Assert.That(2 + 2, Is.EqualTo(4));
Assert.That(2 + 2 == 4);
Assert.That(2 + 2, Is.Not.EqualTo(5));
Assert.That(2 + 2 != 5);
Assert.That( 5.0, Is.EqualTo( 5 );
Assert.That( 2.1 + 1.2, Is.EqualTo( 3.3 ).Within( .0005 );
Assert.That( double.PositiveInfinity, Is.EqualTo( double.PositiveInfinity ) );
Assert.That( double.NegativeInfinity, Is.EqualTo( double.NegativeInfinity ) );
Assert.That( double.NaN, Is.EqualTo( double.NaN ) );
int[] i3 = new int[] { 1, 2, 3 };
double[] d3 = new double[] { 1.0, 2.0, 3.0 };
int[] iunequal = new int[] { 1, 3, 2 };
Assert.That(i3, Is.EqualTo(d3));
Assert.That(i3, Is.Not.EqualTo(iunequal));
int array2x2 = new int[,] { { 1, 2 } { 3, 4 } };
int array4 = new int[] { 1, 2, 3, 4 };
Assert.That( array2x2, Is.EqualTo( array4 ) ); // Fails
Assert.That( array2x2, Is.EqualTo( array4 ).AsCollection ); // Succeeds
Assert.That( "Hello!", Is.EqualTo( "HELLO!" ).IgnoreCase );
string[] expected = new string[] { "Hello", World" };
string[] actual = new string[] { "HELLO", "world" };
Assert.That( actual, Is.EqualTo( expected ).IgnoreCase;
// Using inheritance
Expect( i3, EqualTo( d3 ) );
Expect( i3, Not.EqualTo( iunequal ) );
</pre></div>
</div>
<!-- Submenu -->
<div id="subnav">
<ul>
<li><a href="index.html">NUnit 2.4</a></li>
<ul>
<li><a href="getStarted.html">Getting&nbsp;Started</a></li>
<li><a href="platformSupport.html">Platform&nbsp;Support</a></li>
<li><a href="installation.html">Installation</a></li>
<li><a href="features.html">Core&nbsp;Features</a></li>
<ul>
<li><a href="assertions.html">Assertions</a></li>
<ul>
<li><a href="classicModel.html">Classic&nbsp;Model</a></li>
<li><a href="constraintModel.html">Constraint&nbsp;Model</a></li>
<ul>
<li id="current"><a href="equalConstraint.html">Equal&nbsp;Constraint</a></li>
<li><a href="sameasConstraint.html">SameAs&nbsp;Constraint</a></li>
<li><a href="conditionConstraints.html">Condition&nbsp;Constraints</a></li>
<li><a href="comparisonConstraints.html">Comparison&nbsp;Constrants</a></li>
<li><a href="typeConstraints.html">Type&nbsp;Constraints</a></li>
<li><a href="stringConstraints.html">String&nbsp;Constraints</a></li>
<li><a href="collectionConstraints.html">Collection&nbsp;Constraints</a></li>
<li><a href="compoundConstraints.html">Compound&nbsp;Constraints</a></li>
<li><a href="customConstraints.html">Custom&nbsp;Constraints</a></li>
</ul>
</ul>
<li><a href="attributes.html">Attributes</a></li>
<li><a href="configFiles.html">Configuration&nbsp;Files</a></li>
<li><a href="multiAssembly.html">Multiple&nbsp;Assemblies</a></li>
<li><a href="vsSupport.html">Visual&nbsp;Studio&nbsp;Support</a></li>
<li><a href="extensibility.html">Extensibility</a></li>
</ul>
<li><a href="nunit-console.html">Console&nbsp;Runner</a></li>
<li><a href="nunit-gui.html">Gui&nbsp;Runner</a></li>
<li><a href="releaseNotes.html">Release&nbsp;Notes</a></li>
<li><a href="samples.html">Samples</a></li>
<li><a href="license.html">License</a></li>
</ul>
</ul>
</div>
<!-- End of Submenu -->
<!-- Standard Footer for NUnit.org -->
<div id="footer">
Copyright &copy; 2006 Charlie Poole. All Rights Reserved.
</div>
<!-- End of Footer -->
</body>
</html>

Просмотреть файл

@ -24,7 +24,7 @@
<div id="content">
<script language="JavaScript" src="codeFuncs.js" />
<script language="JavaScript" src="codeFuncs.js" ></script> <!-- Do it this way for IE -->
<h3>ExpectedExceptionAttribute (NUnit 2.0 plus Updates)</h3>

Просмотреть файл

@ -24,7 +24,7 @@
<div id="content">
<script language="JavaScript" src="codeFuncs.js" />
<script language="JavaScript" src="codeFuncs.js" ></script> <!-- Do it this way for IE -->
<h3>ExplicitAttribute (NUnit 2.2)</h3>

Просмотреть файл

@ -24,7 +24,7 @@
<div id="content">
<script language="JavaScript" src="codeFuncs.js" />
<script language="JavaScript" src="codeFuncs.js" ></script> <!-- Do it this way for IE -->
<h3>TestFixtureSetUpAttribute (NUnit 2.1)</h3>

Просмотреть файл

@ -24,7 +24,7 @@
<div id="content">
<script language="JavaScript" src="codeFuncs.js" />
<script language="JavaScript" src="codeFuncs.js" ></script> <!-- Do it this way for IE -->
<h3>TestFixtureTearDownAttribute (NUnit 2.1)</h3>

Просмотреть файл

@ -24,7 +24,7 @@
<div id="content">
<script language="JavaScript" src="codeFuncs.js" />
<script language="JavaScript" src="codeFuncs.js" ></script> <!-- Do it this way for IE -->
<h3>IgnoreAttribute (NUnit 2.0)</h3>

Просмотреть файл

@ -24,7 +24,7 @@
<div id="content">
<script language="JavaScript" src="codeFuncs.js" />
<script language="JavaScript" src="codeFuncs.js" ></script> <!-- Do it this way for IE -->
<style><!--
div.code { width: 34em }

86
doc/platformSupport.html Normal file
Просмотреть файл

@ -0,0 +1,86 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<!-- Standard Head Part -->
<head>
<title>NUnit - PlatformSupport</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-US">
<link rel="stylesheet" type="text/css" href="nunit.css">
<link rel="shortcut icon" href="favicon.ico">
</head>
<!-- End Standard Head Part -->
<body>
<!-- Standard Header for NUnit.org -->
<div id="header">
<a id="logo" href="http://www.nunit.org"><img src="img/logo.gif" alt="NUnit.org" title="NUnit.org"></a>
<div id="nav">
<a href="http://www.nunit.org">NUnit</a>
<a class="active" href="index.html">Documentation</a>
</div>
</div>
<!-- End of Header -->
<div id="content">
<h2>NUnit Platform Support</h2>
<p>NUnit 2.4 is distributed in two binary packages, one built with .Net 1.1 and
one build with .Net 2.0. Users may also build NUnit on other platforms.
<p>The following table lists the platforms under which we have successfully built
and tested NUnit. We have heard of people building and running NUnit under OS/X,
but have not tested it ourselves. If you have information about other platforms
on which you have built or run NUnit, please let us know.
<table class="platforms">
<tr><th rowspan=3 colspan=2>Build Platform</th><th colspan=7 style="text-align: center">Execution platform</th></tr>
<tr><th colspan=5 style="text-align: center">Windows</th><th colspan=2 style="text-align: center">Linux</th></tr>
<tr><th>.Net&nbsp;1.0</th><th>.Net&nbsp;1.1</th><th>.Net&nbsp;2.0</th><th>Mono&nbsp;1.0</th><th>Mono&nbsp;2.0</th><th>Mono&nbsp;1.0</th><th>Mono&nbsp;2.0</th></tr>
<tr><th rowspan=5>Windows</th><th>.Net&nbsp;1.0</th><td>OK</td><td>OK</td><td>OK</td><td>OK</td><td>OK</td><td>(1)</td><td>(1)</td></tr>
<tr><th>.Net&nbsp;1.1</th><td>OK</td><td>OK</td><td>OK</td><td>OK</td><td>OK</td><td>OK</td><td>OK</td></tr>
<tr><th>.Net&nbsp;2.0</th><td>-</td><td>-</td><td>OK</td><td>-</td><td>OK</td><td>-</td><td>(2)</td></tr>
<tr><th>Mono&nbsp;1.0</th><td>OK</td><td>OK</td><td>OK</td><td>OK</td><td>OK</td><td>OK</td><td>OK</td></tr>
<tr><th>Mono&nbsp;2.0</th><td>-</td><td>-</td><td>OK</td><td>-</td><td>OK</td><td>-</td><td>(2)</td></tr>
<tr><th rowspan=2>Linux</th><th>Mono&nbsp;1.0</th><td>Fails</td><td>Fails</td><td>Fails</td><td>OK</td><td>OK</td><td>OK</td><td>OK</td></tr>
<tr><th>Mono&nbsp;2.0</th><td>-</td><td>-</td><td>Fails</td><td>-</td><td>OK</td><td>-</td><td>OK</td></tr>
</table>
<h4>Notes</h4>
<ol>
<li>The build runs with 2 NUnit test failures.
<li>The build fails to run. No error message is displayed.
</ol>
</div>
<!-- Submenu -->
<div id="subnav">
<ul>
<li><a href="index.html">NUnit 2.4</a></li>
<ul>
<li><a href="getStarted.html">Getting&nbsp;Started</a></li>
<li id="current"><a href="platformSupport.html">Platform&nbsp;Support</a></li>
<li><a href="installation.html">Installation</a></li>
<li><a href="features.html">Core&nbsp;Features</a></li>
<li><a href="nunit-console.html">Console&nbsp;Runner</a></li>
<li><a href="nunit-gui.html">Gui&nbsp;Runner</a></li>
<li><a href="releaseNotes.html">Release&nbsp;Notes</a></li>
<li><a href="samples.html">Samples</a></li>
<li><a href="license.html">License</a></li>
</ul>
</ul>
</div>
<!-- End of Submenu -->
<!-- Standard Footer for NUnit.org -->
<div id="footer">
Copyright &copy; 2006 Charlie Poole. All Rights Reserved.
</div>
<!-- End of Footer -->
</body>
</html>

Просмотреть файл

@ -24,7 +24,7 @@
<div id="content">
<script language="JavaScript" src="codeFuncs.js" />
<script language="JavaScript" src="codeFuncs.js" ></script> <!-- Do it this way for IE -->
<h3>PropertyAttribute (NUnit 2.4)</h3>

Просмотреть файл

@ -32,7 +32,7 @@ dt { font-weight: bold }
<h2>Release Notes</h2>
<h3>NUnit 2.4 Release Candidate (2.4.0) - February 9, 2007</h3>
<h3>NUnit 2.4 Release Candidate (2.4.0) - February 25, 2007</h3>
<h4>General</h4>

104
doc/sameasConstraint.html Normal file
Просмотреть файл

@ -0,0 +1,104 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<!-- Standard Head Part -->
<head>
<title>NUnit - SameasConstraint</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-US">
<link rel="stylesheet" type="text/css" href="nunit.css">
<link rel="shortcut icon" href="favicon.ico">
</head>
<!-- End Standard Head Part -->
<body>
<!-- Standard Header for NUnit.org -->
<div id="header">
<a id="logo" href="http://www.nunit.org"><img src="img/logo.gif" alt="NUnit.org" title="NUnit.org"></a>
<div id="nav">
<a href="http://www.nunit.org">NUnit</a>
<a class="active" href="index.html">Documentation</a>
</div>
</div>
<!-- End of Header -->
<div id="content">
<h2>Same As Constraint (NUnit 2.4)</h2>
<p>A SameAsConstraint is used to test whether the object passed
as an actual value has the same identity as the object supplied
in its constructor.
<table class="constraints">
<tr><th>Syntax Helper</th><th>Constructor</th><th>Operation</th></tr>
<tr><td>Is.SameAs( object )</td><td>SameAsConstraint( null )</td></td><td>tests that two object references refer to the same object</td></tr>
</table>
<h4>Examples of Use</h4>
<div class="code"><pre>
Exception ex1 = new Exception();
Exception ex2 = ex1;
Assert.That( ex2, Is.SameAs( ex1 ) );
Exception ex3 = new Exception();
Assert.That( ex3, Is.Not.SameAs( ex1 ) );
// Using inheritance
Expect( ex2, SameAs( ex1 ) );
Expect( ex3, Not.SameAs( ex1 ) );
</pre></div>
</div>
<!-- Submenu -->
<div id="subnav">
<ul>
<li><a href="index.html">NUnit 2.4</a></li>
<ul>
<li><a href="getStarted.html">Getting&nbsp;Started</a></li>
<li><a href="platformSupport.html">Platform&nbsp;Support</a></li>
<li><a href="installation.html">Installation</a></li>
<li><a href="features.html">Core&nbsp;Features</a></li>
<ul>
<li><a href="assertions.html">Assertions</a></li>
<ul>
<li><a href="classicModel.html">Classic&nbsp;Model</a></li>
<li><a href="constraintModel.html">Constraint&nbsp;Model</a></li>
<ul>
<li><a href="equalConstraint.html">Equal&nbsp;Constraint</a></li>
<li id="current"><a href="sameasConstraint.html">SameAs&nbsp;Constraint</a></li>
<li><a href="conditionConstraints.html">Condition&nbsp;Constraints</a></li>
<li><a href="comparisonConstraints.html">Comparison&nbsp;Constrants</a></li>
<li><a href="typeConstraints.html">Type&nbsp;Constraints</a></li>
<li><a href="stringConstraints.html">String&nbsp;Constraints</a></li>
<li><a href="collectionConstraints.html">Collection&nbsp;Constraints</a></li>
<li><a href="compoundConstraints.html">Compound&nbsp;Constraints</a></li>
<li><a href="customConstraints.html">Custom&nbsp;Constraints</a></li>
</ul>
</ul>
<li><a href="attributes.html">Attributes</a></li>
<li><a href="configFiles.html">Configuration&nbsp;Files</a></li>
<li><a href="multiAssembly.html">Multiple&nbsp;Assemblies</a></li>
<li><a href="vsSupport.html">Visual&nbsp;Studio&nbsp;Support</a></li>
<li><a href="extensibility.html">Extensibility</a></li>
</ul>
<li><a href="nunit-console.html">Console&nbsp;Runner</a></li>
<li><a href="nunit-gui.html">Gui&nbsp;Runner</a></li>
<li><a href="releaseNotes.html">Release&nbsp;Notes</a></li>
<li><a href="samples.html">Samples</a></li>
<li><a href="license.html">License</a></li>
</ul>
</ul>
</div>
<!-- End of Submenu -->
<!-- Standard Footer for NUnit.org -->
<div id="footer">
Copyright &copy; 2006 Charlie Poole. All Rights Reserved.
</div>
<!-- End of Footer -->
</body>
</html>

Просмотреть файл

@ -24,7 +24,7 @@
<div id="content">
<script language="JavaScript" src="codeFuncs.js" />
<script language="JavaScript" src="codeFuncs.js" ></script> <!-- Do it this way for IE -->
<h3>SetUpAttribute (NUnit 2.0)</h3>

Просмотреть файл

@ -24,7 +24,7 @@
<div id="content">
<script language="JavaScript" src="codeFuncs.js" />
<script language="JavaScript" src="codeFuncs.js" ></script> <!-- Do it this way for IE -->
<h3>SetUpFixtureAttribute (NUnit 2.4)</h3>

117
doc/stringConstraints.html Normal file
Просмотреть файл

@ -0,0 +1,117 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<!-- Standard Head Part -->
<head>
<title>NUnit - StringConstraints</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-US">
<link rel="stylesheet" type="text/css" href="nunit.css">
<link rel="shortcut icon" href="favicon.ico">
</head>
<!-- End Standard Head Part -->
<body>
<!-- Standard Header for NUnit.org -->
<div id="header">
<a id="logo" href="http://www.nunit.org"><img src="img/logo.gif" alt="NUnit.org" title="NUnit.org"></a>
<div id="nav">
<a href="http://www.nunit.org">NUnit</a>
<a class="active" href="index.html">Documentation</a>
</div>
</div>
<!-- End of Header -->
<div id="content">
<h2>String Constraints (NUnit 2.4)</h2>
<p>String constraints perform tests that are specific to strings.
The following string constraints are provided.
<table class="constraints">
<tr><th>Syntax Helpers</th><th>Constructor</th><th>Operation</th></tr>
<tr><td>Text.Contains( string )<br>Text.DoesNotContain( string )</td><td>SubstringConstraint( string )</td></td><td>tests for a substring</td></tr>
<tr><td>Text.StartsWith( string )<br>Text.DoesNotStartWith( string )</td><td>StartsWithConstraint( string )</td></td><td>tests for an initial string</td></tr>
<tr><td>Text.EndsWith( string )<br>Text.DoesNotEndWith( string )</td><td>EndsWithConstraint( string )</td></td><td>tests for an ending string</td></tr>
<tr><td>Text.Matches( string )<br>Text.DoesNotMatch( string )</td><td>RegexConstraint( string )</td></td><td>tests that a pattern is matched</td></tr>
</table>
<h4>Examples</h4>
<div class="code" style="width: 36em"><pre>
string phrase = "Make your tests fail before passing!"
Assert.That( phrase, Text.Contains( "tests fail" ) );
Assert.That( phrase, Text.Contains( "make" ).IgnoreCase );
Assert.That( phrase, Text.StartsWith( "Make" ) );
Assert.That( phrase, Text.Not.StartsWith( "Break" ) );
Assert.That( phrase, Text.DoesNotStartWith( "Break" ) );
Assert.That( phrase, Text.EndsWith( "!" ) );
Assert.That( phrase, Text.EndsWith( "PASSING!" ).IgnoreCase );
Assert.That( phrase, Text.Matches( "Make.*tests.*pass" ) );
Assert.That( phrase, Text.Not.Matches( "your.*passing.*tests" ) );
Assert.That( phrase, Text.DoesNotMatch( "your.*passing.*tests" ) );
// Using Inheritance
Expect( phrase, Contains( "make" ).IgnoreCase );
Expect( phrase, EndsWith( "!" ) );
Expect( phrase, Matches( "Make.*pass" ) );
</pre></div>
</div>
<!-- Submenu -->
<div id="subnav">
<ul>
<li><a href="index.html">NUnit 2.4</a></li>
<ul>
<li><a href="getStarted.html">Getting&nbsp;Started</a></li>
<li><a href="platformSupport.html">Platform&nbsp;Support</a></li>
<li><a href="installation.html">Installation</a></li>
<li><a href="features.html">Core&nbsp;Features</a></li>
<ul>
<li><a href="assertions.html">Assertions</a></li>
<ul>
<li><a href="classicModel.html">Classic&nbsp;Model</a></li>
<li><a href="constraintModel.html">Constraint&nbsp;Model</a></li>
<ul>
<li><a href="equalConstraint.html">Equal&nbsp;Constraint</a></li>
<li><a href="sameasConstraint.html">SameAs&nbsp;Constraint</a></li>
<li><a href="conditionConstraints.html">Condition&nbsp;Constraints</a></li>
<li><a href="comparisonConstraints.html">Comparison&nbsp;Constrants</a></li>
<li><a href="typeConstraints.html">Type&nbsp;Constraints</a></li>
<li id="current"><a href="stringConstraints.html">String&nbsp;Constraints</a></li>
<li><a href="collectionConstraints.html">Collection&nbsp;Constraints</a></li>
<li><a href="compoundConstraints.html">Compound&nbsp;Constraints</a></li>
<li><a href="customConstraints.html">Custom&nbsp;Constraints</a></li>
</ul>
</ul>
<li><a href="attributes.html">Attributes</a></li>
<li><a href="configFiles.html">Configuration&nbsp;Files</a></li>
<li><a href="multiAssembly.html">Multiple&nbsp;Assemblies</a></li>
<li><a href="vsSupport.html">Visual&nbsp;Studio&nbsp;Support</a></li>
<li><a href="extensibility.html">Extensibility</a></li>
</ul>
<li><a href="nunit-console.html">Console&nbsp;Runner</a></li>
<li><a href="nunit-gui.html">Gui&nbsp;Runner</a></li>
<li><a href="releaseNotes.html">Release&nbsp;Notes</a></li>
<li><a href="samples.html">Samples</a></li>
<li><a href="license.html">License</a></li>
</ul>
</ul>
</div>
<!-- End of Submenu -->
<!-- Standard Footer for NUnit.org -->
<div id="footer">
Copyright &copy; 2006 Charlie Poole. All Rights Reserved.
</div>
<!-- End of Footer -->
</body>
</html>

Просмотреть файл

@ -24,7 +24,7 @@
<div id="content">
<script language="JavaScript" src="codeFuncs.js" />
<script language="JavaScript" src="codeFuncs.js" ></script> <!-- Do it this way for IE -->
<h3>TearDownAttribute (NUnit 2.0)</h3>

Просмотреть файл

@ -24,7 +24,7 @@
<div id="content">
<script language="JavaScript" src="codeFuncs.js" />
<script language="JavaScript" src="codeFuncs.js" ></script> <!-- Do it this way for IE -->
<h3>TestAttribute (NUnit 2.0)</h3>

Просмотреть файл

@ -24,7 +24,7 @@
<div id="content">
<script language="JavaScript" src="codeFuncs.js" />
<script language="JavaScript" src="codeFuncs.js" ></script> <!-- Do it this way for IE -->
<h3>TestFixtureAttribute (NUnit 2.0)</h3>
<p>This is the attribute that marks a class that contains tests and, optionally,

109
doc/typeConstraints.html Normal file
Просмотреть файл

@ -0,0 +1,109 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<!-- Standard Head Part -->
<head>
<title>NUnit - TypeConstraints</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-US">
<link rel="stylesheet" type="text/css" href="nunit.css">
<link rel="shortcut icon" href="favicon.ico">
</head>
<!-- End Standard Head Part -->
<body>
<!-- Standard Header for NUnit.org -->
<div id="header">
<a id="logo" href="http://www.nunit.org"><img src="img/logo.gif" alt="NUnit.org" title="NUnit.org"></a>
<div id="nav">
<a href="http://www.nunit.org">NUnit</a>
<a class="active" href="index.html">Documentation</a>
</div>
</div>
<!-- End of Header -->
<div id="content">
<h2>Type Constraints (NUnit 2.4)</h2>
<p>Type constraints perform tests that are specific to Types.
The following type constraints are provided:
<table class="constraints">
<tr><th>Syntax Helper</th><th>Constructor</th><th>Operation</th></tr>
<tr><td>Is.TypeOf( Type )</td><td>ExactTypeConstraint( Type )</td></td><td>tests that an object is an exact Type</td></tr>
<tr><td>Is.InstanceOfType( Type )</td><td>InstanceOfTypeConstraint( Type )</td></td><td>tests that an object is an instance of a Type</td></tr>
<tr><td>Is.AssignableFrom( Type )</td><td>AssignableFromConstraint( Type )</td></td><td>tests that one type is assignable from another</td></tr>
</table>
<h4>Examples of Use</h4>
<div class="code"><pre>
Assert.That("Hello", Is.TypeOf(typeof(string)));
Assert.That("Hello", Is.Not.TypeOf(typeof(int)));
Assert.That("Hello", Is.InstanceOfType(typeof(string)));
Assert.That(5, Is.Not.InstanceOfType(typeof(string)));
Assert.That( "Hello", Is.AssignableFrom(typeof(string)));
Assert.That( 5, Is.Not.AssignableFrom(typeof(string)));
// Using inheritance
Expect( 5, Not.InstanceOfType(typeof(string)));
Expect( "Hello", AssignableFrom(typeOf(string)));
</pre></div>
</div>
<!-- Submenu -->
<div id="subnav">
<ul>
<li><a href="index.html">NUnit 2.4</a></li>
<ul>
<li><a href="getStarted.html">Getting&nbsp;Started</a></li>
<li><a href="platformSupport.html">Platform&nbsp;Support</a></li>
<li><a href="installation.html">Installation</a></li>
<li><a href="features.html">Core&nbsp;Features</a></li>
<ul>
<li><a href="assertions.html">Assertions</a></li>
<ul>
<li><a href="classicModel.html">Classic&nbsp;Model</a></li>
<li><a href="constraintModel.html">Constraint&nbsp;Model</a></li>
<ul>
<li><a href="equalConstraint.html">Equal&nbsp;Constraint</a></li>
<li><a href="sameasConstraint.html">SameAs&nbsp;Constraint</a></li>
<li><a href="conditionConstraints.html">Condition&nbsp;Constraints</a></li>
<li><a href="comparisonConstraints.html">Comparison&nbsp;Constrants</a></li>
<li id="current"><a href="typeConstraints.html">Type&nbsp;Constraints</a></li>
<li><a href="stringConstraints.html">String&nbsp;Constraints</a></li>
<li><a href="collectionConstraints.html">Collection&nbsp;Constraints</a></li>
<li><a href="compoundConstraints.html">Compound&nbsp;Constraints</a></li>
<li><a href="customConstraints.html">Custom&nbsp;Constraints</a></li>
</ul>
</ul>
<li><a href="attributes.html">Attributes</a></li>
<li><a href="configFiles.html">Configuration&nbsp;Files</a></li>
<li><a href="multiAssembly.html">Multiple&nbsp;Assemblies</a></li>
<li><a href="vsSupport.html">Visual&nbsp;Studio&nbsp;Support</a></li>
<li><a href="extensibility.html">Extensibility</a></li>
</ul>
<li><a href="nunit-console.html">Console&nbsp;Runner</a></li>
<li><a href="nunit-gui.html">Gui&nbsp;Runner</a></li>
<li><a href="releaseNotes.html">Release&nbsp;Notes</a></li>
<li><a href="samples.html">Samples</a></li>
<li><a href="license.html">License</a></li>
</ul>
</ul>
</div>
<!-- End of Submenu -->
<!-- Standard Footer for NUnit.org -->
<div id="footer">
Copyright &copy; 2006 Charlie Poole. All Rights Reserved.
</div>
<!-- End of Footer -->
</body>
</html>

Просмотреть файл

@ -1,171 +1,171 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><body>
<h1>NUnit Acceptance Tests</h1>
<p>Developers love self-referential programs! Hence, NUnit has always
run all it's own tests, even those that are not really unit tests.
<p>Now, beginning with NUnit 2.4, NUnit has top-level tests
using Ward Cunningham's FIT framework. At this time, the tests
are pretty rudimentary, but it's a start and it's a framework
for doing more.
<h2>Running the Tests</h2>
<p>Open a console or shell window and navigate to the NUnit bin
directory, which contains this file. To run the test under Microsoft
.Net, enter the command
<pre> runFile NUnitFitTests.html TestResults.html .</pre>
To run it under Mono, enter
<pre> mono runFile.exe NUnitFitTests.html TestResults.html .</pre>
Note the space and dot at the end of each command. The results of
your test will be in TestResults.html in the same directory.
<h2>Platform and CLR Version</h2>
<table BORDER cellspacing=0 cellpadding=5>
<tr><td colspan=2>NUnit.Fixtures.PlatformInfo</td></tr>
</table>
<h2>Verify Unit Tests</h2>
<p>Load and run the NUnit unit tests, verifying that the
results are as expected. When these tests are run on different
platforms, different numbers of tests may be skipped, so the
values for Skipped and Run tests are informational only.
<p>The number of tests in each assembly should be constant
across all platforms - any discrepancy usually means that one
of the test source files was not compiled on the platform.
There should be no failures and no tests ignored.
<p><b>Note:</b> At the moment, the nunit.extensions.tests
assembly is failing because the fixture doesn't initialize
addins in the test domain.
<p>
<table BORDER cellspacing=0 cellpadding=5>
<tr><td colspan=6>NUnit.Fixtures.AssemblyRunner</td></tr>
<tr>
<td>Assembly</td>
<td>Tests()</td>
<td>Run()</td>
<td>Skipped()</td>
<td>Ignored()</td>
<td>Failures()</td>
</tr>
<tr>
<td>nunit.framework.tests.dll</td>
<td>388</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>nunit.core.tests.dll</td>
<td>355</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>nunit.util.tests.dll</td>
<td>238</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>nunit.mocks.tests.dll</td>
<td>43</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>nunit.extensions.tests.dll</td>
<td>5</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>nunit-console.tests.dll</td>
<td>40</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>nunit.uikit.tests.dll</td>
<td>34</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>nunit-gui.tests.dll</td>
<td>15</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>nunit.fixtures.tests.dll</td>
<td>6</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>0</td>
<td>0</td>
</tr>
</table>
<h2>Code Snippet Tests</h2>
<p>These tests create a test assembly from a snippet of code and
then load and run the tests that it contains, verifying that
the structure of the loaded tests is as expected and that the number
of tests run, skipped, ignored or failed is correct.
<p>
<table BORDER cellspacing=0 cellpadding=5>
<tr><td colspan=6>NUnit.Fixtures.SnippetRunner</td></tr>
<tr>
<td>Code</td>
<td>Tree()</td>
<td>Run()</td>
<td>Skipped()</td>
<td>Ignored()</td>
<td>Failures()</td>
</tr>
<tr><td><pre>public class TestClass
<html>
<body>
<h1>NUnit Acceptance Tests</h1>
<p>
Developers love self-referential programs! Hence, NUnit has always run all it's
own tests, even those that are not really unit tests.
<p>Now, beginning with NUnit 2.4, NUnit has top-level tests using Ward Cunningham's
FIT framework. At this time, the tests are pretty rudimentary, but it's a start
and it's a framework for doing more.
<h2>Running the Tests</h2>
<p>Open a console or shell window and navigate to the NUnit bin directory, which
contains this file. To run the test under Microsoft .Net, enter the command
<pre> runFile NUnitFitTests.html TestResults.html .</pre>
To run it under Mono, enter
<pre> mono runFile.exe NUnitFitTests.html TestResults.html .</pre>
Note the space and dot at the end of each command. The results of your test
will be in TestResults.html in the same directory.
<h2>Platform and CLR Version</h2>
<table BORDER cellSpacing="0" cellPadding="5">
<tr>
<td colspan="2">NUnit.Fixtures.PlatformInfo</td>
</tr>
</table>
<h2>Verify Unit Tests</h2>
<p>
Load and run the NUnit unit tests, verifying that the results are as expected.
When these tests are run on different platforms, different numbers of tests may
be skipped, so the values for Skipped and Run tests are informational only.
<p>
The number of tests in each assembly should be constant across all platforms -
any discrepancy usually means that one of the test source files was not
compiled on the platform. There should be no failures and no tests ignored.
<p><b>Note:</b>
At the moment, the nunit.extensions.tests assembly is failing because the
fixture doesn't initialize addins in the test domain.
<p>
<table BORDER cellSpacing="0" cellPadding="5">
<tr>
<td colspan="6">NUnit.Fixtures.AssemblyRunner</td>
</tr>
<tr>
<td>Assembly</td>
<td>Tests()</td>
<td>Run()</td>
<td>Skipped()</td>
<td>Ignored()</td>
<td>Failures()</td>
</tr>
<tr>
<td>nunit.framework.tests.dll</td>
<td>389</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>nunit.core.tests.dll</td>
<td>355</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>nunit.util.tests.dll</td>
<td>238</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>nunit.mocks.tests.dll</td>
<td>43</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>nunit.extensions.tests.dll</td>
<td>5</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>nunit-console.tests.dll</td>
<td>40</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>nunit.uikit.tests.dll</td>
<td>34</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>nunit-gui.tests.dll</td>
<td>15</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>nunit.fixtures.tests.dll</td>
<td>6</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>0</td>
<td>0</td>
</tr>
</table>
<h2>Code Snippet Tests</h2>
<p>
These tests create a test assembly from a snippet of code and then load and run
the tests that it contains, verifying that the structure of the loaded tests is
as expected and that the number of tests run, skipped, ignored or failed is
correct.
<p>
<table BORDER cellSpacing="0" cellPadding="5">
<tr>
<td colspan="6">NUnit.Fixtures.SnippetRunner</td>
</tr>
<tr>
<td>Code</td>
<td>Tree()</td>
<td>Run()</td>
<td>Skipped()</td>
<td>Ignored()</td>
<td>Failures()</td>
</tr>
<tr>
<td><pre>public class TestClass
{
}</pre></td>
<td>EMPTY</td>
<td>0</td><td>0</td><td>0</td><td>0</td></tr>
<tr><td><pre>using NUnit.Framework;
}</pre>
</td>
<td>EMPTY</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td><pre>using NUnit.Framework;
[TestFixture]
public class TestClass
{
}</pre></td>
<td>TestClass</td>
<td>0</td><td>0</td><td>0</td><td>0</td></tr>
<tr><td><pre>using NUnit.Framework;
}</pre>
</td>
<td>TestClass</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td><pre>using NUnit.Framework;
[TestFixture]
public class TestClass
@ -176,13 +176,20 @@ public class TestClass
public void T2() { }
[Test]
public void T3() { }
}</pre></td>
<td><pre>TestClass
>T1
>T2
>T3</pre></td>
<td>3</td><td>0</td><td>0</td><td>0</td></tr>
<tr><td><pre>using NUnit.Framework;
}</pre>
</td>
<td><pre>TestClass
&gt;T1
&gt;T2
&gt;T3</pre>
</td>
<td>3</td>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td><pre>using NUnit.Framework;
[TestFixture]
public class TestClass1
@ -198,14 +205,21 @@ public class TestClass2
public void T2() { }
[Test]
public void T3() { }
}</pre></td>
<td><pre>TestClass1
>T1
}</pre>
</td>
<td><pre>TestClass1
&gt;T1
TestClass2
>T2
>T3</pre></td>
<td>3</td><td>0</td><td>0</td><td>0</td></tr>
<tr><td><pre>using NUnit.Framework;
&gt;T2
&gt;T3</pre>
</td>
<td>3</td>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td><pre>using NUnit.Framework;
[TestFixture]
public class TestClass
@ -216,13 +230,20 @@ public class TestClass
public void T2() { }
[Test]
public void T3() { }
}</pre></td>
<td><pre>TestClass
>T1
>T2
>T3</pre></td>
<td>2</td><td>0</td><td>1</td><td>0</td></tr>
<tr><td><pre>using NUnit.Framework;
}</pre>
</td>
<td><pre>TestClass
&gt;T1
&gt;T2
&gt;T3</pre>
</td>
<td>2</td>
<td>0</td>
<td>1</td>
<td>0</td>
</tr>
<tr>
<td><pre>using NUnit.Framework;
[TestFixture]
public class TestClass
@ -233,20 +254,24 @@ public class TestClass
public void T2() { }
[Test]
public void T3() { }
}</pre></td>
<td><pre>TestClass
>T1
>T2
>T3</pre></td>
<td>2</td><td>1</td><td>0</td><td>0</td></tr>
</table>
<h2>Summary Information</h2>
<table BORDER cellspacing=0 cellpadding=5>
<tr><td colspan=2>fit.Summary</td></tr>
</table>
</body>
}</pre>
</td>
<td><pre>TestClass
&gt;T1
&gt;T2
&gt;T3</pre>
</td>
<td>2</td>
<td>1</td>
<td>0</td>
<td>0</td>
</tr>
</table>
<h2>Summary Information</h2>
<table BORDER cellSpacing="0" cellPadding="5">
<tr>
<td colspan="2">fit.Summary</td>
</tr>
</table>
</body>
</html>

Просмотреть файл

@ -1852,7 +1852,7 @@ namespace NUnit.Framework
/// <param name="args">Arguments used in formatting the message</param>
static public void Contains( object expected, ICollection actual, string message, params object[] args )
{
Assert.That(actual, Is.CollectionContaining(expected), message, args);
Assert.That(actual, List.Contains(expected), message, args);
}
/// <summary>

Просмотреть файл

@ -42,7 +42,7 @@ namespace NUnit.Framework
/// <summary>
/// Apply a constraint to an actual value, succeeding if the constraint
/// is satisfied and throwing an assertion exception on failure. Works
/// identically to <see cref="NUnit.Framework.Assert.That(object, IConstraint, string, object[]"/>
/// identically to <see cref="NUnit.Framework.Assert.That(object, IConstraint, string, object[])"/>
/// </summary>
/// <param name="constraint">An IConstraint to be applied</param>
/// <param name="actual">The actual value to test</param>
@ -55,7 +55,8 @@ namespace NUnit.Framework
/// <summary>
/// Asserts that a condition is true. If the condition is false the method throws
/// an <see cref="AssertionException"/>. Works Identically to <see cref="Assert.That"/>.
/// an <see cref="AssertionException"/>. Works Identically to
/// <see cref="Assert.That(bool, string, object[])"/>.
/// </summary>
/// <param name="condition">The evaluated condition</param>
/// <param name="message">The message to display if the condition is false</param>
@ -67,7 +68,8 @@ namespace NUnit.Framework
/// <summary>
/// Asserts that a condition is true. If the condition is false the method throws
/// an <see cref="AssertionException"/>. Works Identically to <see cref="Assert.That"/>.
/// an <see cref="AssertionException"/>. Works Identically to
/// <see cref="Assert.That(bool, string)"/>.
/// </summary>
/// <param name="condition">The evaluated condition</param>
/// <param name="message">The message to display if the condition is false</param>
@ -78,7 +80,7 @@ namespace NUnit.Framework
/// <summary>
/// Asserts that a condition is true. If the condition is false the method throws
/// an <see cref="AssertionException"/>. Works Identically to <see cref="Assert.That"/>.
/// an <see cref="AssertionException"/>. Works Identically to <see cref="Assert.That(bool)"/>.
/// </summary>
/// <param name="condition">The evaluated condition</param>
static public void Expect(bool condition)
@ -88,7 +90,10 @@ namespace NUnit.Framework
#endregion
#region ContainingConstraint
public Constraint Containing(object expected)
/// <summary>
/// Contains returns a ContainsConstraint
/// </summary>
public Constraint Contains(object expected)
{
return new ContainsConstraint( expected );
}
@ -96,9 +101,9 @@ namespace NUnit.Framework
#region String Constraints
/// <summary>
/// Starting is a synonym for Is.StringStarting
/// StartsWith is a synonym for Text.StartsWith
/// </summary>
public Constraint Starting(string expected)
public Constraint StartsWith(string expected)
{
return Text.StartsWith( expected );
}
@ -106,7 +111,7 @@ namespace NUnit.Framework
/// <summary>
/// Ending is a synonym for Is.StringEnding
/// </summary>
public Constraint Ending(string expected)
public Constraint EndsWith(string expected)
{
return Text.EndsWith( expected );
}
@ -114,10 +119,30 @@ namespace NUnit.Framework
/// <summary>
/// Matches is a synonym for Text.Matches
/// </summary>
public Constraint Matching(string pattern)
public Constraint Matches(string pattern)
{
return Text.Matches(pattern);
}
#endregion
#region PropertyConstraint
/// <summary>
/// Property is a synonym for Has.Property
/// </summary>
public static Constraint Property( string name, object expected )
{
return new PropertyConstraint( name, expected );
}
/// <summary>
/// Length is a synonym for Has.Length
/// </summary>
/// <param name="length"></param>
/// <returns></returns>
public static Constraint Length( int length )
{
return Property( "Length", length );
}
#endregion
}
}

Просмотреть файл

@ -196,7 +196,7 @@ namespace NUnit.Framework.Constraints
/// second-level constraint, depending on the
/// type of the actual argument.
/// </summary>
public Constraint Containing(object expected)
public Constraint Contains(object expected)
{
return Resolve( new ContainsConstraint(expected) );
}
@ -207,7 +207,7 @@ namespace NUnit.Framework.Constraints
/// Resolves the chain of constraints using a
/// StartsWithConstraint as base.
/// </summary>
public Constraint Starting(string substring)
public Constraint StartsWith(string substring)
{
return Resolve( new StartsWithConstraint(substring) );
}
@ -216,7 +216,7 @@ namespace NUnit.Framework.Constraints
/// Resolves the chain of constraints using a
/// StringEndingConstraint as base.
/// </summary>
public Constraint Ending(string substring)
public Constraint EndsWith(string substring)
{
return Resolve( new EndsWithConstraint(substring) );
}
@ -225,7 +225,7 @@ namespace NUnit.Framework.Constraints
/// Resolves the chain of constraints using a
/// StringMatchingConstraint as base.
/// </summary>
public Constraint Matching(string pattern)
public Constraint Matches(string pattern)
{
return Resolve(new RegexConstraint(pattern));
}
@ -260,6 +260,28 @@ namespace NUnit.Framework.Constraints
}
#endregion
#region Property Constraints
/// <summary>
/// Resolves the chain of constraints using a
/// PropertyConstraint as base
/// </summary>
public Constraint Property( string name, object expected )
{
return Resolve( new PropertyConstraint( name, expected ) );
}
/// <summary>
/// Resolves the chain of constraints using a
/// PropertyCOnstraint on Length as base
/// </summary>
/// <param name="length"></param>
/// <returns></returns>
public Constraint Length( int length )
{
return Property( "Length", length );
}
#endregion
#endregion
#region Prefix Operators

Просмотреть файл

@ -15,6 +15,26 @@ namespace NUnit.Framework.Constraints
object expected;
Constraint realConstraint;
private Constraint RealConstraint
{
get
{
if ( realConstraint == null )
{
if ( actual is string )
this.realConstraint = new SubstringConstraint( (string)expected );
else
this.realConstraint = new CollectionContainsConstraint( expected );
}
return realConstraint;
}
set
{
realConstraint = value;
}
}
/// <summary>
/// Initializes a new instance of the <see cref="T:ContainsConstraint"/> class.
/// </summary>
@ -32,15 +52,11 @@ namespace NUnit.Framework.Constraints
public override bool Matches(object actual)
{
this.actual = actual;
if ( actual is string )
this.realConstraint = new SubstringConstraint( (string)expected );
else
this.realConstraint = new CollectionContainsConstraint( expected );
if ( this.caseInsensitive )
this.realConstraint = this.realConstraint.IgnoreCase;
this.RealConstraint = RealConstraint.IgnoreCase;
return this.realConstraint.Matches( actual );
return this.RealConstraint.Matches( actual );
}
/// <summary>
@ -49,7 +65,7 @@ namespace NUnit.Framework.Constraints
/// <param name="writer">The writer on which the description is displayed</param>
public override void WriteDescriptionTo(MessageWriter writer)
{
this.realConstraint.WriteDescriptionTo(writer);
this.RealConstraint.WriteDescriptionTo(writer);
}
}
}

Просмотреть файл

@ -174,18 +174,6 @@ namespace NUnit.Framework.SyntaxHelpers
{
return new CollectionSubsetConstraint(expected);
}
/// <summary>
/// Is.CollectionContaining returns a constraint that tests
/// whethner the actual value is a collection containing
/// the expected value.
/// </summary>
/// <param name="expected"></param>
/// <returns></returns>
public static Constraint CollectionContaining( object expected )
{
return new CollectionContainsConstraint( expected );
}
#endregion
#endregion

Просмотреть файл

@ -21,10 +21,13 @@
<include name="Constraints/EmptyConstraint.cs"/>
<include name="Constraints/EqualConstraint.cs"/>
<include name="Constraints/NotConstraint.cs"/>
<include name="Constraints/PropertyConstraint.cs"/>
<include name="Constraints/SameAsConstraint.cs"/>
<include name="Constraints/StringConstraints.cs"/>
<include name="Constraints/TypeConstraints.cs"/>
<include name="SyntaxHelpers/Has.cs"/>
<include name="SyntaxHelpers/Is.cs"/>
<include name="SyntaxHelpers/List.cs"/>
<include name="SyntaxHelpers/SyntaxHelper.cs"/>
<include name="SyntaxHelpers/Text.cs"/>
<include name="AbstractAsserter.cs"/>

Просмотреть файл

@ -299,6 +299,11 @@
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "Constraints\PropertyConstraint.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "Constraints\SameAsConstraint.cs"
SubType = "Code"
@ -314,11 +319,21 @@
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "SyntaxHelpers\Has.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "SyntaxHelpers\Is.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "SyntaxHelpers\List.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "SyntaxHelpers\SyntaxHelper.cs"
SubType = "Code"

Просмотреть файл

@ -91,6 +91,7 @@
<Compile Include="Constraints\EmptyConstraint.cs" />
<Compile Include="Constraints\EqualConstraint.cs" />
<Compile Include="Constraints\NotConstraint.cs" />
<Compile Include="Constraints\PropertyConstraint.cs" />
<Compile Include="Constraints\SameAsConstraint.cs" />
<Compile Include="Constraints\StringConstraints.cs" />
<Compile Include="Constraints\TypeConstraints.cs" />
@ -132,6 +133,8 @@
<Compile Include="SuiteAttribute.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="SyntaxHelpers\List.cs" />
<Compile Include="SyntaxHelpers\Has.cs" />
<Compile Include="SyntaxHelpers\Is.cs" />
<Compile Include="SyntaxHelpers\SyntaxHelper.cs" />
<Compile Include="SyntaxHelpers\Text.cs" />

Просмотреть файл

@ -185,7 +185,7 @@ namespace NUnit.Framework.Tests
public void SubstringTests()
{
string phrase = "Hello World!";
string[] array = new string[] { "Hello", "World", "!" };
string[] array = new string[] { "abc", "bad", "dba" };
// Classic Syntax
StringAssert.Contains("World", phrase);
@ -195,19 +195,24 @@ namespace NUnit.Framework.Tests
// Only available using new syntax
Assert.That(phrase, Text.DoesNotContain("goodbye"));
Assert.That(phrase, Text.Contains("WORLD").IgnoreCase);
Assert.That(phrase, Text.DoesNotContain("BYE").IgnoreCase);
Assert.That(array, Text.All.Contains( "b" ) );
// Inherited syntax
Expect(phrase, Containing("World"));
Expect(phrase, Contains("World"));
// Only available using new syntax
Expect(phrase, Not.Containing("goodbye"));
Expect(phrase, Containing("WORLD").IgnoreCase);
Expect(phrase, Not.Containing("BYE").IgnoreCase);
Expect(phrase, Not.Contains("goodbye"));
Expect(phrase, Contains("WORLD").IgnoreCase);
Expect(phrase, Not.Contains("BYE").IgnoreCase);
Expect(array, All.Contains("b"));
}
[Test]
public void StartsWithTests()
{
string phrase = "Hello World!";
string[] greetings = new string[] { "Hello!", "Hi!", "Hola!" };
// Classic syntax
StringAssert.StartsWith("Hello", phrase);
@ -217,19 +222,22 @@ namespace NUnit.Framework.Tests
Assert.That(phrase, Text.DoesNotStartWith("Hi!"));
Assert.That(phrase, Text.StartsWith("HeLLo").IgnoreCase);
Assert.That(phrase, Text.DoesNotStartWith("HI").IgnoreCase);
Assert.That(greetings, Text.All.StartsWith("h").IgnoreCase);
// Inherited syntax
Expect(phrase, Starting("Hello"));
Expect(phrase, StartsWith("Hello"));
// Only available using new syntax
Expect(phrase, Not.Starting("Hi!"));
Expect(phrase, Starting("HeLLo").IgnoreCase);
Expect(phrase, Not.Starting("HI").IgnoreCase);
Expect(phrase, Not.StartsWith("Hi!"));
Expect(phrase, StartsWith("HeLLo").IgnoreCase);
Expect(phrase, Not.StartsWith("HI").IgnoreCase);
Expect(greetings, All.StartsWith("h").IgnoreCase);
}
[Test]
public void EndsWithTests()
{
string phrase = "Hello World!";
string[] greetings = new string[] { "Hello!", "Hi!", "Hola!" };
// Classic Syntax
StringAssert.EndsWith("!", phrase);
@ -239,12 +247,14 @@ namespace NUnit.Framework.Tests
// Only available using new syntax
Assert.That(phrase, Text.DoesNotEndWith("?"));
Assert.That(phrase, Text.EndsWith("WORLD!").IgnoreCase);
Assert.That(greetings, Text.All.EndsWith("!"));
// Inherited syntax
Expect(phrase, Ending("!"));
Expect(phrase, EndsWith("!"));
// Only available using new syntax
Expect(phrase, Not.Ending("?"));
Expect(phrase, Ending("WORLD!").IgnoreCase);
Expect(phrase, Not.EndsWith("?"));
Expect(phrase, EndsWith("WORLD!").IgnoreCase);
Expect(greetings, All.EndsWith("!") );
}
[Test]
@ -261,6 +271,8 @@ namespace NUnit.Framework.Tests
Assert.That(phrase, Is.Not.EqualTo("goodbye world!").IgnoreCase);
Assert.That(new string[] { "Hello", "World" },
Is.EqualTo(new object[] { "HELLO", "WORLD" }).IgnoreCase);
Assert.That(new string[] {"HELLO", "Hello", "hello" },
Is.All.EqualTo( "hello" ).IgnoreCase);
// Inherited syntax
Expect(phrase, EqualTo("hello world!").IgnoreCase);
@ -268,12 +280,15 @@ namespace NUnit.Framework.Tests
Expect(phrase, Not.EqualTo("goodbye world!").IgnoreCase);
Expect(new string[] { "Hello", "World" },
EqualTo(new object[] { "HELLO", "WORLD" }).IgnoreCase);
Expect(new string[] {"HELLO", "Hello", "hello" },
All.EqualTo( "hello" ).IgnoreCase);
}
[Test]
public void RegularExpressionTests()
{
string phrase = "Now is the time for all good men to come to the aid of their country.";
string[] quotes = new string[] { "Never say never", "It's never too late", "Nevermore!" };
// Classic syntax
StringAssert.IsMatch( "all good men", phrase );
@ -285,13 +300,15 @@ namespace NUnit.Framework.Tests
// Only available using new syntax
Assert.That(phrase, Text.DoesNotMatch("all.*men.*good"));
Assert.That(phrase, Text.Matches("ALL").IgnoreCase);
Assert.That(quotes, Text.All.Matches("never").IgnoreCase);
// Inherited syntax
Expect( phrase, Matching( "all good men" ) );
Expect( phrase, Matching( "Now.*come" ) );
Expect( phrase, Matches( "all good men" ) );
Expect( phrase, Matches( "Now.*come" ) );
// Only available using new syntax
Expect(phrase, Not.Matching("all.*men.*good"));
Expect(phrase, Matching("ALL").IgnoreCase);
Expect(phrase, Not.Matches("all.*men.*good"));
Expect(phrase, Matches("ALL").IgnoreCase);
Expect(quotes, All.Matches("never").IgnoreCase);
}
[Test]
@ -384,7 +401,7 @@ namespace NUnit.Framework.Tests
public void AllItemsTests()
{
object[] ints = new object[] { 1, 2, 3, 4 };
object[] strings = new object[] { "a", "b", "c", "b", "d" };
object[] strings = new object[] { "abc", "bad", "cab", "bad", "dad" };
// Classic syntax
CollectionAssert.AllItemsAreNotNull(ints);
@ -399,7 +416,8 @@ namespace NUnit.Framework.Tests
Assert.That(ints, Is.Unique);
// Only available using new syntax
Assert.That(strings, Is.Not.Unique);
Assert.That(ints, Is.All.GreaterThan(0));
Assert.That(ints, Is.All.GreaterThan(0));
Assert.That(strings, Text.All.Contains( "a" ) );
// Inherited syntax
Expect(ints, All.Not.Null);
@ -425,14 +443,14 @@ namespace NUnit.Framework.Tests
CollectionAssert.DoesNotContain(sarray, "x");
// Helper syntax
Assert.That(iarray, Is.CollectionContaining(3));
Assert.That(sarray, Is.CollectionContaining("b"));
Assert.That(sarray, Is.Not.CollectionContaining("x"));
Assert.That(iarray, List.Contains(3));
Assert.That(sarray, List.Contains("b"));
Assert.That(sarray, List.Not.Contains("x"));
// Inherited syntax
Expect(iarray, Containing(3));
Expect(sarray, Containing("b"));
Expect(sarray, Not.Containing("x"));
Expect(iarray, Contains(3));
Expect(sarray, Contains("b"));
Expect(sarray, Not.Contains("x"));
}
[Test]
@ -480,6 +498,24 @@ namespace NUnit.Framework.Tests
Expect(new int[] { 2, 4, 6 }, Not.SubsetOf(ints1to5));
}
[Test]
public void PropertyTests()
{
string[] array = new string[] { "abc", "bca", "xyz" };
// Helper syntax
Assert.That( "Hello", Has.Property("Length", 5) );
Assert.That( "Hello", Has.Length( 5 ) );
Assert.That( array , Has.All.Property( "Length", 3 ) );
Assert.That( array, Has.All.Length( 3 ) );
// Inherited syntax
Expect( "Hello", Property("Length", 5) );
Expect( "Hello", Length( 5 ) );
Expect( array, All.Property("Length", 3 ) );
Expect( array, All.Length( 3 ) );
}
[Test]
public void NotTests()
{

Просмотреть файл

@ -79,6 +79,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
NUnitBinTests.nunit = NUnitBinTests.nunit
NUnitDevTests.config = NUnitDevTests.config
NUnitDevTests.nunit = NUnitDevTests.nunit
NUnitFitTests.html = NUnitFitTests.html
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.core.dll_VS2005", "NUnitCore\core\nunit.core.dll_VS2005.csproj", "{EBD43A7F-AFCA-4281-BB53-5CDD91F966A3}"