Merge remote-tracking branch 'local/msvc-updates' into msvc-updates
[mono.git] / mcs / nunit24 / NUnitFramework / framework / CollectionAssert.cs
1 // ****************************************************************\r
2 // This is free software licensed under the NUnit license. You\r
3 // may obtain a copy of the license as well as information regarding\r
4 // copyright ownership at http://nunit.org/?p=license&r=2.4.\r
5 // ****************************************************************\r
6 \r
7 using System;\r
8 using System.Collections;\r
9 using System.ComponentModel;\r
10 using NUnit.Framework.Constraints;\r
11 \r
12 namespace NUnit.Framework\r
13 {\r
14         /// <summary>\r
15         /// A set of Assert methods operationg on one or more collections\r
16         /// </summary>\r
17         public class CollectionAssert\r
18         {\r
19                 #region Equals and ReferenceEquals\r
20 \r
21                 /// <summary>\r
22                 /// The Equals method throws an AssertionException. This is done \r
23                 /// to make sure there is no mistake by calling this function.\r
24                 /// </summary>\r
25                 /// <param name="a"></param>\r
26                 /// <param name="b"></param>\r
27                 [EditorBrowsable(EditorBrowsableState.Never)]\r
28                 public static new bool Equals(object a, object b)\r
29                 {\r
30                         throw new AssertionException("Assert.Equals should not be used for Assertions");\r
31                 }\r
32 \r
33                 /// <summary>\r
34                 /// override the default ReferenceEquals to throw an AssertionException. This \r
35                 /// implementation makes sure there is no mistake in calling this function \r
36                 /// as part of Assert. \r
37                 /// </summary>\r
38                 /// <param name="a"></param>\r
39                 /// <param name="b"></param>\r
40                 public static new void ReferenceEquals(object a, object b)\r
41                 {\r
42                         throw new AssertionException("Assert.ReferenceEquals should not be used for Assertions");\r
43                 }\r
44 \r
45                 #endregion\r
46                                 \r
47                 #region AllItemsAreInstancesOfType\r
48                 /// <summary>\r
49                 /// Asserts that all items contained in collection are of the type specified by expectedType.\r
50                 /// </summary>\r
51                 /// <param name="collection">IEnumerable containing objects to be considered</param>\r
52                 /// <param name="expectedType">System.Type that all objects in collection must be instances of</param>\r
53                 public static void AllItemsAreInstancesOfType (IEnumerable collection, Type expectedType)\r
54                 {\r
55                         AllItemsAreInstancesOfType(collection, expectedType, string.Empty, null);\r
56                 }\r
57 \r
58                 /// <summary>\r
59                 /// Asserts that all items contained in collection are of the type specified by expectedType.\r
60                 /// </summary>\r
61                 /// <param name="collection">IEnumerable containing objects to be considered</param>\r
62                 /// <param name="expectedType">System.Type that all objects in collection must be instances of</param>\r
63                 /// <param name="message">The message that will be displayed on failure</param>\r
64                 public static void AllItemsAreInstancesOfType (IEnumerable collection, Type expectedType, string message)\r
65                 {\r
66                         AllItemsAreInstancesOfType(collection, expectedType, message, null);\r
67                 }\r
68 \r
69                 /// <summary>\r
70                 /// Asserts that all items contained in collection are of the type specified by expectedType.\r
71                 /// </summary>\r
72                 /// <param name="collection">IEnumerable containing objects to be considered</param>\r
73                 /// <param name="expectedType">System.Type that all objects in collection must be instances of</param>\r
74                 /// <param name="message">The message that will be displayed on failure</param>\r
75                 /// <param name="args">Arguments to be used in formatting the message</param>\r
76                 public static void AllItemsAreInstancesOfType (IEnumerable collection, Type expectedType, string message, params object[] args)\r
77                 {\r
78             Assert.That(collection, new AllItemsConstraint(new InstanceOfTypeConstraint(expectedType)), message, args);\r
79                 }\r
80                 #endregion\r
81 \r
82                 #region AllItemsAreNotNull\r
83 \r
84                 /// <summary>\r
85                 /// Asserts that all items contained in collection are not equal to null.\r
86                 /// </summary>\r
87                 /// <param name="collection">IEnumerable containing objects to be considered</param>\r
88                 public static void AllItemsAreNotNull (IEnumerable collection) \r
89                 {\r
90                         AllItemsAreNotNull(collection, string.Empty, null);\r
91                 }\r
92 \r
93                 /// <summary>\r
94                 /// Asserts that all items contained in collection are not equal to null.\r
95                 /// </summary>\r
96                 /// <param name="collection">IEnumerable containing objects to be considered</param>\r
97                 /// <param name="message">The message that will be displayed on failure</param>\r
98                 public static void AllItemsAreNotNull (IEnumerable collection, string message) \r
99                 {\r
100                         AllItemsAreNotNull(collection, message, null);\r
101                 }\r
102 \r
103                 /// <summary>\r
104                 /// Asserts that all items contained in collection are not equal to null.\r
105                 /// </summary>\r
106                 /// <param name="collection">IEnumerable of objects to be considered</param>\r
107                 /// <param name="message">The message that will be displayed on failure</param>\r
108                 /// <param name="args">Arguments to be used in formatting the message</param>\r
109                 public static void AllItemsAreNotNull (IEnumerable collection, string message, params object[] args) \r
110                 {\r
111             Assert.That(collection, new AllItemsConstraint(new NotConstraint(new EqualConstraint(null))), message, args);\r
112                 }\r
113                 #endregion\r
114 \r
115                 #region AllItemsAreUnique\r
116 \r
117                 /// <summary>\r
118                 /// Ensures that every object contained in collection exists within the collection\r
119                 /// once and only once.\r
120                 /// </summary>\r
121                 /// <param name="collection">IEnumerable of objects to be considered</param>\r
122                 public static void AllItemsAreUnique (IEnumerable collection) \r
123                 {\r
124                         AllItemsAreUnique(collection, string.Empty, null);\r
125                 }\r
126 \r
127                 /// <summary>\r
128                 /// Ensures that every object contained in collection exists within the collection\r
129                 /// once and only once.\r
130                 /// </summary>\r
131                 /// <param name="collection">IEnumerable of objects to be considered</param>\r
132                 /// <param name="message">The message that will be displayed on failure</param>\r
133                 public static void AllItemsAreUnique (IEnumerable collection, string message) \r
134                 {\r
135                         AllItemsAreUnique(collection, message, null);\r
136                 }\r
137                 \r
138                 /// <summary>\r
139                 /// Ensures that every object contained in collection exists within the collection\r
140                 /// once and only once.\r
141                 /// </summary>\r
142                 /// <param name="collection">IEnumerable of objects to be considered</param>\r
143                 /// <param name="message">The message that will be displayed on failure</param>\r
144                 /// <param name="args">Arguments to be used in formatting the message</param>\r
145                 public static void AllItemsAreUnique (IEnumerable collection, string message, params object[] args) \r
146                 {\r
147             Assert.That(collection, new UniqueItemsConstraint(), message, args);\r
148                 }\r
149                 #endregion\r
150 \r
151                 #region AreEqual\r
152 \r
153                 /// <summary>\r
154                 /// Asserts that expected and actual are exactly equal.  The collections must have the same count, \r
155                 /// and contain the exact same objects in the same order.\r
156                 /// </summary>\r
157                 /// <param name="expected">The first IEnumerable of objects to be considered</param>\r
158                 /// <param name="actual">The second IEnumerable of objects to be considered</param>\r
159                 public static void AreEqual (IEnumerable expected, IEnumerable actual) \r
160                 {\r
161                         //AreEqual(expected, actual, null, string.Empty, null);\r
162             Assert.That(actual, new EqualConstraint(expected));\r
163                 }\r
164 \r
165                 /// <summary>\r
166                 /// Asserts that expected and actual are exactly equal.  The collections must have the same count, \r
167                 /// and contain the exact same objects in the same order.\r
168                 /// If comparer is not null then it will be used to compare the objects.\r
169                 /// </summary>\r
170                 /// <param name="expected">The first IEnumerable of objects to be considered</param>\r
171                 /// <param name="actual">The second IEnumerable of objects to be considered</param>\r
172                 /// <param name="comparer">The IComparer to use in comparing objects from each IEnumerable</param>\r
173                 public static void AreEqual (IEnumerable expected, IEnumerable actual, IComparer comparer) \r
174                 {\r
175                         AreEqual(expected, actual, comparer, string.Empty, null);\r
176                 }\r
177 \r
178                 /// <summary>\r
179                 /// Asserts that expected and actual are exactly equal.  The collections must have the same count, \r
180                 /// and contain the exact same objects in the same order.\r
181                 /// </summary>\r
182                 /// <param name="expected">The first IEnumerable of objects to be considered</param>\r
183                 /// <param name="actual">The second IEnumerable of objects to be considered</param>\r
184                 /// <param name="message">The message that will be displayed on failure</param>\r
185                 public static void AreEqual (IEnumerable expected, IEnumerable actual, string message) \r
186                 {\r
187                         //AreEqual(expected, actual, null, message, null);\r
188             Assert.That(actual, new EqualConstraint(expected), message);\r
189                 }\r
190 \r
191                 /// <summary>\r
192                 /// Asserts that expected and actual are exactly equal.  The collections must have the same count, \r
193                 /// and contain the exact same objects in the same order.\r
194                 /// If comparer is not null then it will be used to compare the objects.\r
195                 /// </summary>\r
196                 /// <param name="expected">The first IEnumerable of objects to be considered</param>\r
197                 /// <param name="actual">The second IEnumerable of objects to be considered</param>\r
198                 /// <param name="comparer">The IComparer to use in comparing objects from each IEnumerable</param>\r
199                 /// <param name="message">The message that will be displayed on failure</param>\r
200                 public static void AreEqual (IEnumerable expected, IEnumerable actual, IComparer comparer, string message) \r
201                 {\r
202                         AreEqual(expected, actual, comparer, message, null);\r
203                 }\r
204 \r
205                 /// <summary>\r
206                 /// Asserts that expected and actual are exactly equal.  The collections must have the same count, \r
207                 /// and contain the exact same objects in the same order.\r
208                 /// </summary>\r
209                 /// <param name="expected">The first IEnumerable of objects to be considered</param>\r
210                 /// <param name="actual">The second IEnumerable of objects to be considered</param>\r
211                 /// <param name="message">The message that will be displayed on failure</param>\r
212                 /// <param name="args">Arguments to be used in formatting the message</param>\r
213                 public static void AreEqual (IEnumerable expected, IEnumerable actual, string message, params object[] args) \r
214                 {\r
215                         //AreEqual(expected, actual, null, message, args);\r
216             Assert.That(actual, new EqualConstraint(expected), message, args);\r
217                 }\r
218 \r
219                 /// <summary>\r
220                 /// Asserts that expected and actual are exactly equal.  The collections must have the same count, \r
221                 /// and contain the exact same objects in the same order.\r
222                 /// If comparer is not null then it will be used to compare the objects.\r
223                 /// </summary>\r
224                 /// <param name="expected">The first IEnumerable of objects to be considered</param>\r
225                 /// <param name="actual">The second IEnumerable of objects to be considered</param>\r
226                 /// <param name="comparer">The IComparer to use in comparing objects from each IEnumerable</param>\r
227                 /// <param name="message">The message that will be displayed on failure</param>\r
228                 /// <param name="args">Arguments to be used in formatting the message</param>\r
229                 public static void AreEqual (IEnumerable expected, IEnumerable actual, IComparer comparer, string message, params object[] args) \r
230                 {\r
231             Assert.That(actual, new EqualConstraint(expected).Comparer(comparer), message, args);\r
232                 }\r
233                 #endregion\r
234 \r
235                 #region AreEquivalent\r
236 \r
237                 /// <summary>\r
238                 /// Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order.\r
239                 /// </summary>\r
240                 /// <param name="expected">The first IEnumerable of objects to be considered</param>\r
241                 /// <param name="actual">The second IEnumerable of objects to be considered</param>\r
242                 public static void AreEquivalent (IEnumerable expected, IEnumerable actual) \r
243                 {\r
244                         AreEquivalent(expected, actual, string.Empty, null);\r
245                 }\r
246 \r
247                 /// <summary>\r
248                 /// Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order.\r
249                 /// </summary>\r
250                 /// <param name="expected">The first IEnumerable of objects to be considered</param>\r
251                 /// <param name="actual">The second IEnumerable of objects to be considered</param>\r
252                 /// <param name="message">The message that will be displayed on failure</param>\r
253                 public static void AreEquivalent (IEnumerable expected, IEnumerable actual, string message) \r
254                 {\r
255                         AreEquivalent(expected, actual, message, null);\r
256                 }\r
257 \r
258                 /// <summary>\r
259                 /// Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order.\r
260                 /// </summary>\r
261                 /// <param name="expected">The first IEnumerable of objects to be considered</param>\r
262                 /// <param name="actual">The second IEnumerable of objects to be considered</param>\r
263                 /// <param name="message">The message that will be displayed on failure</param>\r
264                 /// <param name="args">Arguments to be used in formatting the message</param>\r
265                 public static void AreEquivalent (IEnumerable expected, IEnumerable actual, string message, params object[] args) \r
266                 {\r
267             Assert.That(actual, new CollectionEquivalentConstraint(expected), message, args);\r
268                 }\r
269                 #endregion\r
270 \r
271                 #region AreNotEqual\r
272 \r
273                 /// <summary>\r
274                 /// Asserts that expected and actual are not exactly equal.\r
275                 /// </summary>\r
276                 /// <param name="expected">The first IEnumerable of objects to be considered</param>\r
277                 /// <param name="actual">The second IEnumerable of objects to be considered</param>\r
278                 public static void AreNotEqual (IEnumerable expected, IEnumerable actual)\r
279                 {\r
280             Assert.That(actual, new NotConstraint(new EqualConstraint(expected)));\r
281                 }\r
282 \r
283                 /// <summary>\r
284                 /// Asserts that expected and actual are not exactly equal.\r
285                 /// If comparer is not null then it will be used to compare the objects.\r
286                 /// </summary>\r
287                 /// <param name="expected">The first IEnumerable of objects to be considered</param>\r
288                 /// <param name="actual">The second IEnumerable of objects to be considered</param>\r
289                 /// <param name="comparer">The IComparer to use in comparing objects from each IEnumerable</param>\r
290                 public static void AreNotEqual (IEnumerable expected, IEnumerable actual, IComparer comparer)\r
291                 {\r
292                         AreNotEqual(expected, actual, comparer, string.Empty, null);\r
293                 }\r
294 \r
295                 /// <summary>\r
296                 /// Asserts that expected and actual are not exactly equal.\r
297                 /// </summary>\r
298                 /// <param name="expected">The first IEnumerable of objects to be considered</param>\r
299                 /// <param name="actual">The second IEnumerable of objects to be considered</param>\r
300                 /// <param name="message">The message that will be displayed on failure</param>\r
301                 public static void AreNotEqual (IEnumerable expected, IEnumerable actual, string message)\r
302                 {\r
303                         //AreNotEqual(expected, actual, null, message, null);\r
304                         //Assert.AreNotEqual( expected, actual, message );\r
305             Assert.That(actual, new NotConstraint(new EqualConstraint(expected)), message);\r
306                 }\r
307 \r
308                 /// <summary>\r
309                 /// Asserts that expected and actual are not exactly equal.\r
310                 /// If comparer is not null then it will be used to compare the objects.\r
311                 /// </summary>\r
312                 /// <param name="expected">The first IEnumerable of objects to be considered</param>\r
313                 /// <param name="actual">The second IEnumerable of objects to be considered</param>\r
314                 /// <param name="comparer">The IComparer to use in comparing objects from each IEnumerable</param>\r
315                 /// <param name="message">The message that will be displayed on failure</param>\r
316                 public static void AreNotEqual (IEnumerable expected, IEnumerable actual, IComparer comparer, string message)\r
317                 {\r
318                         AreNotEqual(expected, actual, comparer, message, null);\r
319                 }\r
320 \r
321                 /// <summary>\r
322                 /// Asserts that expected and actual are not exactly equal.\r
323                 /// </summary>\r
324                 /// <param name="expected">The first IEnumerable of objects to be considered</param>\r
325                 /// <param name="actual">The second IEnumerable of objects to be considered</param>\r
326                 /// <param name="message">The message that will be displayed on failure</param>\r
327                 /// <param name="args">Arguments to be used in formatting the message</param>\r
328                 public static void AreNotEqual (IEnumerable expected, IEnumerable actual, string message, params object[] args) \r
329                 {\r
330                         //AreNotEqual(expected, actual, null, message, args);\r
331                         //Assert.AreNotEqual( expected, actual, message, args );\r
332             Assert.That(actual, new NotConstraint(new EqualConstraint(expected)), message, args);\r
333                 }\r
334 \r
335                 /// <summary>\r
336                 /// Asserts that expected and actual are not exactly equal.\r
337                 /// If comparer is not null then it will be used to compare the objects.\r
338                 /// </summary>\r
339                 /// <param name="expected">The first IEnumerable of objects to be considered</param>\r
340                 /// <param name="actual">The second IEnumerable of objects to be considered</param>\r
341                 /// <param name="comparer">The IComparer to use in comparing objects from each IEnumerable</param>\r
342                 /// <param name="message">The message that will be displayed on failure</param>\r
343                 /// <param name="args">Arguments to be used in formatting the message</param>\r
344                 public static void AreNotEqual (IEnumerable expected, IEnumerable actual, IComparer comparer, string message, params object[] args)\r
345                 {\r
346                         Assert.That(actual, new NotConstraint(new EqualConstraint(expected).Comparer(comparer)), message, args);\r
347                 }\r
348                 #endregion\r
349 \r
350                 #region AreNotEquivalent\r
351 \r
352                 /// <summary>\r
353                 /// Asserts that expected and actual are not equivalent.\r
354                 /// </summary>\r
355                 /// <param name="expected">The first IEnumerable of objects to be considered</param>\r
356                 /// <param name="actual">The second IEnumerable of objects to be considered</param>\r
357                 public static void AreNotEquivalent (IEnumerable expected, IEnumerable actual)\r
358                 {\r
359                         AreNotEquivalent(expected, actual, string.Empty, null);\r
360                 }\r
361 \r
362                 /// <summary>\r
363                 /// Asserts that expected and actual are not equivalent.\r
364                 /// </summary>\r
365                 /// <param name="expected">The first IEnumerable of objects to be considered</param>\r
366                 /// <param name="actual">The second IEnumerable of objects to be considered</param>\r
367                 /// <param name="message">The message that will be displayed on failure</param>\r
368                 public static void AreNotEquivalent (IEnumerable expected, IEnumerable actual, string message)\r
369                 {\r
370                         AreNotEquivalent(expected, actual, message, null);\r
371                 }\r
372 \r
373                 /// <summary>\r
374                 /// Asserts that expected and actual are not equivalent.\r
375                 /// </summary>\r
376                 /// <param name="expected">The first IEnumerable of objects to be considered</param>\r
377                 /// <param name="actual">The second IEnumerable of objects to be considered</param>\r
378                 /// <param name="message">The message that will be displayed on failure</param>\r
379                 /// <param name="args">Arguments to be used in formatting the message</param>\r
380                 public static void AreNotEquivalent (IEnumerable expected, IEnumerable actual, string message, params object[] args)\r
381                 {\r
382             Assert.That(actual, new NotConstraint(new CollectionEquivalentConstraint(expected)), message, args);\r
383                 }\r
384                 #endregion\r
385 \r
386                 #region Contains\r
387                 /// <summary>\r
388                 /// Asserts that collection contains actual as an item.\r
389                 /// </summary>\r
390                 /// <param name="collection">IEnumerable of objects to be considered</param>\r
391                 /// <param name="actual">Object to be found within collection</param>\r
392                 public static void Contains (IEnumerable collection, Object actual)\r
393                 {\r
394                         Contains(collection, actual, string.Empty, null);\r
395                 }\r
396 \r
397                 /// <summary>\r
398                 /// Asserts that collection contains actual as an item.\r
399                 /// </summary>\r
400                 /// <param name="collection">IEnumerable of objects to be considered</param>\r
401                 /// <param name="actual">Object to be found within collection</param>\r
402                 /// <param name="message">The message that will be displayed on failure</param>\r
403                 public static void Contains (IEnumerable collection, Object actual, string message)\r
404                 {\r
405                         Contains(collection, actual, message, null);\r
406                 }\r
407 \r
408                 /// <summary>\r
409                 /// Asserts that collection contains actual as an item.\r
410                 /// </summary>\r
411                 /// <param name="collection">IEnumerable of objects to be considered</param>\r
412                 /// <param name="actual">Object to be found within collection</param>\r
413                 /// <param name="message">The message that will be displayed on failure</param>\r
414                 /// <param name="args">Arguments to be used in formatting the message</param>\r
415                 public static void Contains (IEnumerable collection, Object actual, string message, params object[] args)\r
416                 {\r
417             Assert.That(collection, new CollectionContainsConstraint(actual), message, args);\r
418                 }\r
419                 #endregion\r
420 \r
421                 #region DoesNotContain\r
422 \r
423                 /// <summary>\r
424                 /// Asserts that collection does not contain actual as an item.\r
425                 /// </summary>\r
426                 /// <param name="collection">IEnumerable of objects to be considered</param>\r
427                 /// <param name="actual">Object that cannot exist within collection</param>\r
428                 public static void DoesNotContain (IEnumerable collection, Object actual)\r
429                 {\r
430                         DoesNotContain(collection, actual, string.Empty, null);\r
431                 }\r
432 \r
433                 /// <summary>\r
434                 /// Asserts that collection does not contain actual as an item.\r
435                 /// </summary>\r
436                 /// <param name="collection">IEnumerable of objects to be considered</param>\r
437                 /// <param name="actual">Object that cannot exist within collection</param>\r
438                 /// <param name="message">The message that will be displayed on failure</param>\r
439                 public static void DoesNotContain (IEnumerable collection, Object actual, string message)\r
440                 {\r
441                         DoesNotContain(collection, actual, message, null);\r
442                 }\r
443 \r
444                 /// <summary>\r
445                 /// Asserts that collection does not contain actual as an item.\r
446                 /// </summary>\r
447                 /// <param name="collection">IEnumerable of objects to be considered</param>\r
448                 /// <param name="actual">Object that cannot exist within collection</param>\r
449                 /// <param name="message">The message that will be displayed on failure</param>\r
450                 /// <param name="args">Arguments to be used in formatting the message</param>\r
451                 public static void DoesNotContain (IEnumerable collection, Object actual, string message, params object[] args)\r
452                 {\r
453             Assert.That(collection, new NotConstraint( new CollectionContainsConstraint( actual ) ), message, args);\r
454                 }\r
455                 #endregion\r
456 \r
457                 #region IsNotSubsetOf\r
458 \r
459                 /// <summary>\r
460                 /// Asserts that superset is not a subject of subset.\r
461                 /// </summary>\r
462                 /// <param name="subset">The IEnumerable superset to be considered</param>\r
463                 /// <param name="superset">The IEnumerable subset to be considered</param>\r
464                 public static void IsNotSubsetOf (IEnumerable subset, IEnumerable superset)\r
465                 {\r
466                         IsNotSubsetOf(subset, superset, string.Empty, null);\r
467                 }\r
468 \r
469                 /// <summary>\r
470                 /// Asserts that superset is not a subject of subset.\r
471                 /// </summary>\r
472                 /// <param name="subset">The IEnumerable superset to be considered</param>\r
473                 /// <param name="superset">The IEnumerable subset to be considered</param>\r
474                 /// <param name="message">The message that will be displayed on failure</param>\r
475                 public static void IsNotSubsetOf (IEnumerable subset, IEnumerable superset, string message)\r
476                 {\r
477                         IsNotSubsetOf(subset, superset, message, null);\r
478                 }\r
479 \r
480                 /// <summary>\r
481                 /// Asserts that superset is not a subject of subset.\r
482                 /// </summary>\r
483                 /// <param name="subset">The IEnumerable superset to be considered</param>\r
484                 /// <param name="superset">The IEnumerable subset to be considered</param>\r
485                 /// <param name="message">The message that will be displayed on failure</param>\r
486                 /// <param name="args">Arguments to be used in formatting the message</param>\r
487                 public static void IsNotSubsetOf (IEnumerable subset, IEnumerable superset, string message, params object[] args)\r
488                 {\r
489             Assert.That(subset, new NotConstraint(new CollectionSubsetConstraint(superset)), message, args);\r
490                 }\r
491                 #endregion\r
492 \r
493                 #region IsSubsetOf\r
494 \r
495                 /// <summary>\r
496                 /// Asserts that superset is a subset of subset.\r
497                 /// </summary>\r
498                 /// <param name="subset">The IEnumerable superset to be considered</param>\r
499                 /// <param name="superset">The IEnumerable subset to be considered</param>\r
500                 public static void IsSubsetOf (IEnumerable subset, IEnumerable superset)\r
501                 {\r
502                         IsSubsetOf(subset, superset, string.Empty, null);\r
503                 }\r
504 \r
505                 /// <summary>\r
506                 /// Asserts that superset is a subset of subset.\r
507                 /// </summary>\r
508                 /// <param name="subset">The IEnumerable superset to be considered</param>\r
509                 /// <param name="superset">The IEnumerable subset to be considered</param>\r
510                 /// <param name="message">The message that will be displayed on failure</param>\r
511                 public static void IsSubsetOf (IEnumerable subset, IEnumerable superset, string message)\r
512                 {\r
513                         IsSubsetOf(subset, superset, message, null);\r
514                 }\r
515 \r
516                 /// <summary>\r
517                 /// Asserts that superset is a subset of subset.\r
518                 /// </summary>\r
519                 /// <param name="subset">The IEnumerable superset to be considered</param>\r
520                 /// <param name="superset">The IEnumerable subset to be considered</param>\r
521                 /// <param name="message">The message that will be displayed on failure</param>\r
522                 /// <param name="args">Arguments to be used in formatting the message</param>\r
523                 public static void IsSubsetOf (IEnumerable subset, IEnumerable superset, string message, params object[] args)\r
524                 {\r
525             Assert.That(subset, new CollectionSubsetConstraint(superset), message, args);\r
526                 }\r
527                 #endregion\r
528 \r
529         #region IsEmpty\r
530         /// <summary>\r
531         /// Assert that an array, list or other collection is empty\r
532         /// </summary>\r
533         /// <param name="collection">An array, list or other collection implementing IEnumerable</param>\r
534         /// <param name="message">The message to be displayed on failure</param>\r
535         /// <param name="args">Arguments to be used in formatting the message</param>\r
536         public static void IsEmpty(IEnumerable collection, string message, params object[] args)\r
537         {\r
538             Assert.That(collection, new EmptyConstraint(), message, args);\r
539         }\r
540 \r
541         /// <summary>\r
542         /// Assert that an array, list or other collection is empty\r
543         /// </summary>\r
544         /// <param name="collection">An array, list or other collection implementing IEnumerable</param>\r
545         /// <param name="message">The message to be displayed on failure</param>\r
546         public static void IsEmpty(IEnumerable collection, string message)\r
547         {\r
548             IsEmpty(collection, message, null);\r
549         }\r
550 \r
551         /// <summary>\r
552         /// Assert that an array,list or other collection is empty\r
553         /// </summary>\r
554         /// <param name="collection">An array, list or other collection implementing IEnumerable</param>\r
555         public static void IsEmpty(IEnumerable collection)\r
556         {\r
557             IsEmpty(collection, string.Empty, null);\r
558         }\r
559         #endregion\r
560 \r
561         #region IsNotEmpty\r
562         /// <summary>\r
563         /// Assert that an array, list or other collection is empty\r
564         /// </summary>\r
565         /// <param name="collection">An array, list or other collection implementing IEnumerable</param>\r
566         /// <param name="message">The message to be displayed on failure</param>\r
567         /// <param name="args">Arguments to be used in formatting the message</param>\r
568         public static void IsNotEmpty(IEnumerable collection, string message, params object[] args)\r
569         {\r
570             Assert.That(collection, new NotConstraint(new EmptyConstraint()), message, args);\r
571         }\r
572 \r
573         /// <summary>\r
574         /// Assert that an array, list or other collection is empty\r
575         /// </summary>\r
576         /// <param name="collection">An array, list or other collection implementing IEnumerable</param>\r
577         /// <param name="message">The message to be displayed on failure</param>\r
578         public static void IsNotEmpty(IEnumerable collection, string message)\r
579         {\r
580             IsNotEmpty(collection, message, null);\r
581         }\r
582 \r
583         /// <summary>\r
584         /// Assert that an array,list or other collection is empty\r
585         /// </summary>\r
586         /// <param name="collection">An array, list or other collection implementing IEnumerable</param>\r
587         public static void IsNotEmpty(IEnumerable collection)\r
588         {\r
589             IsNotEmpty(collection, string.Empty, null);\r
590         }\r
591         #endregion\r
592     }\r
593 }\r
594 \r
595 \r