1 | <!-- saved from url=(0014)about:internet --><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
|
---|
2 | <html>
|
---|
3 | <!-- Standard Head Part -->
|
---|
4 | <head>
|
---|
5 | <title>NUnit - CollectionAssert</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>CollectionAssert (NUnit 2.4 / 2.5)</h2>
|
---|
28 | <p>The CollectionAssert class provides a number of methods that are useful
|
---|
29 | when examining collections and their contents or for comparing two collections.</p>
|
---|
30 |
|
---|
31 | <p>The <b>AreEqual</b> overloads succeed if the corresponding elements of the two
|
---|
32 | collections are equal. <b>AreEquivalent</b> tests whether the collection contents
|
---|
33 | are equal, but without regard to order. In both cases, elements are compared using
|
---|
34 | NUnit's default equality comparison.</p>
|
---|
35 |
|
---|
36 | <p>Beginning with NUnit 2.4.6, these methods may be used on any object that
|
---|
37 | implements IEnumerable. Prior to 2.4.6, only true collections were supported.
|
---|
38 |
|
---|
39 | <div class="code" style="width: 38em">
|
---|
40 | <pre>CollectionAssert.AllItemsAreInstancesOfType( IEnumerable collection,
|
---|
41 | Type expectedType );
|
---|
42 | CollectionAssert.AllItemsAreInstancesOfType( IEnumerable collection,
|
---|
43 | Type expectedType, string message );
|
---|
44 | CollectionAssert.AllItemsAreInstancesOfType( IEnumerable collection,
|
---|
45 | Type expectedType, string message, params object[] args );
|
---|
46 |
|
---|
47 | CollectionAssert.AllItemsAreNotNull( IEnumerable collection );
|
---|
48 | CollectionAssert.AllItemsAreNotNull( IEnumerable collection,
|
---|
49 | string message );
|
---|
50 | CollectionAssert.AllItemsAreNotNull( IEnumerable collection,
|
---|
51 | string message, params object[] args );
|
---|
52 |
|
---|
53 | CollectionAssert.AllItemsAreUnique( IEnumerable collection );
|
---|
54 | CollectionAssert.AllItemsAreUnique( IEnumerable collection,
|
---|
55 | string message );
|
---|
56 | CollectionAssert.AllItemsAreUnique( IEnumerable collection,
|
---|
57 | string message, params object[] args );
|
---|
58 |
|
---|
59 | CollectionAssert.AreEqual( IEnumerable expected, IEnumerable actual );
|
---|
60 | CollectionAssert.AreEqual( IEnumerable expected, IEnumerable actual,
|
---|
61 | string message );
|
---|
62 | CollectionAssert.AreEqual( IEnumerable expected, IEnumerable actual
|
---|
63 | string message, params object[] args );
|
---|
64 |
|
---|
65 | CollectionAssert.AreEquivalent( IEnumerable expected, IEnumerable actual);
|
---|
66 | CollectionAssert.AreEquivalent( IEnumerable expected, IEnumerable actual,
|
---|
67 | string message );
|
---|
68 | CollectionAssert.AreEquivalent( IEnumerable expected, IEnumerable actual
|
---|
69 | string message, params object[] args );
|
---|
70 |
|
---|
71 | CollectionAssert.AreNotEqual( IEnumerable expected, IEnumerable actual );
|
---|
72 | CollectionAssert.AreNotEqual( IEnumerable expected, IEnumerable actual,
|
---|
73 | string message );
|
---|
74 | CollectionAssert.AreNotEqual( IEnumerableon expected, IEnumerable actual
|
---|
75 | string message, params object[] args );
|
---|
76 |
|
---|
77 | CollectionAssert.AreNotEquivalent( IEnumerable expected,
|
---|
78 | IEnumerable actual );
|
---|
79 | CollectionAssert.AreNotEquivalent( IEnumerable expected,
|
---|
80 | IEnumerable actual, string message );
|
---|
81 | CollectionAssert.AreNotEquivalent( IEnumerable expected,
|
---|
82 | IEnumerable actual, string message, params object[] args );
|
---|
83 |
|
---|
84 | CollectionAssert.Contains( IEnumerable expected, object actual );
|
---|
85 | CollectionAssert.Contains( IEnumerable expected, object actual,
|
---|
86 | string message );
|
---|
87 | CollectionAssert.Contains( IEnumerable expected, object actual
|
---|
88 | string message, params object[] args );
|
---|
89 |
|
---|
90 | CollectionAssert.DoesNotContain( IEnumerable expected, object actual );
|
---|
91 | CollectionAssert.DoesNotContain( IEnumerable expected, object actual,
|
---|
92 | string message );
|
---|
93 | CollectionAssert.DoesNotContain( IEnumerable expected, object actual
|
---|
94 | string message, params object[] args );
|
---|
95 |
|
---|
96 | CollectionAssert.IsSubsetOf( IEnumerable subset, IEnumerable superset );
|
---|
97 | CollectionAssert.IsSubsetOf( IEnumerable subset, IEnumerable superset,
|
---|
98 | string message );
|
---|
99 | CollectionAssert.IsSubsetOf( IEnumerable subset, IEnumerable superset,
|
---|
100 | string message, params object[] args );
|
---|
101 |
|
---|
102 | CollectionAssert.IsNotSubsetOf( IEnumerable subset, IEnumerable superset);
|
---|
103 | CollectionAssert.IsNotSubsetOf( IEnumerable subset, IEnumerable superset,
|
---|
104 | string message );
|
---|
105 | CollectionAssert.IsNotSubsetOf( IEnumerable subset, IEnumerable superset,
|
---|
106 | string message, params object[] args );
|
---|
107 |
|
---|
108 | CollectionAssert.IsEmpty( IEnumerable collection );
|
---|
109 | CollectionAssert.IsEmpty( IEnumerable collection, string message );
|
---|
110 | CollectionAssert.IsEmpty( IEnumerable collection, string message,
|
---|
111 | params object[] args );
|
---|
112 |
|
---|
113 | CollectionAssert.IsNotEmpty( IEnumerable collection );
|
---|
114 | CollectionAssert.IsNotEmpty( IEnumerable collection, string message );
|
---|
115 | CollectionAssert.IsNotEmpty( IEnumerable collection, string message,
|
---|
116 | params object[] args );
|
---|
117 | </pre></div>
|
---|
118 |
|
---|
119 | <p>The following methods are available beginning with NUnit 2.5
|
---|
120 |
|
---|
121 | <div class="code" style="width: 38em"><pre>
|
---|
122 | CollectionAssert.IsOrdered( IEnumerable collection );
|
---|
123 | CollectionAssert.IsOrdered( IEnumerable collection, string message );
|
---|
124 | CollectionAssert.IsOrdered( IEnumerable collection, string message,
|
---|
125 | params object[] args );
|
---|
126 |
|
---|
127 | CollectionAssert.IsOrdered( IEnumerable collection, IComparer comparer );
|
---|
128 | CollectionAssert.IsOrdered( IEnumerable collection, IComparer comparer,
|
---|
129 | string message );
|
---|
130 | CollectionAssert.IsOrdered( IEnumerable collection, IComparer comparer,
|
---|
131 | string message, params object[] args );
|
---|
132 | </pre></div>
|
---|
133 |
|
---|
134 | </div>
|
---|
135 |
|
---|
136 | <!-- Submenu -->
|
---|
137 | <div id="subnav">
|
---|
138 | <ul>
|
---|
139 | <li><a href="index.html">NUnit 2.5.10</a></li>
|
---|
140 | <ul>
|
---|
141 | <li><a href="getStarted.html">Getting Started</a></li>
|
---|
142 | <li><a href="assertions.html">Assertions</a></li>
|
---|
143 | <ul>
|
---|
144 | <li><a href="equalityAsserts.html">Equality Asserts</a></li>
|
---|
145 | <li><a href="identityAsserts.html">Identity Asserts</a></li>
|
---|
146 | <li><a href="conditionAsserts.html">Condition Asserts</a></li>
|
---|
147 | <li><a href="comparisonAsserts.html">Comparison Asserts</a></li>
|
---|
148 | <li><a href="typeAsserts.html">Type Asserts</a></li>
|
---|
149 | <li><a href="exceptionAsserts.html">Exception Asserts</a></li>
|
---|
150 | <li><a href="utilityAsserts.html">Utility Methods</a></li>
|
---|
151 | <li><a href="stringAssert.html">String Assert</a></li>
|
---|
152 | <li id="current"><a href="collectionAssert.html">Collection Assert</a></li>
|
---|
153 | <li><a href="fileAssert.html">File Assert</a></li>
|
---|
154 | <li><a href="directoryAssert.html">Directory Assert</a></li>
|
---|
155 | </ul>
|
---|
156 | <li><a href="constraintModel.html">Constraints</a></li>
|
---|
157 | <li><a href="attributes.html">Attributes</a></li>
|
---|
158 | <li><a href="runningTests.html">Running Tests</a></li>
|
---|
159 | <li><a href="extensibility.html">Extensibility</a></li>
|
---|
160 | <li><a href="releaseNotes.html">Release Notes</a></li>
|
---|
161 | <li><a href="samples.html">Samples</a></li>
|
---|
162 | <li><a href="license.html">License</a></li>
|
---|
163 | </ul>
|
---|
164 | </ul>
|
---|
165 | </div>
|
---|
166 | <!-- End of Submenu -->
|
---|
167 |
|
---|
168 |
|
---|
169 | <!-- Standard Footer for NUnit.org -->
|
---|
170 | <div id="footer">
|
---|
171 | Copyright © 2010 Charlie Poole. All Rights Reserved.
|
---|
172 | </div>
|
---|
173 | <!-- End of Footer -->
|
---|
174 |
|
---|
175 | </body>
|
---|
176 | </html>
|
---|