Merge lp:~a-schlapsi/nunit-3.0/bug-432805 into lp:~nunit-core/nunit-3.0/trunk-before-upgrade
- bug-432805
- Merge into trunk-before-upgrade
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Charlie Poole | ||||
Approved revision: | 59 | ||||
Merged at revision: | not available | ||||
Proposed branch: | lp:~a-schlapsi/nunit-3.0/bug-432805 | ||||
Merge into: | lp:~nunit-core/nunit-3.0/trunk-before-upgrade | ||||
Diff against target: |
12694 lines 9 files modified
src/framework/NUnit/Framework/Text.cs (+161/-161) src/framework/Shared/Framework/Assert.cs (+3698/-3698) src/framework/Shared/Framework/Constraints/ConstraintExpression.cs (+775/-775) src/framework/Shared/Framework/Constraints/ConstraintFactory.cs (+774/-774) src/framework/Shared/Framework/Constraints/PathConstraints.cs (+4/-3) src/framework/Shared/Framework/Has.cs (+205/-205) src/framework/Shared/Framework/Is.cs (+517/-517) src/framework/Shared/Framework/Throws.cs (+169/-169) src/tests/NUnit/Framework/RangeTests.cs (+7/-9) |
||||
To merge this branch: | bzr merge lp:~a-schlapsi/nunit-3.0/bug-432805 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Charlie Poole | Approve | ||
Andreas Schlapsi | Needs Resubmitting | ||
Review via email: mp+12496@code.launchpad.net |
This proposal supersedes a proposal from 2009-09-27.
Commit message
Description of the change
Andreas Schlapsi (a-schlapsi) wrote : Posted in a previous version of this proposal | # |
Charlie Poole (charlie.poole) wrote : Posted in a previous version of this proposal | # |
The merge makes it appear as if the entire text of the generated files is new. Can you tell what is happening here? Is it to do with line endings?
Andreas Schlapsi (a-schlapsi) wrote : | # |
I didn't see that the trunk has already changed. I've merged the changes from the trunk and resubmit the merge request.
The generated classes has changed, because I work with the NAnt script on Linux. Unfortunately it regenerates those classes and they appear in the diff.
Charlie Poole (charlie.poole) wrote : | # |
It appears that bazaar has a number of bugs related to eol handling, so we will need to wait for their resolution before doing anything about automatic eol conversion. For this merge, I'll simply remove the updates to the generated files manually.
Olof Bjarnason (objarni) wrote : | # |
2009/9/28 Charlie Poole <email address hidden>:
> Review: Approve
> It appears that bazaar has a number of bugs related to eol handling, so we will need to wait for their resolution before doing anything about automatic eol conversion. For this merge, I'll simply remove the updates to the generated files manually.
Doh! I wonder how many decades the computer industry will suffer from
the \r\n <-> \n inconsistency ;)
Blame Microsoft heh.
> --
> https:/
> Your team NUnit Developers is subscribed to branch lp:nunit-3.0.
>
--
twitter.com/olofb
olofb.wordpress.com
olofb.wordpress
Preview Diff
1 | === modified file 'src/framework/NUnit/Framework/Text.cs' |
2 | --- src/framework/NUnit/Framework/Text.cs 2009-09-22 01:07:21 +0000 |
3 | +++ src/framework/NUnit/Framework/Text.cs 2009-09-27 21:25:19 +0000 |
4 | @@ -1,161 +1,161 @@ |
5 | -// *********************************************************************** |
6 | -// Copyright (c) 2009 Charlie Poole |
7 | -// |
8 | -// Permission is hereby granted, free of charge, to any person obtaining |
9 | -// a copy of this software and associated documentation files (the |
10 | -// "Software"), to deal in the Software without restriction, including |
11 | -// without limitation the rights to use, copy, modify, merge, publish, |
12 | -// distribute, sublicense, and/or sell copies of the Software, and to |
13 | -// permit persons to whom the Software is furnished to do so, subject to |
14 | -// the following conditions: |
15 | -// |
16 | -// The above copyright notice and this permission notice shall be |
17 | -// included in all copies or substantial portions of the Software. |
18 | -// |
19 | -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
20 | -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
21 | -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
22 | -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
23 | -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
24 | -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
25 | -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
26 | -// *********************************************************************** |
27 | - |
28 | -// **************************************************************** |
29 | -// Generated by the NUnit Syntax Generator |
30 | -// |
31 | -// Command Line: GenSyntax.exe -syntax:SyntaxElements.txt Shared/Framework/Is.cs Shared/Framework/Has.cs NUnit/Framework/Text.cs Shared/Framework/Throws.cs Shared/Framework/Constraints/ConstraintFactory.cs Shared/Framework/Constraints/ConstraintExpression.cs Shared/Framework/Assert.cs |
32 | -// |
33 | -// DO NOT MODIFY THIS FILE DIRECTLY |
34 | -// **************************************************************** |
35 | - |
36 | -using System; |
37 | -using System.Collections; |
38 | -using NUnit.Framework.Constraints; |
39 | - |
40 | -namespace NUnit.Framework |
41 | -{ |
42 | - /// <summary> |
43 | - /// Helper class with static methods used to supply constraints |
44 | - /// that operate on strings. |
45 | - /// </summary> |
46 | - [Obsolete("Use Is class for string constraints")] |
47 | - public class Text |
48 | - { |
49 | - #region All |
50 | - |
51 | - /// <summary> |
52 | - /// Returns a ConstraintExpression, which will apply |
53 | - /// the following constraint to all members of a collection, |
54 | - /// succeeding if all of them succeed. |
55 | - /// </summary> |
56 | - [Obsolete("Use Is.All")] |
57 | - public static ConstraintExpression All |
58 | - { |
59 | - get { return new ConstraintExpression().All; } |
60 | - } |
61 | - |
62 | - #endregion |
63 | - |
64 | - #region Contains |
65 | - |
66 | - /// <summary> |
67 | - /// Returns a constraint that succeeds if the actual |
68 | - /// value contains the substring supplied as an argument. |
69 | - /// </summary> |
70 | - [Obsolete("Use Is.StringContaining")] |
71 | - public static SubstringConstraint Contains(string expected) |
72 | - { |
73 | - return new SubstringConstraint(expected); |
74 | - } |
75 | - |
76 | - #endregion |
77 | - |
78 | - #region DoesNotContain |
79 | - |
80 | - /// <summary> |
81 | - /// Returns a constraint that fails if the actual |
82 | - /// value contains the substring supplied as an argument. |
83 | - /// </summary> |
84 | - [Obsolete("Use Is.Not.StringContaining")] |
85 | - public static SubstringConstraint DoesNotContain(string expected) |
86 | - { |
87 | - return new ConstraintExpression().Not.ContainsSubstring(expected); |
88 | - } |
89 | - |
90 | - #endregion |
91 | - |
92 | - #region DoesNotStartWith |
93 | - |
94 | - /// <summary> |
95 | - /// Returns a constraint that fails if the actual |
96 | - /// value starts with the substring supplied as an argument. |
97 | - /// </summary> |
98 | - public static StartsWithConstraint DoesNotStartWith(string expected) |
99 | - { |
100 | - return new ConstraintExpression().Not.StartsWith(expected); |
101 | - } |
102 | - |
103 | - #endregion |
104 | - |
105 | - #region EndsWith |
106 | - |
107 | - /// <summary> |
108 | - /// Returns a constraint that succeeds if the actual |
109 | - /// value ends with the substring supplied as an argument. |
110 | - /// </summary> |
111 | - [Obsolete("Use Is.StringEnding")] |
112 | - public static EndsWithConstraint EndsWith(string expected) |
113 | - { |
114 | - return new EndsWithConstraint(expected); |
115 | - } |
116 | - |
117 | - #endregion |
118 | - |
119 | - #region DoesNotEndWith |
120 | - |
121 | - /// <summary> |
122 | - /// Returns a constraint that fails if the actual |
123 | - /// value ends with the substring supplied as an argument. |
124 | - /// </summary> |
125 | - public static EndsWithConstraint DoesNotEndWith(string expected) |
126 | - { |
127 | - return new ConstraintExpression().Not.EndsWith(expected); |
128 | - } |
129 | - |
130 | - #endregion |
131 | - |
132 | - #region Matches |
133 | - |
134 | -#if !NETCF |
135 | - /// <summary> |
136 | - /// Returns a constraint that succeeds if the actual |
137 | - /// value matches the regular expression supplied as an argument. |
138 | - /// </summary> |
139 | - [Obsolete("Use Is.StringMatching")] |
140 | - public static RegexConstraint Matches(string pattern) |
141 | - { |
142 | - return new RegexConstraint(pattern); |
143 | - } |
144 | -#endif |
145 | - |
146 | - #endregion |
147 | - |
148 | - #region DoesNotMatch |
149 | - |
150 | -#if !NUNITLITE |
151 | - /// <summary> |
152 | - /// Returns a constraint that fails if the actual |
153 | - /// value matches the pattern supplied as an argument. |
154 | - /// </summary> |
155 | - [Obsolete] |
156 | - public static RegexConstraint DoesNotMatch(string pattern) |
157 | - { |
158 | - return new ConstraintExpression().Not.Matches(pattern); |
159 | - } |
160 | -#endif |
161 | - |
162 | - #endregion |
163 | - |
164 | - } |
165 | -} |
166 | +// *********************************************************************** |
167 | +// Copyright (c) 2009 Charlie Poole |
168 | +// |
169 | +// Permission is hereby granted, free of charge, to any person obtaining |
170 | +// a copy of this software and associated documentation files (the |
171 | +// "Software"), to deal in the Software without restriction, including |
172 | +// without limitation the rights to use, copy, modify, merge, publish, |
173 | +// distribute, sublicense, and/or sell copies of the Software, and to |
174 | +// permit persons to whom the Software is furnished to do so, subject to |
175 | +// the following conditions: |
176 | +// |
177 | +// The above copyright notice and this permission notice shall be |
178 | +// included in all copies or substantial portions of the Software. |
179 | +// |
180 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
181 | +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
182 | +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
183 | +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
184 | +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
185 | +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
186 | +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
187 | +// *********************************************************************** |
188 | + |
189 | +// **************************************************************** |
190 | +// Generated by the NUnit Syntax Generator |
191 | +// |
192 | +// Command Line: GenSyntax.exe -syntax:SyntaxElements.txt Shared/Framework/Is.cs Shared/Framework/Has.cs NUnit/Framework/Text.cs Shared/Framework/Throws.cs Shared/Framework/Constraints/ConstraintFactory.cs Shared/Framework/Constraints/ConstraintExpression.cs Shared/Framework/Assert.cs |
193 | +// |
194 | +// DO NOT MODIFY THIS FILE DIRECTLY |
195 | +// **************************************************************** |
196 | + |
197 | +using System; |
198 | +using System.Collections; |
199 | +using NUnit.Framework.Constraints; |
200 | + |
201 | +namespace NUnit.Framework |
202 | +{ |
203 | + /// <summary> |
204 | + /// Helper class with static methods used to supply constraints |
205 | + /// that operate on strings. |
206 | + /// </summary> |
207 | + [Obsolete("Use Is class for string constraints")] |
208 | + public class Text |
209 | + { |
210 | + #region All |
211 | + |
212 | + /// <summary> |
213 | + /// Returns a ConstraintExpression, which will apply |
214 | + /// the following constraint to all members of a collection, |
215 | + /// succeeding if all of them succeed. |
216 | + /// </summary> |
217 | + [Obsolete("Use Is.All")] |
218 | +public static ConstraintExpression All |
219 | + { |
220 | + get { return new ConstraintExpression().All; } |
221 | + } |
222 | + |
223 | + #endregion |
224 | + |
225 | + #region Contains |
226 | + |
227 | + /// <summary> |
228 | + /// Returns a constraint that succeeds if the actual |
229 | + /// value contains the substring supplied as an argument. |
230 | + /// </summary> |
231 | + [Obsolete("Use Is.StringContaining")] |
232 | +public static SubstringConstraint Contains(string expected) |
233 | + { |
234 | + return new SubstringConstraint(expected); |
235 | + } |
236 | + |
237 | + #endregion |
238 | + |
239 | + #region DoesNotContain |
240 | + |
241 | + /// <summary> |
242 | + /// Returns a constraint that fails if the actual |
243 | + /// value contains the substring supplied as an argument. |
244 | + /// </summary> |
245 | + [Obsolete("Use Is.Not.StringContaining")] |
246 | +public static SubstringConstraint DoesNotContain(string expected) |
247 | + { |
248 | + return new ConstraintExpression().Not.ContainsSubstring(expected); |
249 | + } |
250 | + |
251 | + #endregion |
252 | + |
253 | + #region DoesNotStartWith |
254 | + |
255 | + /// <summary> |
256 | + /// Returns a constraint that fails if the actual |
257 | + /// value starts with the substring supplied as an argument. |
258 | + /// </summary> |
259 | +public static StartsWithConstraint DoesNotStartWith(string expected) |
260 | + { |
261 | + return new ConstraintExpression().Not.StartsWith(expected); |
262 | + } |
263 | + |
264 | + #endregion |
265 | + |
266 | + #region EndsWith |
267 | + |
268 | + /// <summary> |
269 | + /// Returns a constraint that succeeds if the actual |
270 | + /// value ends with the substring supplied as an argument. |
271 | + /// </summary> |
272 | + [Obsolete("Use Is.StringEnding")] |
273 | +public static EndsWithConstraint EndsWith(string expected) |
274 | + { |
275 | + return new EndsWithConstraint(expected); |
276 | + } |
277 | + |
278 | + #endregion |
279 | + |
280 | + #region DoesNotEndWith |
281 | + |
282 | + /// <summary> |
283 | + /// Returns a constraint that fails if the actual |
284 | + /// value ends with the substring supplied as an argument. |
285 | + /// </summary> |
286 | +public static EndsWithConstraint DoesNotEndWith(string expected) |
287 | + { |
288 | + return new ConstraintExpression().Not.EndsWith(expected); |
289 | + } |
290 | + |
291 | + #endregion |
292 | + |
293 | + #region Matches |
294 | + |
295 | +#if !NETCF |
296 | + /// <summary> |
297 | + /// Returns a constraint that succeeds if the actual |
298 | + /// value matches the regular expression supplied as an argument. |
299 | + /// </summary> |
300 | + [Obsolete("Use Is.StringMatching")] |
301 | +public static RegexConstraint Matches(string pattern) |
302 | + { |
303 | + return new RegexConstraint(pattern); |
304 | + } |
305 | +#endif |
306 | + |
307 | + #endregion |
308 | + |
309 | + #region DoesNotMatch |
310 | + |
311 | +#if !NUNITLITE |
312 | + /// <summary> |
313 | + /// Returns a constraint that fails if the actual |
314 | + /// value matches the pattern supplied as an argument. |
315 | + /// </summary> |
316 | + [Obsolete] |
317 | +public static RegexConstraint DoesNotMatch(string pattern) |
318 | + { |
319 | + return new ConstraintExpression().Not.Matches(pattern); |
320 | + } |
321 | +#endif |
322 | + |
323 | + #endregion |
324 | + |
325 | + } |
326 | +} |
327 | |
328 | === modified file 'src/framework/Shared/Framework/Assert.cs' |
329 | --- src/framework/Shared/Framework/Assert.cs 2009-09-22 01:07:21 +0000 |
330 | +++ src/framework/Shared/Framework/Assert.cs 2009-09-27 21:25:19 +0000 |
331 | @@ -1,3698 +1,3698 @@ |
332 | -// *********************************************************************** |
333 | -// Copyright (c) 2009 Charlie Poole |
334 | -// |
335 | -// Permission is hereby granted, free of charge, to any person obtaining |
336 | -// a copy of this software and associated documentation files (the |
337 | -// "Software"), to deal in the Software without restriction, including |
338 | -// without limitation the rights to use, copy, modify, merge, publish, |
339 | -// distribute, sublicense, and/or sell copies of the Software, and to |
340 | -// permit persons to whom the Software is furnished to do so, subject to |
341 | -// the following conditions: |
342 | -// |
343 | -// The above copyright notice and this permission notice shall be |
344 | -// included in all copies or substantial portions of the Software. |
345 | -// |
346 | -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
347 | -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
348 | -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
349 | -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
350 | -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
351 | -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
352 | -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
353 | -// *********************************************************************** |
354 | - |
355 | -// **************************************************************** |
356 | -// Generated by the NUnit Syntax Generator |
357 | -// |
358 | -// Command Line: GenSyntax.exe -syntax:SyntaxElements.txt Shared/Framework/Is.cs Shared/Framework/Has.cs NUnit/Framework/Text.cs Shared/Framework/Throws.cs Shared/Framework/Constraints/ConstraintFactory.cs Shared/Framework/Constraints/ConstraintExpression.cs Shared/Framework/Assert.cs |
359 | -// |
360 | -// DO NOT MODIFY THIS FILE DIRECTLY |
361 | -// **************************************************************** |
362 | - |
363 | -using System; |
364 | -using System.Collections; |
365 | -using System.ComponentModel; |
366 | -using NUnit.Framework.Constraints; |
367 | - |
368 | -namespace NUnit.Framework |
369 | -{ |
370 | - /// <summary> |
371 | - /// Delegate used by tests that execute code and |
372 | - /// capture any thrown exception. |
373 | - /// </summary> |
374 | - public delegate void TestDelegate(); |
375 | - |
376 | - /// <summary> |
377 | - /// The Assert class contains a collection of static methods that |
378 | - /// implement the most common assertions used in NUnit. |
379 | - /// </summary> |
380 | - public class Assert |
381 | - { |
382 | - #region Constructor |
383 | - |
384 | - /// <summary> |
385 | - /// We don't actually want any instances of this object, but some people |
386 | - /// like to inherit from it to add other static methods. Hence, the |
387 | - /// protected constructor disallows any instances of this object. |
388 | - /// </summary> |
389 | - protected Assert() { } |
390 | - |
391 | - #endregion |
392 | - |
393 | - #region Assert Counting |
394 | - |
395 | - private static int counter = 0; |
396 | - |
397 | - /// <summary> |
398 | - /// Gets the number of assertions executed so far and |
399 | - /// resets the counter to zero. |
400 | - /// </summary> |
401 | - public static int Counter |
402 | - { |
403 | - get |
404 | - { |
405 | - int cnt = counter; |
406 | - counter = 0; |
407 | - return cnt; |
408 | - } |
409 | - } |
410 | - |
411 | - private static void IncrementAssertCount() |
412 | - { |
413 | - ++counter; |
414 | - } |
415 | - |
416 | - #endregion |
417 | - |
418 | - #region Equals and ReferenceEquals |
419 | - |
420 | -#if !NETCF |
421 | - /// <summary> |
422 | - /// The Equals method throws an AssertionException. This is done |
423 | - /// to make sure there is no mistake by calling this function. |
424 | - /// </summary> |
425 | - /// <param name="a"></param> |
426 | - /// <param name="b"></param> |
427 | - [EditorBrowsable(EditorBrowsableState.Never)] |
428 | - public static new bool Equals(object a, object b) |
429 | - { |
430 | - throw new InvalidOperationException("Assert.Equals should not be used for Assertions"); |
431 | - } |
432 | - |
433 | - /// <summary> |
434 | - /// override the default ReferenceEquals to throw an AssertionException. This |
435 | - /// implementation makes sure there is no mistake in calling this function |
436 | - /// as part of Assert. |
437 | - /// </summary> |
438 | - /// <param name="a"></param> |
439 | - /// <param name="b"></param> |
440 | - public static new void ReferenceEquals(object a, object b) |
441 | - { |
442 | - throw new InvalidOperationException("Assert.ReferenceEquals should not be used for Assertions"); |
443 | - } |
444 | -#endif |
445 | - |
446 | - #endregion |
447 | - |
448 | - #region Utility Asserts |
449 | - |
450 | - #region Pass |
451 | - |
452 | -#if !NUNITLITE |
453 | - /// <summary> |
454 | - /// Throws a <see cref="SuccessException"/> with the message and arguments |
455 | - /// that are passed in. This allows a test to be cut short, with a result |
456 | - /// of success returned to NUnit. |
457 | - /// </summary> |
458 | - /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param> |
459 | - /// <param name="args">Arguments to be used in formatting the message</param> |
460 | - static public void Pass(string message, params object[] args) |
461 | - { |
462 | - if (message == null) message = string.Empty; |
463 | - else if (args != null && args.Length > 0) |
464 | - message = string.Format(message, args); |
465 | - |
466 | - throw new SuccessException(message); |
467 | - } |
468 | - |
469 | - /// <summary> |
470 | - /// Throws a <see cref="SuccessException"/> with the message and arguments |
471 | - /// that are passed in. This allows a test to be cut short, with a result |
472 | - /// of success returned to NUnit. |
473 | - /// </summary> |
474 | - /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param> |
475 | - static public void Pass(string message) |
476 | - { |
477 | - Assert.Pass(message, null); |
478 | - } |
479 | - |
480 | - /// <summary> |
481 | - /// Throws a <see cref="SuccessException"/> with the message and arguments |
482 | - /// that are passed in. This allows a test to be cut short, with a result |
483 | - /// of success returned to NUnit. |
484 | - /// </summary> |
485 | - static public void Pass() |
486 | - { |
487 | - Assert.Pass(string.Empty, null); |
488 | - } |
489 | -#endif |
490 | - #endregion |
491 | - |
492 | - #region Fail |
493 | - |
494 | - /// <summary> |
495 | - /// Throws an <see cref="AssertionException"/> with the message and arguments |
496 | - /// that are passed in. This is used by the other Assert functions. |
497 | - /// </summary> |
498 | - /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param> |
499 | - /// <param name="args">Arguments to be used in formatting the message</param> |
500 | - static public void Fail(string message, params object[] args) |
501 | - { |
502 | - if (message == null) message = string.Empty; |
503 | - else if (args != null && args.Length > 0) |
504 | - message = string.Format(message, args); |
505 | - |
506 | - throw new AssertionException(message); |
507 | - } |
508 | - |
509 | - /// <summary> |
510 | - /// Throws an <see cref="AssertionException"/> with the message that is |
511 | - /// passed in. This is used by the other Assert functions. |
512 | - /// </summary> |
513 | - /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param> |
514 | - static public void Fail(string message) |
515 | - { |
516 | - Assert.Fail(message, null); |
517 | - } |
518 | - |
519 | - /// <summary> |
520 | - /// Throws an <see cref="AssertionException"/>. |
521 | - /// This is used by the other Assert functions. |
522 | - /// </summary> |
523 | - static public void Fail() |
524 | - { |
525 | - Assert.Fail(string.Empty, null); |
526 | - } |
527 | - |
528 | - #endregion |
529 | - |
530 | - #region Ignore |
531 | - |
532 | -#if !NUNITLITE |
533 | - /// <summary> |
534 | - /// Throws an <see cref="IgnoreException"/> with the message and arguments |
535 | - /// that are passed in. This causes the test to be reported as ignored. |
536 | - /// </summary> |
537 | - /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param> |
538 | - /// <param name="args">Arguments to be used in formatting the message</param> |
539 | - static public void Ignore(string message, params object[] args) |
540 | - { |
541 | - if (message == null) message = string.Empty; |
542 | - else if (args != null && args.Length > 0) |
543 | - message = string.Format(message, args); |
544 | - |
545 | - throw new IgnoreException(message); |
546 | - } |
547 | - |
548 | - /// <summary> |
549 | - /// Throws an <see cref="IgnoreException"/> with the message that is |
550 | - /// passed in. This causes the test to be reported as ignored. |
551 | - /// </summary> |
552 | - /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param> |
553 | - static public void Ignore(string message) |
554 | - { |
555 | - Assert.Ignore(message, null); |
556 | - } |
557 | - |
558 | - /// <summary> |
559 | - /// Throws an <see cref="IgnoreException"/>. |
560 | - /// This causes the test to be reported as ignored. |
561 | - /// </summary> |
562 | - static public void Ignore() |
563 | - { |
564 | - Assert.Ignore(string.Empty, null); |
565 | - } |
566 | -#endif |
567 | - |
568 | - #endregion |
569 | - |
570 | - #region InConclusive |
571 | - |
572 | -#if !NUNITLITE |
573 | - /// <summary> |
574 | - /// Throws an <see cref="InconclusiveException"/> with the message and arguments |
575 | - /// that are passed in. This causes the test to be reported as inconclusive. |
576 | - /// </summary> |
577 | - /// <param name="message">The message to initialize the <see cref="InconclusiveException"/> with.</param> |
578 | - /// <param name="args">Arguments to be used in formatting the message</param> |
579 | - static public void Inconclusive(string message, params object[] args) |
580 | - { |
581 | - if (message == null) message = string.Empty; |
582 | - else if (args != null && args.Length > 0) |
583 | - message = string.Format(message, args); |
584 | - |
585 | - throw new InconclusiveException(message); |
586 | - } |
587 | - |
588 | - /// <summary> |
589 | - /// Throws an <see cref="InconclusiveException"/> with the message that is |
590 | - /// passed in. This causes the test to be reported as inconclusive. |
591 | - /// </summary> |
592 | - /// <param name="message">The message to initialize the <see cref="InconclusiveException"/> with.</param> |
593 | - static public void Inconclusive(string message) |
594 | - { |
595 | - Assert.Inconclusive(message, null); |
596 | - } |
597 | - |
598 | - /// <summary> |
599 | - /// Throws an <see cref="InconclusiveException"/>. |
600 | - /// This causes the test to be reported as Inconclusive. |
601 | - /// </summary> |
602 | - static public void Inconclusive() |
603 | - { |
604 | - Assert.Inconclusive(string.Empty, null); |
605 | - } |
606 | -#endif |
607 | - |
608 | - #endregion |
609 | - |
610 | - #endregion |
611 | - |
612 | - #region Assert.That |
613 | - |
614 | - #region Object |
615 | - /// <summary> |
616 | - /// Apply a constraint to an actual value, succeeding if the constraint |
617 | - /// is satisfied and throwing an assertion exception on failure. |
618 | - /// </summary> |
619 | - /// <param name="expression">A Constraint to be applied</param> |
620 | - /// <param name="actual">The actual value to test</param> |
621 | - static public void That(object actual, IResolveConstraint expression) |
622 | - { |
623 | - Assert.That(actual, expression, null, null); |
624 | - } |
625 | - |
626 | - /// <summary> |
627 | - /// Apply a constraint to an actual value, succeeding if the constraint |
628 | - /// is satisfied and throwing an assertion exception on failure. |
629 | - /// </summary> |
630 | - /// <param name="expression">A Constraint to be applied</param> |
631 | - /// <param name="actual">The actual value to test</param> |
632 | - /// <param name="message">The message that will be displayed on failure</param> |
633 | - static public void That(object actual, IResolveConstraint expression, string message) |
634 | - { |
635 | - Assert.That(actual, expression, message, null); |
636 | - } |
637 | - |
638 | - /// <summary> |
639 | - /// Apply a constraint to an actual value, succeeding if the constraint |
640 | - /// is satisfied and throwing an assertion exception on failure. |
641 | - /// </summary> |
642 | - /// <param name="expression">A Constraint expression to be applied</param> |
643 | - /// <param name="actual">The actual value to test</param> |
644 | - /// <param name="message">The message that will be displayed on failure</param> |
645 | - /// <param name="args">Arguments to be used in formatting the message</param> |
646 | - static public void That(object actual, IResolveConstraint expression, string message, params object[] args) |
647 | - { |
648 | - Constraint constraint = expression.Resolve(); |
649 | - |
650 | - Assert.IncrementAssertCount(); |
651 | - if (!constraint.Matches(actual)) |
652 | - { |
653 | - MessageWriter writer = new TextMessageWriter(message, args); |
654 | - constraint.WriteMessageTo(writer); |
655 | - throw new AssertionException(writer.ToString()); |
656 | - } |
657 | - } |
658 | - #endregion |
659 | - |
660 | - #region ActualValueDelegate |
661 | -#if !NUNITLITE |
662 | - /// <summary> |
663 | - /// Apply a constraint to an actual value, succeeding if the constraint |
664 | - /// is satisfied and throwing an assertion exception on failure. |
665 | - /// </summary> |
666 | - /// <param name="expr">A Constraint expression to be applied</param> |
667 | - /// <param name="del">An ActualValueDelegate returning the value to be tested</param> |
668 | - static public void That(ActualValueDelegate del, IResolveConstraint expr) |
669 | - { |
670 | - Assert.That(del, expr.Resolve(), null, null); |
671 | - } |
672 | - |
673 | - /// <summary> |
674 | - /// Apply a constraint to an actual value, succeeding if the constraint |
675 | - /// is satisfied and throwing an assertion exception on failure. |
676 | - /// </summary> |
677 | - /// <param name="expr">A Constraint expression to be applied</param> |
678 | - /// <param name="del">An ActualValueDelegate returning the value to be tested</param> |
679 | - /// <param name="message">The message that will be displayed on failure</param> |
680 | - static public void That(ActualValueDelegate del, IResolveConstraint expr, string message) |
681 | - { |
682 | - Assert.That(del, expr.Resolve(), message, null); |
683 | - } |
684 | - |
685 | - /// <summary> |
686 | - /// Apply a constraint to an actual value, succeeding if the constraint |
687 | - /// is satisfied and throwing an assertion exception on failure. |
688 | - /// </summary> |
689 | - /// <param name="del">An ActualValueDelegate returning the value to be tested</param> |
690 | - /// <param name="expr">A Constraint expression to be applied</param> |
691 | - /// <param name="message">The message that will be displayed on failure</param> |
692 | - /// <param name="args">Arguments to be used in formatting the message</param> |
693 | - static public void That(ActualValueDelegate del, IResolveConstraint expr, string message, params object[] args) |
694 | - { |
695 | - Constraint constraint = expr.Resolve(); |
696 | - |
697 | - Assert.IncrementAssertCount(); |
698 | - if (!constraint.Matches(del)) |
699 | - { |
700 | - MessageWriter writer = new TextMessageWriter(message, args); |
701 | - constraint.WriteMessageTo(writer); |
702 | - throw new AssertionException(writer.ToString()); |
703 | - } |
704 | - } |
705 | -#endif |
706 | - #endregion |
707 | - |
708 | - #region ref Object |
709 | -#if CLR_2_0 |
710 | - /// <summary> |
711 | - /// Apply a constraint to a referenced value, succeeding if the constraint |
712 | - /// is satisfied and throwing an assertion exception on failure. |
713 | - /// </summary> |
714 | - /// <param name="actual">The actual value to test</param> |
715 | - /// <param name="expression">A Constraint to be applied</param> |
716 | - static public void That<T>(ref T actual, IResolveConstraint expression) |
717 | - { |
718 | - Assert.That(ref actual, expression, null, null); |
719 | - } |
720 | - |
721 | - /// <summary> |
722 | - /// Apply a constraint to a referenced value, succeeding if the constraint |
723 | - /// is satisfied and throwing an assertion exception on failure. |
724 | - /// </summary> |
725 | - /// <param name="actual">The actual value to test</param> |
726 | - /// <param name="expression">A Constraint to be applied</param> |
727 | - /// <param name="message">The message that will be displayed on failure</param> |
728 | - static public void That<T>(ref T actual, IResolveConstraint expression, string message) |
729 | - { |
730 | - Assert.That(ref actual, expression, message, null); |
731 | - } |
732 | - |
733 | - /// <summary> |
734 | - /// Apply a constraint to a referenced value, succeeding if the constraint |
735 | - /// is satisfied and throwing an assertion exception on failure. |
736 | - /// </summary> |
737 | - /// <param name="actual">The actual value to test</param> |
738 | - /// <param name="expression">A Constraint to be applied</param> |
739 | - /// <param name="message">The message that will be displayed on failure</param> |
740 | - /// <param name="args">Arguments to be used in formatting the message</param> |
741 | - static public void That<T>(ref T actual, IResolveConstraint expression, string message, params object[] args) |
742 | - { |
743 | - Constraint constraint = expression.Resolve(); |
744 | - |
745 | - Assert.IncrementAssertCount(); |
746 | - if (!constraint.Matches(ref actual)) |
747 | - { |
748 | - MessageWriter writer = new TextMessageWriter(message, args); |
749 | - constraint.WriteMessageTo(writer); |
750 | - throw new AssertionException(writer.ToString()); |
751 | - } |
752 | - } |
753 | -#else |
754 | - /// <summary> |
755 | - /// Apply a constraint to a referenced boolean, succeeding if the constraint |
756 | - /// is satisfied and throwing an assertion exception on failure. |
757 | - /// </summary> |
758 | - /// <param name="actual">The actual value to test</param> |
759 | - /// <param name="expression">A Constraint to be applied</param> |
760 | - static public void That(ref bool actual, IResolveConstraint expression) |
761 | - { |
762 | - Assert.That(ref actual, expression, null, null); |
763 | - } |
764 | - |
765 | - /// <summary> |
766 | - /// Apply a constraint to a referenced value, succeeding if the constraint |
767 | - /// is satisfied and throwing an assertion exception on failure. |
768 | - /// </summary> |
769 | - /// <param name="actual">The actual value to test</param> |
770 | - /// <param name="expression">A Constraint to be applied</param> |
771 | - /// <param name="message">The message that will be displayed on failure</param> |
772 | - static public void That(ref bool actual, IResolveConstraint expression, string message) |
773 | - { |
774 | - Assert.That(ref actual, expression, message, null); |
775 | - } |
776 | - |
777 | - /// <summary> |
778 | - /// Apply a constraint to a referenced value, succeeding if the constraint |
779 | - /// is satisfied and throwing an assertion exception on failure. |
780 | - /// </summary> |
781 | - /// <param name="actual">The actual value to test</param> |
782 | - /// <param name="expression">A Constraint to be applied</param> |
783 | - /// <param name="message">The message that will be displayed on failure</param> |
784 | - /// <param name="args">Arguments to be used in formatting the message</param> |
785 | - static public void That(ref bool actual, IResolveConstraint expression, string message, params object[] args) |
786 | - { |
787 | - Constraint constraint = expression.Resolve(); |
788 | - |
789 | - Assert.IncrementAssertCount(); |
790 | - if (!constraint.Matches(ref actual)) |
791 | - { |
792 | - MessageWriter writer = new TextMessageWriter(message, args); |
793 | - constraint.WriteMessageTo(writer); |
794 | - throw new AssertionException(writer.ToString()); |
795 | - } |
796 | - } |
797 | -#endif |
798 | - #endregion |
799 | - |
800 | - #region Boolean |
801 | - /// <summary> |
802 | - /// Asserts that a condition is true. If the condition is false the method throws |
803 | - /// an <see cref="AssertionException"/>. |
804 | - /// </summary> |
805 | - /// <param name="condition">The evaluated condition</param> |
806 | - /// <param name="message">The message to display if the condition is false</param> |
807 | - /// <param name="args">Arguments to be used in formatting the message</param> |
808 | - static public void That(bool condition, string message, params object[] args) |
809 | - { |
810 | - Assert.That(condition, Is.True, message, args); |
811 | - } |
812 | - |
813 | - /// <summary> |
814 | - /// Asserts that a condition is true. If the condition is false the method throws |
815 | - /// an <see cref="AssertionException"/>. |
816 | - /// </summary> |
817 | - /// <param name="condition">The evaluated condition</param> |
818 | - /// <param name="message">The message to display if the condition is false</param> |
819 | - static public void That(bool condition, string message) |
820 | - { |
821 | - Assert.That(condition, Is.True, message, null); |
822 | - } |
823 | - |
824 | - /// <summary> |
825 | - /// Asserts that a condition is true. If the condition is false the method throws |
826 | - /// an <see cref="AssertionException"/>. |
827 | - /// </summary> |
828 | - /// <param name="condition">The evaluated condition</param> |
829 | - static public void That(bool condition) |
830 | - { |
831 | - Assert.That(condition, Is.True, null, null); |
832 | - } |
833 | - #endregion |
834 | - |
835 | - /// <summary> |
836 | - /// Asserts that the code represented by a delegate throws an exception |
837 | - /// that satisfies the constraint provided. |
838 | - /// </summary> |
839 | - /// <param name="code">A TestDelegate to be executed</param> |
840 | - /// <param name="constraint">A ThrowsConstraint used in the test</param> |
841 | - static public void That(TestDelegate code, IResolveConstraint constraint) |
842 | - { |
843 | - Assert.That((object)code, constraint); |
844 | - } |
845 | - #endregion |
846 | - |
847 | - #region Throws, Catch and DoesNotThrow |
848 | - |
849 | - #region Throws |
850 | - /// <summary> |
851 | - /// Verifies that a delegate throws a particular exception when called. |
852 | - /// </summary> |
853 | - /// <param name="expression">A constraint to be satisfied by the exception</param> |
854 | - /// <param name="code">A TestSnippet delegate</param> |
855 | - /// <param name="message">The message that will be displayed on failure</param> |
856 | - /// <param name="args">Arguments to be used in formatting the message</param> |
857 | - public static Exception Throws(IResolveConstraint expression, TestDelegate code, string message, params object[] args) |
858 | - { |
859 | - Exception caughtException = null; |
860 | - |
861 | - try |
862 | - { |
863 | - code(); |
864 | - } |
865 | - catch (Exception ex) |
866 | - { |
867 | - caughtException = ex; |
868 | - } |
869 | - |
870 | - Assert.That(caughtException, expression, message, args); |
871 | - |
872 | - return caughtException; |
873 | - } |
874 | - |
875 | - /// <summary> |
876 | - /// Verifies that a delegate throws a particular exception when called. |
877 | - /// </summary> |
878 | - /// <param name="expression">A constraint to be satisfied by the exception</param> |
879 | - /// <param name="code">A TestSnippet delegate</param> |
880 | - /// <param name="message">The message that will be displayed on failure</param> |
881 | - public static Exception Throws(IResolveConstraint expression, TestDelegate code, string message) |
882 | - { |
883 | - return Throws(expression, code, message, null); |
884 | - } |
885 | - |
886 | - /// <summary> |
887 | - /// Verifies that a delegate throws a particular exception when called. |
888 | - /// </summary> |
889 | - /// <param name="expression">A constraint to be satisfied by the exception</param> |
890 | - /// <param name="code">A TestSnippet delegate</param> |
891 | - public static Exception Throws(IResolveConstraint expression, TestDelegate code) |
892 | - { |
893 | - return Throws(expression, code, string.Empty, null); |
894 | - } |
895 | - |
896 | - /// <summary> |
897 | - /// Verifies that a delegate throws a particular exception when called. |
898 | - /// </summary> |
899 | - /// <param name="expectedExceptionType">The exception Type expected</param> |
900 | - /// <param name="code">A TestSnippet delegate</param> |
901 | - /// <param name="message">The message that will be displayed on failure</param> |
902 | - /// <param name="args">Arguments to be used in formatting the message</param> |
903 | - public static Exception Throws(Type expectedExceptionType, TestDelegate code, string message, params object[] args) |
904 | - { |
905 | - return Throws(new ExactTypeConstraint(expectedExceptionType), code, message, args); |
906 | - } |
907 | - |
908 | - /// <summary> |
909 | - /// Verifies that a delegate throws a particular exception when called. |
910 | - /// </summary> |
911 | - /// <param name="expectedExceptionType">The exception Type expected</param> |
912 | - /// <param name="code">A TestSnippet delegate</param> |
913 | - /// <param name="message">The message that will be displayed on failure</param> |
914 | - public static Exception Throws(Type expectedExceptionType, TestDelegate code, string message) |
915 | - { |
916 | - return Throws(new ExactTypeConstraint(expectedExceptionType), code, message, null); |
917 | - } |
918 | - |
919 | - /// <summary> |
920 | - /// Verifies that a delegate throws a particular exception when called. |
921 | - /// </summary> |
922 | - /// <param name="expectedExceptionType">The exception Type expected</param> |
923 | - /// <param name="code">A TestSnippet delegate</param> |
924 | - public static Exception Throws(Type expectedExceptionType, TestDelegate code) |
925 | - { |
926 | - return Throws(new ExactTypeConstraint(expectedExceptionType), code, string.Empty, null); |
927 | - } |
928 | - |
929 | - #endregion |
930 | - |
931 | - #region Throws<T> |
932 | -#if CLR_2_0 |
933 | - /// <summary> |
934 | - /// Verifies that a delegate throws a particular exception when called. |
935 | - /// </summary> |
936 | - /// <typeparam name="T">Type of the expected exception</typeparam> |
937 | - /// <param name="code">A TestSnippet delegate</param> |
938 | - /// <param name="message">The message that will be displayed on failure</param> |
939 | - /// <param name="args">Arguments to be used in formatting the message</param> |
940 | - public static T Throws<T>(TestDelegate code, string message, params object[] args) where T : Exception |
941 | - { |
942 | - return (T)Throws(typeof(T), code, message, args); |
943 | - } |
944 | - |
945 | - /// <summary> |
946 | - /// Verifies that a delegate throws a particular exception when called. |
947 | - /// </summary> |
948 | - /// <typeparam name="T">Type of the expected exception</typeparam> |
949 | - /// <param name="code">A TestSnippet delegate</param> |
950 | - /// <param name="message">The message that will be displayed on failure</param> |
951 | - public static T Throws<T>(TestDelegate code, string message) where T : Exception |
952 | - { |
953 | - return Throws<T>(code, message, null); |
954 | - } |
955 | - |
956 | - /// <summary> |
957 | - /// Verifies that a delegate throws a particular exception when called. |
958 | - /// </summary> |
959 | - /// <typeparam name="T">Type of the expected exception</typeparam> |
960 | - /// <param name="code">A TestSnippet delegate</param> |
961 | - public static T Throws<T>(TestDelegate code) where T : Exception |
962 | - { |
963 | - return Throws<T>(code, string.Empty, null); |
964 | - } |
965 | -#endif |
966 | - #endregion |
967 | - |
968 | - #region Catch |
969 | - /// <summary> |
970 | - /// Verifies that a delegate throws an exception when called |
971 | - /// and returns it. |
972 | - /// </summary> |
973 | - /// <param name="code">A TestDelegate</param> |
974 | - /// <param name="message">The message that will be displayed on failure</param> |
975 | - /// <param name="args">Arguments to be used in formatting the message</param> |
976 | - public static Exception Catch(TestDelegate code, string message, params object[] args) |
977 | - { |
978 | - return Throws(new InstanceOfTypeConstraint(typeof(Exception)), code, message, args); |
979 | - } |
980 | - |
981 | - /// <summary> |
982 | - /// Verifies that a delegate throws an exception when called |
983 | - /// and returns it. |
984 | - /// </summary> |
985 | - /// <param name="code">A TestDelegate</param> |
986 | - /// <param name="message">The message that will be displayed on failure</param> |
987 | - public static Exception Catch(TestDelegate code, string message) |
988 | - { |
989 | - return Throws(new InstanceOfTypeConstraint(typeof(Exception)), code, message); |
990 | - } |
991 | - |
992 | - /// <summary> |
993 | - /// Verifies that a delegate throws an exception when called |
994 | - /// and returns it. |
995 | - /// </summary> |
996 | - /// <param name="code">A TestDelegate</param> |
997 | - public static Exception Catch(TestDelegate code) |
998 | - { |
999 | - return Throws(new InstanceOfTypeConstraint(typeof(Exception)), code); |
1000 | - } |
1001 | - |
1002 | - /// <summary> |
1003 | - /// Verifies that a delegate throws an exception of a certain Type |
1004 | - /// or one derived from it when called and returns it. |
1005 | - /// </summary> |
1006 | - /// <param name="expectedExceptionType">The expected Exception Type</param> |
1007 | - /// <param name="code">A TestDelegate</param> |
1008 | - /// <param name="message">The message that will be displayed on failure</param> |
1009 | - /// <param name="args">Arguments to be used in formatting the message</param> |
1010 | - public static Exception Catch(Type expectedExceptionType, TestDelegate code, string message, params object[] args) |
1011 | - { |
1012 | - return Throws(new InstanceOfTypeConstraint(expectedExceptionType), code, message, args); |
1013 | - } |
1014 | - |
1015 | - /// <summary> |
1016 | - /// Verifies that a delegate throws an exception of a certain Type |
1017 | - /// or one derived from it when called and returns it. |
1018 | - /// </summary> |
1019 | - /// <param name="expectedExceptionType">The expected Exception Type</param> |
1020 | - /// <param name="code">A TestDelegate</param> |
1021 | - /// <param name="message">The message that will be displayed on failure</param> |
1022 | - public static Exception Catch(Type expectedExceptionType, TestDelegate code, string message) |
1023 | - { |
1024 | - return Throws(new InstanceOfTypeConstraint(expectedExceptionType), code, message); |
1025 | - } |
1026 | - |
1027 | - /// <summary> |
1028 | - /// Verifies that a delegate throws an exception of a certain Type |
1029 | - /// or one derived from it when called and returns it. |
1030 | - /// </summary> |
1031 | - /// <param name="expectedExceptionType">The expected Exception Type</param> |
1032 | - /// <param name="code">A TestDelegate</param> |
1033 | - public static Exception Catch(Type expectedExceptionType, TestDelegate code) |
1034 | - { |
1035 | - return Throws(new InstanceOfTypeConstraint(expectedExceptionType), code); |
1036 | - } |
1037 | - #endregion |
1038 | - |
1039 | - #region Catch<T> |
1040 | -#if CLR_2_0 |
1041 | - /// <summary> |
1042 | - /// Verifies that a delegate throws an exception of a certain Type |
1043 | - /// or one derived from it when called and returns it. |
1044 | - /// </summary> |
1045 | - /// <param name="code">A TestDelegate</param> |
1046 | - /// <param name="message">The message that will be displayed on failure</param> |
1047 | - /// <param name="args">Arguments to be used in formatting the message</param> |
1048 | - public static T Catch<T>(TestDelegate code, string message, params object[] args) where T : System.Exception |
1049 | - { |
1050 | - return (T)Throws(new InstanceOfTypeConstraint(typeof(T)), code, message, args); |
1051 | - } |
1052 | - |
1053 | - /// <summary> |
1054 | - /// Verifies that a delegate throws an exception of a certain Type |
1055 | - /// or one derived from it when called and returns it. |
1056 | - /// </summary> |
1057 | - /// <param name="code">A TestDelegate</param> |
1058 | - /// <param name="message">The message that will be displayed on failure</param> |
1059 | - public static T Catch<T>(TestDelegate code, string message) where T : System.Exception |
1060 | - { |
1061 | - return (T)Throws(new InstanceOfTypeConstraint(typeof(T)), code, message); |
1062 | - } |
1063 | - |
1064 | - /// <summary> |
1065 | - /// Verifies that a delegate throws an exception of a certain Type |
1066 | - /// or one derived from it when called and returns it. |
1067 | - /// </summary> |
1068 | - /// <param name="code">A TestDelegate</param> |
1069 | - public static T Catch<T>(TestDelegate code) where T : System.Exception |
1070 | - { |
1071 | - return (T)Throws(new InstanceOfTypeConstraint(typeof(T)), code); |
1072 | - } |
1073 | -#endif |
1074 | - #endregion |
1075 | - |
1076 | - #region DoesNotThrow |
1077 | - |
1078 | - /// <summary> |
1079 | - /// Verifies that a delegate does not throw an exception |
1080 | - /// </summary> |
1081 | - /// <param name="code">A TestSnippet delegate</param> |
1082 | - /// <param name="message">The message that will be displayed on failure</param> |
1083 | - /// <param name="args">Arguments to be used in formatting the message</param> |
1084 | - public static void DoesNotThrow(TestDelegate code, string message, params object[] args) |
1085 | - { |
1086 | - try |
1087 | - { |
1088 | - code(); |
1089 | - } |
1090 | - catch (Exception ex) |
1091 | - { |
1092 | - TextMessageWriter writer = new TextMessageWriter(message, args); |
1093 | - writer.WriteLine("Unexpected exception: {0}", ex.GetType()); |
1094 | - Assert.Fail(writer.ToString()); |
1095 | - } |
1096 | - } |
1097 | - |
1098 | - /// <summary> |
1099 | - /// Verifies that a delegate does not throw an exception. |
1100 | - /// </summary> |
1101 | - /// <param name="code">A TestSnippet delegate</param> |
1102 | - /// <param name="message">The message that will be displayed on failure</param> |
1103 | - public static void DoesNotThrow(TestDelegate code, string message) |
1104 | - { |
1105 | - DoesNotThrow(code, message, null); |
1106 | - } |
1107 | - |
1108 | - /// <summary> |
1109 | - /// Verifies that a delegate does not throw an exception. |
1110 | - /// </summary> |
1111 | - /// <param name="code">A TestSnippet delegate</param> |
1112 | - public static void DoesNotThrow(TestDelegate code) |
1113 | - { |
1114 | - DoesNotThrow(code, string.Empty, null); |
1115 | - } |
1116 | - |
1117 | - #endregion |
1118 | - |
1119 | - #endregion |
1120 | - |
1121 | - #region True |
1122 | - |
1123 | - /// <summary> |
1124 | - /// Asserts that a condition is true. If the condition is false the method throws |
1125 | - /// an <see cref="AssertionException"/>. |
1126 | - /// </summary> |
1127 | - /// <param name="condition">The evaluated condition</param> |
1128 | - /// <param name="message">The message to display in case of failure</param> |
1129 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
1130 | - public static void True(bool condition, string message, params object[] args) |
1131 | - { |
1132 | - Assert.That(condition, Is.True ,message, args); |
1133 | - } |
1134 | - /// <summary> |
1135 | - /// Asserts that a condition is true. If the condition is false the method throws |
1136 | - /// an <see cref="AssertionException"/>. |
1137 | - /// </summary> |
1138 | - /// <param name="condition">The evaluated condition</param> |
1139 | - /// <param name="message">The message to display in case of failure</param> |
1140 | - public static void True(bool condition, string message) |
1141 | - { |
1142 | - Assert.That(condition, Is.True ,message, null); |
1143 | - } |
1144 | - /// <summary> |
1145 | - /// Asserts that a condition is true. If the condition is false the method throws |
1146 | - /// an <see cref="AssertionException"/>. |
1147 | - /// </summary> |
1148 | - /// <param name="condition">The evaluated condition</param> |
1149 | - public static void True(bool condition) |
1150 | - { |
1151 | - Assert.That(condition, Is.True ,null, null); |
1152 | - } |
1153 | - |
1154 | - /// <summary> |
1155 | - /// Asserts that a condition is true. If the condition is false the method throws |
1156 | - /// an <see cref="AssertionException"/>. |
1157 | - /// </summary> |
1158 | - /// <param name="condition">The evaluated condition</param> |
1159 | - /// <param name="message">The message to display in case of failure</param> |
1160 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
1161 | - public static void IsTrue(bool condition, string message, params object[] args) |
1162 | - { |
1163 | - Assert.That(condition, Is.True ,message, args); |
1164 | - } |
1165 | - /// <summary> |
1166 | - /// Asserts that a condition is true. If the condition is false the method throws |
1167 | - /// an <see cref="AssertionException"/>. |
1168 | - /// </summary> |
1169 | - /// <param name="condition">The evaluated condition</param> |
1170 | - /// <param name="message">The message to display in case of failure</param> |
1171 | - public static void IsTrue(bool condition, string message) |
1172 | - { |
1173 | - Assert.That(condition, Is.True ,message, null); |
1174 | - } |
1175 | - /// <summary> |
1176 | - /// Asserts that a condition is true. If the condition is false the method throws |
1177 | - /// an <see cref="AssertionException"/>. |
1178 | - /// </summary> |
1179 | - /// <param name="condition">The evaluated condition</param> |
1180 | - public static void IsTrue(bool condition) |
1181 | - { |
1182 | - Assert.That(condition, Is.True ,null, null); |
1183 | - } |
1184 | - |
1185 | - #endregion |
1186 | - |
1187 | - #region False |
1188 | - |
1189 | - /// <summary> |
1190 | - /// Asserts that a condition is false. If the condition is true the method throws |
1191 | - /// an <see cref="AssertionException"/>. |
1192 | - /// </summary> |
1193 | - /// <param name="condition">The evaluated condition</param> |
1194 | - /// <param name="message">The message to display in case of failure</param> |
1195 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
1196 | - public static void False(bool condition, string message, params object[] args) |
1197 | - { |
1198 | - Assert.That(condition, Is.False ,message, args); |
1199 | - } |
1200 | - /// <summary> |
1201 | - /// Asserts that a condition is false. If the condition is true the method throws |
1202 | - /// an <see cref="AssertionException"/>. |
1203 | - /// </summary> |
1204 | - /// <param name="condition">The evaluated condition</param> |
1205 | - /// <param name="message">The message to display in case of failure</param> |
1206 | - public static void False(bool condition, string message) |
1207 | - { |
1208 | - Assert.That(condition, Is.False ,message, null); |
1209 | - } |
1210 | - /// <summary> |
1211 | - /// Asserts that a condition is false. If the condition is true the method throws |
1212 | - /// an <see cref="AssertionException"/>. |
1213 | - /// </summary> |
1214 | - /// <param name="condition">The evaluated condition</param> |
1215 | - public static void False(bool condition) |
1216 | - { |
1217 | - Assert.That(condition, Is.False ,null, null); |
1218 | - } |
1219 | - |
1220 | - /// <summary> |
1221 | - /// Asserts that a condition is false. If the condition is true the method throws |
1222 | - /// an <see cref="AssertionException"/>. |
1223 | - /// </summary> |
1224 | - /// <param name="condition">The evaluated condition</param> |
1225 | - /// <param name="message">The message to display in case of failure</param> |
1226 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
1227 | - public static void IsFalse(bool condition, string message, params object[] args) |
1228 | - { |
1229 | - Assert.That(condition, Is.False ,message, args); |
1230 | - } |
1231 | - /// <summary> |
1232 | - /// Asserts that a condition is false. If the condition is true the method throws |
1233 | - /// an <see cref="AssertionException"/>. |
1234 | - /// </summary> |
1235 | - /// <param name="condition">The evaluated condition</param> |
1236 | - /// <param name="message">The message to display in case of failure</param> |
1237 | - public static void IsFalse(bool condition, string message) |
1238 | - { |
1239 | - Assert.That(condition, Is.False ,message, null); |
1240 | - } |
1241 | - /// <summary> |
1242 | - /// Asserts that a condition is false. If the condition is true the method throws |
1243 | - /// an <see cref="AssertionException"/>. |
1244 | - /// </summary> |
1245 | - /// <param name="condition">The evaluated condition</param> |
1246 | - public static void IsFalse(bool condition) |
1247 | - { |
1248 | - Assert.That(condition, Is.False ,null, null); |
1249 | - } |
1250 | - |
1251 | - #endregion |
1252 | - |
1253 | - #region NotNull |
1254 | - |
1255 | - /// <summary> |
1256 | - /// Verifies that the object that is passed in is not equal to <code>null</code> |
1257 | - /// If the object is <code>null</code> then an <see cref="AssertionException"/> |
1258 | - /// is thrown. |
1259 | - /// </summary> |
1260 | - /// <param name="anObject">The object that is to be tested</param> |
1261 | - /// <param name="message">The message to display in case of failure</param> |
1262 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
1263 | - public static void NotNull(object anObject, string message, params object[] args) |
1264 | - { |
1265 | - Assert.That(anObject, Is.Not.Null ,message, args); |
1266 | - } |
1267 | - /// <summary> |
1268 | - /// Verifies that the object that is passed in is not equal to <code>null</code> |
1269 | - /// If the object is <code>null</code> then an <see cref="AssertionException"/> |
1270 | - /// is thrown. |
1271 | - /// </summary> |
1272 | - /// <param name="anObject">The object that is to be tested</param> |
1273 | - /// <param name="message">The message to display in case of failure</param> |
1274 | - public static void NotNull(object anObject, string message) |
1275 | - { |
1276 | - Assert.That(anObject, Is.Not.Null ,message, null); |
1277 | - } |
1278 | - /// <summary> |
1279 | - /// Verifies that the object that is passed in is not equal to <code>null</code> |
1280 | - /// If the object is <code>null</code> then an <see cref="AssertionException"/> |
1281 | - /// is thrown. |
1282 | - /// </summary> |
1283 | - /// <param name="anObject">The object that is to be tested</param> |
1284 | - public static void NotNull(object anObject) |
1285 | - { |
1286 | - Assert.That(anObject, Is.Not.Null ,null, null); |
1287 | - } |
1288 | - |
1289 | - /// <summary> |
1290 | - /// Verifies that the object that is passed in is not equal to <code>null</code> |
1291 | - /// If the object is <code>null</code> then an <see cref="AssertionException"/> |
1292 | - /// is thrown. |
1293 | - /// </summary> |
1294 | - /// <param name="anObject">The object that is to be tested</param> |
1295 | - /// <param name="message">The message to display in case of failure</param> |
1296 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
1297 | - public static void IsNotNull(object anObject, string message, params object[] args) |
1298 | - { |
1299 | - Assert.That(anObject, Is.Not.Null ,message, args); |
1300 | - } |
1301 | - /// <summary> |
1302 | - /// Verifies that the object that is passed in is not equal to <code>null</code> |
1303 | - /// If the object is <code>null</code> then an <see cref="AssertionException"/> |
1304 | - /// is thrown. |
1305 | - /// </summary> |
1306 | - /// <param name="anObject">The object that is to be tested</param> |
1307 | - /// <param name="message">The message to display in case of failure</param> |
1308 | - public static void IsNotNull(object anObject, string message) |
1309 | - { |
1310 | - Assert.That(anObject, Is.Not.Null ,message, null); |
1311 | - } |
1312 | - /// <summary> |
1313 | - /// Verifies that the object that is passed in is not equal to <code>null</code> |
1314 | - /// If the object is <code>null</code> then an <see cref="AssertionException"/> |
1315 | - /// is thrown. |
1316 | - /// </summary> |
1317 | - /// <param name="anObject">The object that is to be tested</param> |
1318 | - public static void IsNotNull(object anObject) |
1319 | - { |
1320 | - Assert.That(anObject, Is.Not.Null ,null, null); |
1321 | - } |
1322 | - |
1323 | - #endregion |
1324 | - |
1325 | - #region Null |
1326 | - |
1327 | - /// <summary> |
1328 | - /// Verifies that the object that is passed in is equal to <code>null</code> |
1329 | - /// If the object is not <code>null</code> then an <see cref="AssertionException"/> |
1330 | - /// is thrown. |
1331 | - /// </summary> |
1332 | - /// <param name="anObject">The object that is to be tested</param> |
1333 | - /// <param name="message">The message to display in case of failure</param> |
1334 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
1335 | - public static void Null(object anObject, string message, params object[] args) |
1336 | - { |
1337 | - Assert.That(anObject, Is.Null ,message, args); |
1338 | - } |
1339 | - /// <summary> |
1340 | - /// Verifies that the object that is passed in is equal to <code>null</code> |
1341 | - /// If the object is not <code>null</code> then an <see cref="AssertionException"/> |
1342 | - /// is thrown. |
1343 | - /// </summary> |
1344 | - /// <param name="anObject">The object that is to be tested</param> |
1345 | - /// <param name="message">The message to display in case of failure</param> |
1346 | - public static void Null(object anObject, string message) |
1347 | - { |
1348 | - Assert.That(anObject, Is.Null ,message, null); |
1349 | - } |
1350 | - /// <summary> |
1351 | - /// Verifies that the object that is passed in is equal to <code>null</code> |
1352 | - /// If the object is not <code>null</code> then an <see cref="AssertionException"/> |
1353 | - /// is thrown. |
1354 | - /// </summary> |
1355 | - /// <param name="anObject">The object that is to be tested</param> |
1356 | - public static void Null(object anObject) |
1357 | - { |
1358 | - Assert.That(anObject, Is.Null ,null, null); |
1359 | - } |
1360 | - |
1361 | - /// <summary> |
1362 | - /// Verifies that the object that is passed in is equal to <code>null</code> |
1363 | - /// If the object is not <code>null</code> then an <see cref="AssertionException"/> |
1364 | - /// is thrown. |
1365 | - /// </summary> |
1366 | - /// <param name="anObject">The object that is to be tested</param> |
1367 | - /// <param name="message">The message to display in case of failure</param> |
1368 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
1369 | - public static void IsNull(object anObject, string message, params object[] args) |
1370 | - { |
1371 | - Assert.That(anObject, Is.Null ,message, args); |
1372 | - } |
1373 | - /// <summary> |
1374 | - /// Verifies that the object that is passed in is equal to <code>null</code> |
1375 | - /// If the object is not <code>null</code> then an <see cref="AssertionException"/> |
1376 | - /// is thrown. |
1377 | - /// </summary> |
1378 | - /// <param name="anObject">The object that is to be tested</param> |
1379 | - /// <param name="message">The message to display in case of failure</param> |
1380 | - public static void IsNull(object anObject, string message) |
1381 | - { |
1382 | - Assert.That(anObject, Is.Null ,message, null); |
1383 | - } |
1384 | - /// <summary> |
1385 | - /// Verifies that the object that is passed in is equal to <code>null</code> |
1386 | - /// If the object is not <code>null</code> then an <see cref="AssertionException"/> |
1387 | - /// is thrown. |
1388 | - /// </summary> |
1389 | - /// <param name="anObject">The object that is to be tested</param> |
1390 | - public static void IsNull(object anObject) |
1391 | - { |
1392 | - Assert.That(anObject, Is.Null ,null, null); |
1393 | - } |
1394 | - |
1395 | - #endregion |
1396 | - |
1397 | - #region IsNaN |
1398 | - |
1399 | -#if !NUNITLITE |
1400 | - /// <summary> |
1401 | - /// Verifies that the double that is passed in is an <code>NaN</code> value. |
1402 | - /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/> |
1403 | - /// is thrown. |
1404 | - /// </summary> |
1405 | - /// <param name="aDouble">The value that is to be tested</param> |
1406 | - /// <param name="message">The message to display in case of failure</param> |
1407 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
1408 | - public static void IsNaN(double aDouble, string message, params object[] args) |
1409 | - { |
1410 | - Assert.That(aDouble, Is.NaN ,message, args); |
1411 | - } |
1412 | - /// <summary> |
1413 | - /// Verifies that the double that is passed in is an <code>NaN</code> value. |
1414 | - /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/> |
1415 | - /// is thrown. |
1416 | - /// </summary> |
1417 | - /// <param name="aDouble">The value that is to be tested</param> |
1418 | - /// <param name="message">The message to display in case of failure</param> |
1419 | - public static void IsNaN(double aDouble, string message) |
1420 | - { |
1421 | - Assert.That(aDouble, Is.NaN ,message, null); |
1422 | - } |
1423 | - /// <summary> |
1424 | - /// Verifies that the double that is passed in is an <code>NaN</code> value. |
1425 | - /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/> |
1426 | - /// is thrown. |
1427 | - /// </summary> |
1428 | - /// <param name="aDouble">The value that is to be tested</param> |
1429 | - public static void IsNaN(double aDouble) |
1430 | - { |
1431 | - Assert.That(aDouble, Is.NaN ,null, null); |
1432 | - } |
1433 | - |
1434 | -#if CLR_2_0 |
1435 | - /// <summary> |
1436 | - /// Verifies that the double that is passed in is an <code>NaN</code> value. |
1437 | - /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/> |
1438 | - /// is thrown. |
1439 | - /// </summary> |
1440 | - /// <param name="aDouble">The value that is to be tested</param> |
1441 | - /// <param name="message">The message to display in case of failure</param> |
1442 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
1443 | - public static void IsNaN(double? aDouble, string message, params object[] args) |
1444 | - { |
1445 | - Assert.That(aDouble, Is.NaN ,message, args); |
1446 | - } |
1447 | - /// <summary> |
1448 | - /// Verifies that the double that is passed in is an <code>NaN</code> value. |
1449 | - /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/> |
1450 | - /// is thrown. |
1451 | - /// </summary> |
1452 | - /// <param name="aDouble">The value that is to be tested</param> |
1453 | - /// <param name="message">The message to display in case of failure</param> |
1454 | - public static void IsNaN(double? aDouble, string message) |
1455 | - { |
1456 | - Assert.That(aDouble, Is.NaN ,message, null); |
1457 | - } |
1458 | - /// <summary> |
1459 | - /// Verifies that the double that is passed in is an <code>NaN</code> value. |
1460 | - /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/> |
1461 | - /// is thrown. |
1462 | - /// </summary> |
1463 | - /// <param name="aDouble">The value that is to be tested</param> |
1464 | - public static void IsNaN(double? aDouble) |
1465 | - { |
1466 | - Assert.That(aDouble, Is.NaN ,null, null); |
1467 | - } |
1468 | -#endif |
1469 | -#endif |
1470 | - |
1471 | - #endregion |
1472 | - |
1473 | - #region IsEmpty |
1474 | - |
1475 | -#if !NUNITLITE |
1476 | - /// <summary> |
1477 | - /// Assert that a string is empty - that is equal to string.Empty |
1478 | - /// </summary> |
1479 | - /// <param name="aString">The string to be tested</param> |
1480 | - /// <param name="message">The message to display in case of failure</param> |
1481 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
1482 | - public static void IsEmpty(string aString, string message, params object[] args) |
1483 | - { |
1484 | - Assert.That(aString, new EmptyStringConstraint() ,message, args); |
1485 | - } |
1486 | - /// <summary> |
1487 | - /// Assert that a string is empty - that is equal to string.Empty |
1488 | - /// </summary> |
1489 | - /// <param name="aString">The string to be tested</param> |
1490 | - /// <param name="message">The message to display in case of failure</param> |
1491 | - public static void IsEmpty(string aString, string message) |
1492 | - { |
1493 | - Assert.That(aString, new EmptyStringConstraint() ,message, null); |
1494 | - } |
1495 | - /// <summary> |
1496 | - /// Assert that a string is empty - that is equal to string.Empty |
1497 | - /// </summary> |
1498 | - /// <param name="aString">The string to be tested</param> |
1499 | - public static void IsEmpty(string aString) |
1500 | - { |
1501 | - Assert.That(aString, new EmptyStringConstraint() ,null, null); |
1502 | - } |
1503 | -#endif |
1504 | - |
1505 | - #endregion |
1506 | - |
1507 | - #region IsEmpty |
1508 | - |
1509 | -#if !NUNITLITE |
1510 | - /// <summary> |
1511 | - /// Assert that an array, list or other collection is empty |
1512 | - /// </summary> |
1513 | - /// <param name="collection">An array, list or other collection implementing ICollection</param> |
1514 | - /// <param name="message">The message to display in case of failure</param> |
1515 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
1516 | - public static void IsEmpty(ICollection collection, string message, params object[] args) |
1517 | - { |
1518 | - Assert.That(collection, new EmptyCollectionConstraint() ,message, args); |
1519 | - } |
1520 | - /// <summary> |
1521 | - /// Assert that an array, list or other collection is empty |
1522 | - /// </summary> |
1523 | - /// <param name="collection">An array, list or other collection implementing ICollection</param> |
1524 | - /// <param name="message">The message to display in case of failure</param> |
1525 | - public static void IsEmpty(ICollection collection, string message) |
1526 | - { |
1527 | - Assert.That(collection, new EmptyCollectionConstraint() ,message, null); |
1528 | - } |
1529 | - /// <summary> |
1530 | - /// Assert that an array, list or other collection is empty |
1531 | - /// </summary> |
1532 | - /// <param name="collection">An array, list or other collection implementing ICollection</param> |
1533 | - public static void IsEmpty(ICollection collection) |
1534 | - { |
1535 | - Assert.That(collection, new EmptyCollectionConstraint() ,null, null); |
1536 | - } |
1537 | -#endif |
1538 | - |
1539 | - #endregion |
1540 | - |
1541 | - #region IsNotEmpty |
1542 | - |
1543 | -#if !NUNITLITE |
1544 | - /// <summary> |
1545 | - /// Assert that a string is not empty - that is not equal to string.Empty |
1546 | - /// </summary> |
1547 | - /// <param name="aString">The string to be tested</param> |
1548 | - /// <param name="message">The message to display in case of failure</param> |
1549 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
1550 | - public static void IsNotEmpty(string aString, string message, params object[] args) |
1551 | - { |
1552 | - Assert.That(aString, Is.Not.Empty ,message, args); |
1553 | - } |
1554 | - /// <summary> |
1555 | - /// Assert that a string is not empty - that is not equal to string.Empty |
1556 | - /// </summary> |
1557 | - /// <param name="aString">The string to be tested</param> |
1558 | - /// <param name="message">The message to display in case of failure</param> |
1559 | - public static void IsNotEmpty(string aString, string message) |
1560 | - { |
1561 | - Assert.That(aString, Is.Not.Empty ,message, null); |
1562 | - } |
1563 | - /// <summary> |
1564 | - /// Assert that a string is not empty - that is not equal to string.Empty |
1565 | - /// </summary> |
1566 | - /// <param name="aString">The string to be tested</param> |
1567 | - public static void IsNotEmpty(string aString) |
1568 | - { |
1569 | - Assert.That(aString, Is.Not.Empty ,null, null); |
1570 | - } |
1571 | -#endif |
1572 | - |
1573 | - #endregion |
1574 | - |
1575 | - #region IsNotEmpty |
1576 | - |
1577 | -#if !NUNITLITE |
1578 | - /// <summary> |
1579 | - /// Assert that an array, list or other collection is not empty |
1580 | - /// </summary> |
1581 | - /// <param name="collection">An array, list or other collection implementing ICollection</param> |
1582 | - /// <param name="message">The message to display in case of failure</param> |
1583 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
1584 | - public static void IsNotEmpty(ICollection collection, string message, params object[] args) |
1585 | - { |
1586 | - Assert.That(collection, Is.Not.Empty ,message, args); |
1587 | - } |
1588 | - /// <summary> |
1589 | - /// Assert that an array, list or other collection is not empty |
1590 | - /// </summary> |
1591 | - /// <param name="collection">An array, list or other collection implementing ICollection</param> |
1592 | - /// <param name="message">The message to display in case of failure</param> |
1593 | - public static void IsNotEmpty(ICollection collection, string message) |
1594 | - { |
1595 | - Assert.That(collection, Is.Not.Empty ,message, null); |
1596 | - } |
1597 | - /// <summary> |
1598 | - /// Assert that an array, list or other collection is not empty |
1599 | - /// </summary> |
1600 | - /// <param name="collection">An array, list or other collection implementing ICollection</param> |
1601 | - public static void IsNotEmpty(ICollection collection) |
1602 | - { |
1603 | - Assert.That(collection, Is.Not.Empty ,null, null); |
1604 | - } |
1605 | -#endif |
1606 | - |
1607 | - #endregion |
1608 | - |
1609 | - #region IsNullOrEmpty |
1610 | - |
1611 | -#if !NUNITLITE |
1612 | - /// <summary> |
1613 | - /// Assert that a string is either null or equal to string.Empty |
1614 | - /// </summary> |
1615 | - /// <param name="aString">The string to be tested</param> |
1616 | - /// <param name="message">The message to display in case of failure</param> |
1617 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
1618 | - public static void IsNullOrEmpty(string aString, string message, params object[] args) |
1619 | - { |
1620 | - Assert.That(aString, new NullOrEmptyStringConstraint() ,message, args); |
1621 | - } |
1622 | - /// <summary> |
1623 | - /// Assert that a string is either null or equal to string.Empty |
1624 | - /// </summary> |
1625 | - /// <param name="aString">The string to be tested</param> |
1626 | - /// <param name="message">The message to display in case of failure</param> |
1627 | - public static void IsNullOrEmpty(string aString, string message) |
1628 | - { |
1629 | - Assert.That(aString, new NullOrEmptyStringConstraint() ,message, null); |
1630 | - } |
1631 | - /// <summary> |
1632 | - /// Assert that a string is either null or equal to string.Empty |
1633 | - /// </summary> |
1634 | - /// <param name="aString">The string to be tested</param> |
1635 | - public static void IsNullOrEmpty(string aString) |
1636 | - { |
1637 | - Assert.That(aString, new NullOrEmptyStringConstraint() ,null, null); |
1638 | - } |
1639 | -#endif |
1640 | - |
1641 | - #endregion |
1642 | - |
1643 | - #region IsNotNullOrEmpty |
1644 | - |
1645 | -#if !NUNITLITE |
1646 | - /// <summary> |
1647 | - /// Assert that a string is not null or empty |
1648 | - /// </summary> |
1649 | - /// <param name="aString">The string to be tested</param> |
1650 | - /// <param name="message">The message to display in case of failure</param> |
1651 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
1652 | - public static void IsNotNullOrEmpty(string aString, string message, params object[] args) |
1653 | - { |
1654 | - Assert.That(aString, new NotConstraint( new NullOrEmptyStringConstraint()) ,message, args); |
1655 | - } |
1656 | - /// <summary> |
1657 | - /// Assert that a string is not null or empty |
1658 | - /// </summary> |
1659 | - /// <param name="aString">The string to be tested</param> |
1660 | - /// <param name="message">The message to display in case of failure</param> |
1661 | - public static void IsNotNullOrEmpty(string aString, string message) |
1662 | - { |
1663 | - Assert.That(aString, new NotConstraint( new NullOrEmptyStringConstraint()) ,message, null); |
1664 | - } |
1665 | - /// <summary> |
1666 | - /// Assert that a string is not null or empty |
1667 | - /// </summary> |
1668 | - /// <param name="aString">The string to be tested</param> |
1669 | - public static void IsNotNullOrEmpty(string aString) |
1670 | - { |
1671 | - Assert.That(aString, new NotConstraint( new NullOrEmptyStringConstraint()) ,null, null); |
1672 | - } |
1673 | -#endif |
1674 | - |
1675 | - #endregion |
1676 | - |
1677 | - #region IsAssignableFrom |
1678 | - |
1679 | -#if !NUNITLITE |
1680 | - /// <summary> |
1681 | - /// Asserts that an object may be assigned a value of a given Type. |
1682 | - /// </summary> |
1683 | - /// <param name="expected">The expected Type.</param> |
1684 | - /// <param name="actual">The object under examination</param> |
1685 | - /// <param name="message">The message to display in case of failure</param> |
1686 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
1687 | - public static void IsAssignableFrom(Type expected, object actual, string message, params object[] args) |
1688 | - { |
1689 | - Assert.That(actual, Is.AssignableFrom(expected) ,message, args); |
1690 | - } |
1691 | - /// <summary> |
1692 | - /// Asserts that an object may be assigned a value of a given Type. |
1693 | - /// </summary> |
1694 | - /// <param name="expected">The expected Type.</param> |
1695 | - /// <param name="actual">The object under examination</param> |
1696 | - /// <param name="message">The message to display in case of failure</param> |
1697 | - public static void IsAssignableFrom(Type expected, object actual, string message) |
1698 | - { |
1699 | - Assert.That(actual, Is.AssignableFrom(expected) ,message, null); |
1700 | - } |
1701 | - /// <summary> |
1702 | - /// Asserts that an object may be assigned a value of a given Type. |
1703 | - /// </summary> |
1704 | - /// <param name="expected">The expected Type.</param> |
1705 | - /// <param name="actual">The object under examination</param> |
1706 | - public static void IsAssignableFrom(Type expected, object actual) |
1707 | - { |
1708 | - Assert.That(actual, Is.AssignableFrom(expected) ,null, null); |
1709 | - } |
1710 | -#endif |
1711 | - |
1712 | - #endregion |
1713 | - |
1714 | - #region IsAssignableFrom<T> |
1715 | - |
1716 | -#if !NUNITLITE |
1717 | -#if CLR_2_0 |
1718 | - /// <summary> |
1719 | - /// Asserts that an object may be assigned a value of a given Type. |
1720 | - /// </summary> |
1721 | - /// <typeparam name="T">The expected Type.</typeparam> |
1722 | - /// <param name="actual">The object under examination</param> |
1723 | - /// <param name="message">The message to display in case of failure</param> |
1724 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
1725 | - public static void IsAssignableFrom<T>(object actual, string message, params object[] args) |
1726 | - { |
1727 | - Assert.That(actual, Is.AssignableFrom(typeof(T)) ,message, args); |
1728 | - } |
1729 | - /// <summary> |
1730 | - /// Asserts that an object may be assigned a value of a given Type. |
1731 | - /// </summary> |
1732 | - /// <typeparam name="T">The expected Type.</typeparam> |
1733 | - /// <param name="actual">The object under examination</param> |
1734 | - /// <param name="message">The message to display in case of failure</param> |
1735 | - public static void IsAssignableFrom<T>(object actual, string message) |
1736 | - { |
1737 | - Assert.That(actual, Is.AssignableFrom(typeof(T)) ,message, null); |
1738 | - } |
1739 | - /// <summary> |
1740 | - /// Asserts that an object may be assigned a value of a given Type. |
1741 | - /// </summary> |
1742 | - /// <typeparam name="T">The expected Type.</typeparam> |
1743 | - /// <param name="actual">The object under examination</param> |
1744 | - public static void IsAssignableFrom<T>(object actual) |
1745 | - { |
1746 | - Assert.That(actual, Is.AssignableFrom(typeof(T)) ,null, null); |
1747 | - } |
1748 | -#endif |
1749 | -#endif |
1750 | - |
1751 | - #endregion |
1752 | - |
1753 | - #region IsNotAssignableFrom |
1754 | - |
1755 | -#if !NUNITLITE |
1756 | - /// <summary> |
1757 | - /// Asserts that an object may not be assigned a value of a given Type. |
1758 | - /// </summary> |
1759 | - /// <param name="expected">The expected Type.</param> |
1760 | - /// <param name="actual">The object under examination</param> |
1761 | - /// <param name="message">The message to display in case of failure</param> |
1762 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
1763 | - public static void IsNotAssignableFrom(Type expected, object actual, string message, params object[] args) |
1764 | - { |
1765 | - Assert.That(actual, Is.Not.AssignableFrom(expected) ,message, args); |
1766 | - } |
1767 | - /// <summary> |
1768 | - /// Asserts that an object may not be assigned a value of a given Type. |
1769 | - /// </summary> |
1770 | - /// <param name="expected">The expected Type.</param> |
1771 | - /// <param name="actual">The object under examination</param> |
1772 | - /// <param name="message">The message to display in case of failure</param> |
1773 | - public static void IsNotAssignableFrom(Type expected, object actual, string message) |
1774 | - { |
1775 | - Assert.That(actual, Is.Not.AssignableFrom(expected) ,message, null); |
1776 | - } |
1777 | - /// <summary> |
1778 | - /// Asserts that an object may not be assigned a value of a given Type. |
1779 | - /// </summary> |
1780 | - /// <param name="expected">The expected Type.</param> |
1781 | - /// <param name="actual">The object under examination</param> |
1782 | - public static void IsNotAssignableFrom(Type expected, object actual) |
1783 | - { |
1784 | - Assert.That(actual, Is.Not.AssignableFrom(expected) ,null, null); |
1785 | - } |
1786 | -#endif |
1787 | - |
1788 | - #endregion |
1789 | - |
1790 | - #region IsNotAssignableFrom<T> |
1791 | - |
1792 | -#if !NUNITLITE |
1793 | -#if CLR_2_0 |
1794 | - /// <summary> |
1795 | - /// Asserts that an object may not be assigned a value of a given Type. |
1796 | - /// </summary> |
1797 | - /// <typeparam name="T">The expected Type.</typeparam> |
1798 | - /// <param name="actual">The object under examination</param> |
1799 | - /// <param name="message">The message to display in case of failure</param> |
1800 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
1801 | - public static void IsNotAssignableFrom<T>(object actual, string message, params object[] args) |
1802 | - { |
1803 | - Assert.That(actual, Is.Not.AssignableFrom(typeof(T)) ,message, args); |
1804 | - } |
1805 | - /// <summary> |
1806 | - /// Asserts that an object may not be assigned a value of a given Type. |
1807 | - /// </summary> |
1808 | - /// <typeparam name="T">The expected Type.</typeparam> |
1809 | - /// <param name="actual">The object under examination</param> |
1810 | - /// <param name="message">The message to display in case of failure</param> |
1811 | - public static void IsNotAssignableFrom<T>(object actual, string message) |
1812 | - { |
1813 | - Assert.That(actual, Is.Not.AssignableFrom(typeof(T)) ,message, null); |
1814 | - } |
1815 | - /// <summary> |
1816 | - /// Asserts that an object may not be assigned a value of a given Type. |
1817 | - /// </summary> |
1818 | - /// <typeparam name="T">The expected Type.</typeparam> |
1819 | - /// <param name="actual">The object under examination</param> |
1820 | - public static void IsNotAssignableFrom<T>(object actual) |
1821 | - { |
1822 | - Assert.That(actual, Is.Not.AssignableFrom(typeof(T)) ,null, null); |
1823 | - } |
1824 | -#endif |
1825 | -#endif |
1826 | - |
1827 | - #endregion |
1828 | - |
1829 | - #region IsInstanceOf |
1830 | - |
1831 | -#if !NUNITLITE |
1832 | - /// <summary> |
1833 | - /// Asserts that an object is an instance of a given type. |
1834 | - /// </summary> |
1835 | - /// <param name="expected">The expected Type</param> |
1836 | - /// <param name="actual">The object being examined</param> |
1837 | - /// <param name="message">The message to display in case of failure</param> |
1838 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
1839 | - public static void IsInstanceOf(Type expected, object actual, string message, params object[] args) |
1840 | - { |
1841 | - Assert.That(actual, Is.InstanceOf(expected) ,message, args); |
1842 | - } |
1843 | - /// <summary> |
1844 | - /// Asserts that an object is an instance of a given type. |
1845 | - /// </summary> |
1846 | - /// <param name="expected">The expected Type</param> |
1847 | - /// <param name="actual">The object being examined</param> |
1848 | - /// <param name="message">The message to display in case of failure</param> |
1849 | - public static void IsInstanceOf(Type expected, object actual, string message) |
1850 | - { |
1851 | - Assert.That(actual, Is.InstanceOf(expected) ,message, null); |
1852 | - } |
1853 | - /// <summary> |
1854 | - /// Asserts that an object is an instance of a given type. |
1855 | - /// </summary> |
1856 | - /// <param name="expected">The expected Type</param> |
1857 | - /// <param name="actual">The object being examined</param> |
1858 | - public static void IsInstanceOf(Type expected, object actual) |
1859 | - { |
1860 | - Assert.That(actual, Is.InstanceOf(expected) ,null, null); |
1861 | - } |
1862 | - |
1863 | - /// <summary> |
1864 | - /// Asserts that an object is an instance of a given type. |
1865 | - /// </summary> |
1866 | - /// <param name="expected">The expected Type</param> |
1867 | - /// <param name="actual">The object being examined</param> |
1868 | - /// <param name="message">The message to display in case of failure</param> |
1869 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
1870 | - [Obsolete] |
1871 | - public static void IsInstanceOfType(Type expected, object actual, string message, params object[] args) |
1872 | - { |
1873 | - Assert.That(actual, Is.InstanceOf(expected) ,message, args); |
1874 | - } |
1875 | - /// <summary> |
1876 | - /// Asserts that an object is an instance of a given type. |
1877 | - /// </summary> |
1878 | - /// <param name="expected">The expected Type</param> |
1879 | - /// <param name="actual">The object being examined</param> |
1880 | - /// <param name="message">The message to display in case of failure</param> |
1881 | - [Obsolete] |
1882 | - public static void IsInstanceOfType(Type expected, object actual, string message) |
1883 | - { |
1884 | - Assert.That(actual, Is.InstanceOf(expected) ,message, null); |
1885 | - } |
1886 | - /// <summary> |
1887 | - /// Asserts that an object is an instance of a given type. |
1888 | - /// </summary> |
1889 | - /// <param name="expected">The expected Type</param> |
1890 | - /// <param name="actual">The object being examined</param> |
1891 | - [Obsolete] |
1892 | - public static void IsInstanceOfType(Type expected, object actual) |
1893 | - { |
1894 | - Assert.That(actual, Is.InstanceOf(expected) ,null, null); |
1895 | - } |
1896 | -#endif |
1897 | - |
1898 | - #endregion |
1899 | - |
1900 | - #region IsInstanceOf<T> |
1901 | - |
1902 | -#if !NUNITLITE |
1903 | -#if CLR_2_0 |
1904 | - /// <summary> |
1905 | - /// Asserts that an object is an instance of a given type. |
1906 | - /// </summary> |
1907 | - /// <typeparam name="T">The expected Type</typeparam> |
1908 | - /// <param name="actual">The object being examined</param> |
1909 | - /// <param name="message">The message to display in case of failure</param> |
1910 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
1911 | - public static void IsInstanceOf<T>(object actual, string message, params object[] args) |
1912 | - { |
1913 | - Assert.That(actual, Is.InstanceOf(typeof(T)) ,message, args); |
1914 | - } |
1915 | - /// <summary> |
1916 | - /// Asserts that an object is an instance of a given type. |
1917 | - /// </summary> |
1918 | - /// <typeparam name="T">The expected Type</typeparam> |
1919 | - /// <param name="actual">The object being examined</param> |
1920 | - /// <param name="message">The message to display in case of failure</param> |
1921 | - public static void IsInstanceOf<T>(object actual, string message) |
1922 | - { |
1923 | - Assert.That(actual, Is.InstanceOf(typeof(T)) ,message, null); |
1924 | - } |
1925 | - /// <summary> |
1926 | - /// Asserts that an object is an instance of a given type. |
1927 | - /// </summary> |
1928 | - /// <typeparam name="T">The expected Type</typeparam> |
1929 | - /// <param name="actual">The object being examined</param> |
1930 | - public static void IsInstanceOf<T>(object actual) |
1931 | - { |
1932 | - Assert.That(actual, Is.InstanceOf(typeof(T)) ,null, null); |
1933 | - } |
1934 | -#endif |
1935 | -#endif |
1936 | - |
1937 | - #endregion |
1938 | - |
1939 | - #region IsNotInstanceOf |
1940 | - |
1941 | -#if !NUNITLITE |
1942 | - /// <summary> |
1943 | - /// Asserts that an object is not an instance of a given type. |
1944 | - /// </summary> |
1945 | - /// <param name="expected">The expected Type</param> |
1946 | - /// <param name="actual">The object being examined</param> |
1947 | - /// <param name="message">The message to display in case of failure</param> |
1948 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
1949 | - public static void IsNotInstanceOf(Type expected, object actual, string message, params object[] args) |
1950 | - { |
1951 | - Assert.That(actual, Is.Not.InstanceOf(expected) ,message, args); |
1952 | - } |
1953 | - /// <summary> |
1954 | - /// Asserts that an object is not an instance of a given type. |
1955 | - /// </summary> |
1956 | - /// <param name="expected">The expected Type</param> |
1957 | - /// <param name="actual">The object being examined</param> |
1958 | - /// <param name="message">The message to display in case of failure</param> |
1959 | - public static void IsNotInstanceOf(Type expected, object actual, string message) |
1960 | - { |
1961 | - Assert.That(actual, Is.Not.InstanceOf(expected) ,message, null); |
1962 | - } |
1963 | - /// <summary> |
1964 | - /// Asserts that an object is not an instance of a given type. |
1965 | - /// </summary> |
1966 | - /// <param name="expected">The expected Type</param> |
1967 | - /// <param name="actual">The object being examined</param> |
1968 | - public static void IsNotInstanceOf(Type expected, object actual) |
1969 | - { |
1970 | - Assert.That(actual, Is.Not.InstanceOf(expected) ,null, null); |
1971 | - } |
1972 | - |
1973 | - /// <summary> |
1974 | - /// Asserts that an object is not an instance of a given type. |
1975 | - /// </summary> |
1976 | - /// <param name="expected">The expected Type</param> |
1977 | - /// <param name="actual">The object being examined</param> |
1978 | - /// <param name="message">The message to display in case of failure</param> |
1979 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
1980 | - [Obsolete] |
1981 | - public static void IsNotInstanceOfType(Type expected, object actual, string message, params object[] args) |
1982 | - { |
1983 | - Assert.That(actual, Is.Not.InstanceOf(expected) ,message, args); |
1984 | - } |
1985 | - /// <summary> |
1986 | - /// Asserts that an object is not an instance of a given type. |
1987 | - /// </summary> |
1988 | - /// <param name="expected">The expected Type</param> |
1989 | - /// <param name="actual">The object being examined</param> |
1990 | - /// <param name="message">The message to display in case of failure</param> |
1991 | - [Obsolete] |
1992 | - public static void IsNotInstanceOfType(Type expected, object actual, string message) |
1993 | - { |
1994 | - Assert.That(actual, Is.Not.InstanceOf(expected) ,message, null); |
1995 | - } |
1996 | - /// <summary> |
1997 | - /// Asserts that an object is not an instance of a given type. |
1998 | - /// </summary> |
1999 | - /// <param name="expected">The expected Type</param> |
2000 | - /// <param name="actual">The object being examined</param> |
2001 | - [Obsolete] |
2002 | - public static void IsNotInstanceOfType(Type expected, object actual) |
2003 | - { |
2004 | - Assert.That(actual, Is.Not.InstanceOf(expected) ,null, null); |
2005 | - } |
2006 | -#endif |
2007 | - |
2008 | - #endregion |
2009 | - |
2010 | - #region IsNotInstanceOf<T> |
2011 | - |
2012 | -#if !NUNITLITE |
2013 | -#if CLR_2_0 |
2014 | - /// <summary> |
2015 | - /// Asserts that an object is not an instance of a given type. |
2016 | - /// </summary> |
2017 | - /// <typeparam name="T">The expected Type</typeparam> |
2018 | - /// <param name="actual">The object being examined</param> |
2019 | - /// <param name="message">The message to display in case of failure</param> |
2020 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
2021 | - public static void IsNotInstanceOf<T>(object actual, string message, params object[] args) |
2022 | - { |
2023 | - Assert.That(actual, Is.Not.InstanceOf(typeof(T)) ,message, args); |
2024 | - } |
2025 | - /// <summary> |
2026 | - /// Asserts that an object is not an instance of a given type. |
2027 | - /// </summary> |
2028 | - /// <typeparam name="T">The expected Type</typeparam> |
2029 | - /// <param name="actual">The object being examined</param> |
2030 | - /// <param name="message">The message to display in case of failure</param> |
2031 | - public static void IsNotInstanceOf<T>(object actual, string message) |
2032 | - { |
2033 | - Assert.That(actual, Is.Not.InstanceOf(typeof(T)) ,message, null); |
2034 | - } |
2035 | - /// <summary> |
2036 | - /// Asserts that an object is not an instance of a given type. |
2037 | - /// </summary> |
2038 | - /// <typeparam name="T">The expected Type</typeparam> |
2039 | - /// <param name="actual">The object being examined</param> |
2040 | - public static void IsNotInstanceOf<T>(object actual) |
2041 | - { |
2042 | - Assert.That(actual, Is.Not.InstanceOf(typeof(T)) ,null, null); |
2043 | - } |
2044 | -#endif |
2045 | -#endif |
2046 | - |
2047 | - #endregion |
2048 | - |
2049 | - #region AreEqual |
2050 | - |
2051 | - /// <summary> |
2052 | - /// Verifies that two values are equal. If they are not, then an |
2053 | - /// <see cref="AssertionException"/> is thrown. |
2054 | - /// </summary> |
2055 | - /// <param name="expected">The expected value</param> |
2056 | - /// <param name="actual">The actual value</param> |
2057 | - /// <param name="message">The message to display in case of failure</param> |
2058 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
2059 | - public static void AreEqual(int expected, int actual, string message, params object[] args) |
2060 | - { |
2061 | - Assert.That(actual, Is.EqualTo(expected) ,message, args); |
2062 | - } |
2063 | - /// <summary> |
2064 | - /// Verifies that two values are equal. If they are not, then an |
2065 | - /// <see cref="AssertionException"/> is thrown. |
2066 | - /// </summary> |
2067 | - /// <param name="expected">The expected value</param> |
2068 | - /// <param name="actual">The actual value</param> |
2069 | - /// <param name="message">The message to display in case of failure</param> |
2070 | - public static void AreEqual(int expected, int actual, string message) |
2071 | - { |
2072 | - Assert.That(actual, Is.EqualTo(expected) ,message, null); |
2073 | - } |
2074 | - /// <summary> |
2075 | - /// Verifies that two values are equal. If they are not, then an |
2076 | - /// <see cref="AssertionException"/> is thrown. |
2077 | - /// </summary> |
2078 | - /// <param name="expected">The expected value</param> |
2079 | - /// <param name="actual">The actual value</param> |
2080 | - public static void AreEqual(int expected, int actual) |
2081 | - { |
2082 | - Assert.That(actual, Is.EqualTo(expected) ,null, null); |
2083 | - } |
2084 | - |
2085 | - /// <summary> |
2086 | - /// Verifies that two values are equal. If they are not, then an |
2087 | - /// <see cref="AssertionException"/> is thrown. |
2088 | - /// </summary> |
2089 | - /// <param name="expected">The expected value</param> |
2090 | - /// <param name="actual">The actual value</param> |
2091 | - /// <param name="message">The message to display in case of failure</param> |
2092 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
2093 | - public static void AreEqual(long expected, long actual, string message, params object[] args) |
2094 | - { |
2095 | - Assert.That(actual, Is.EqualTo(expected) ,message, args); |
2096 | - } |
2097 | - /// <summary> |
2098 | - /// Verifies that two values are equal. If they are not, then an |
2099 | - /// <see cref="AssertionException"/> is thrown. |
2100 | - /// </summary> |
2101 | - /// <param name="expected">The expected value</param> |
2102 | - /// <param name="actual">The actual value</param> |
2103 | - /// <param name="message">The message to display in case of failure</param> |
2104 | - public static void AreEqual(long expected, long actual, string message) |
2105 | - { |
2106 | - Assert.That(actual, Is.EqualTo(expected) ,message, null); |
2107 | - } |
2108 | - /// <summary> |
2109 | - /// Verifies that two values are equal. If they are not, then an |
2110 | - /// <see cref="AssertionException"/> is thrown. |
2111 | - /// </summary> |
2112 | - /// <param name="expected">The expected value</param> |
2113 | - /// <param name="actual">The actual value</param> |
2114 | - public static void AreEqual(long expected, long actual) |
2115 | - { |
2116 | - Assert.That(actual, Is.EqualTo(expected) ,null, null); |
2117 | - } |
2118 | - |
2119 | - /// <summary> |
2120 | - /// Verifies that two values are equal. If they are not, then an |
2121 | - /// <see cref="AssertionException"/> is thrown. |
2122 | - /// </summary> |
2123 | - /// <param name="expected">The expected value</param> |
2124 | - /// <param name="actual">The actual value</param> |
2125 | - /// <param name="message">The message to display in case of failure</param> |
2126 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
2127 | - [CLSCompliant(false)] |
2128 | - public static void AreEqual(uint expected, uint actual, string message, params object[] args) |
2129 | - { |
2130 | - Assert.That(actual, Is.EqualTo(expected) ,message, args); |
2131 | - } |
2132 | - /// <summary> |
2133 | - /// Verifies that two values are equal. If they are not, then an |
2134 | - /// <see cref="AssertionException"/> is thrown. |
2135 | - /// </summary> |
2136 | - /// <param name="expected">The expected value</param> |
2137 | - /// <param name="actual">The actual value</param> |
2138 | - /// <param name="message">The message to display in case of failure</param> |
2139 | - [CLSCompliant(false)] |
2140 | - public static void AreEqual(uint expected, uint actual, string message) |
2141 | - { |
2142 | - Assert.That(actual, Is.EqualTo(expected) ,message, null); |
2143 | - } |
2144 | - /// <summary> |
2145 | - /// Verifies that two values are equal. If they are not, then an |
2146 | - /// <see cref="AssertionException"/> is thrown. |
2147 | - /// </summary> |
2148 | - /// <param name="expected">The expected value</param> |
2149 | - /// <param name="actual">The actual value</param> |
2150 | - [CLSCompliant(false)] |
2151 | - public static void AreEqual(uint expected, uint actual) |
2152 | - { |
2153 | - Assert.That(actual, Is.EqualTo(expected) ,null, null); |
2154 | - } |
2155 | - |
2156 | - /// <summary> |
2157 | - /// Verifies that two values are equal. If they are not, then an |
2158 | - /// <see cref="AssertionException"/> is thrown. |
2159 | - /// </summary> |
2160 | - /// <param name="expected">The expected value</param> |
2161 | - /// <param name="actual">The actual value</param> |
2162 | - /// <param name="message">The message to display in case of failure</param> |
2163 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
2164 | - [CLSCompliant(false)] |
2165 | - public static void AreEqual(ulong expected, ulong actual, string message, params object[] args) |
2166 | - { |
2167 | - Assert.That(actual, Is.EqualTo(expected) ,message, args); |
2168 | - } |
2169 | - /// <summary> |
2170 | - /// Verifies that two values are equal. If they are not, then an |
2171 | - /// <see cref="AssertionException"/> is thrown. |
2172 | - /// </summary> |
2173 | - /// <param name="expected">The expected value</param> |
2174 | - /// <param name="actual">The actual value</param> |
2175 | - /// <param name="message">The message to display in case of failure</param> |
2176 | - [CLSCompliant(false)] |
2177 | - public static void AreEqual(ulong expected, ulong actual, string message) |
2178 | - { |
2179 | - Assert.That(actual, Is.EqualTo(expected) ,message, null); |
2180 | - } |
2181 | - /// <summary> |
2182 | - /// Verifies that two values are equal. If they are not, then an |
2183 | - /// <see cref="AssertionException"/> is thrown. |
2184 | - /// </summary> |
2185 | - /// <param name="expected">The expected value</param> |
2186 | - /// <param name="actual">The actual value</param> |
2187 | - [CLSCompliant(false)] |
2188 | - public static void AreEqual(ulong expected, ulong actual) |
2189 | - { |
2190 | - Assert.That(actual, Is.EqualTo(expected) ,null, null); |
2191 | - } |
2192 | - |
2193 | - /// <summary> |
2194 | - /// Verifies that two values are equal. If they are not, then an |
2195 | - /// <see cref="AssertionException"/> is thrown. |
2196 | - /// </summary> |
2197 | - /// <param name="expected">The expected value</param> |
2198 | - /// <param name="actual">The actual value</param> |
2199 | - /// <param name="message">The message to display in case of failure</param> |
2200 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
2201 | - public static void AreEqual(decimal expected, decimal actual, string message, params object[] args) |
2202 | - { |
2203 | - Assert.That(actual, Is.EqualTo(expected) ,message, args); |
2204 | - } |
2205 | - /// <summary> |
2206 | - /// Verifies that two values are equal. If they are not, then an |
2207 | - /// <see cref="AssertionException"/> is thrown. |
2208 | - /// </summary> |
2209 | - /// <param name="expected">The expected value</param> |
2210 | - /// <param name="actual">The actual value</param> |
2211 | - /// <param name="message">The message to display in case of failure</param> |
2212 | - public static void AreEqual(decimal expected, decimal actual, string message) |
2213 | - { |
2214 | - Assert.That(actual, Is.EqualTo(expected) ,message, null); |
2215 | - } |
2216 | - /// <summary> |
2217 | - /// Verifies that two values are equal. If they are not, then an |
2218 | - /// <see cref="AssertionException"/> is thrown. |
2219 | - /// </summary> |
2220 | - /// <param name="expected">The expected value</param> |
2221 | - /// <param name="actual">The actual value</param> |
2222 | - public static void AreEqual(decimal expected, decimal actual) |
2223 | - { |
2224 | - Assert.That(actual, Is.EqualTo(expected) ,null, null); |
2225 | - } |
2226 | - |
2227 | - #endregion |
2228 | - |
2229 | - #region AreEqual |
2230 | - |
2231 | - /// <summary> |
2232 | - /// Verifies that two doubles are equal considering a delta. If the |
2233 | - /// expected value is infinity then the delta value is ignored. If |
2234 | - /// they are not equal then an <see cref="AssertionException"/> is |
2235 | - /// thrown. |
2236 | - /// </summary> |
2237 | - /// <param name="expected">The expected value</param> |
2238 | - /// <param name="actual">The actual value</param> |
2239 | - /// <param name="delta">The maximum acceptable difference between the |
2240 | - /// the expected and the actual</param> |
2241 | - /// <param name="message">The message to display in case of failure</param> |
2242 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
2243 | - public static void AreEqual(double expected, double actual, double delta, string message, params object[] args) |
2244 | - { |
2245 | - AssertDoublesAreEqual(expected, actual, delta ,message, args); |
2246 | - } |
2247 | - /// <summary> |
2248 | - /// Verifies that two doubles are equal considering a delta. If the |
2249 | - /// expected value is infinity then the delta value is ignored. If |
2250 | - /// they are not equal then an <see cref="AssertionException"/> is |
2251 | - /// thrown. |
2252 | - /// </summary> |
2253 | - /// <param name="expected">The expected value</param> |
2254 | - /// <param name="actual">The actual value</param> |
2255 | - /// <param name="delta">The maximum acceptable difference between the |
2256 | - /// the expected and the actual</param> |
2257 | - /// <param name="message">The message to display in case of failure</param> |
2258 | - public static void AreEqual(double expected, double actual, double delta, string message) |
2259 | - { |
2260 | - AssertDoublesAreEqual(expected, actual, delta ,message, null); |
2261 | - } |
2262 | - /// <summary> |
2263 | - /// Verifies that two doubles are equal considering a delta. If the |
2264 | - /// expected value is infinity then the delta value is ignored. If |
2265 | - /// they are not equal then an <see cref="AssertionException"/> is |
2266 | - /// thrown. |
2267 | - /// </summary> |
2268 | - /// <param name="expected">The expected value</param> |
2269 | - /// <param name="actual">The actual value</param> |
2270 | - /// <param name="delta">The maximum acceptable difference between the |
2271 | - /// the expected and the actual</param> |
2272 | - public static void AreEqual(double expected, double actual, double delta) |
2273 | - { |
2274 | - AssertDoublesAreEqual(expected, actual, delta ,null, null); |
2275 | - } |
2276 | - |
2277 | -#if CLR_2_0 |
2278 | - /// <summary> |
2279 | - /// Verifies that two doubles are equal considering a delta. If the |
2280 | - /// expected value is infinity then the delta value is ignored. If |
2281 | - /// they are not equal then an <see cref="AssertionException"/> is |
2282 | - /// thrown. |
2283 | - /// </summary> |
2284 | - /// <param name="expected">The expected value</param> |
2285 | - /// <param name="actual">The actual value</param> |
2286 | - /// <param name="delta">The maximum acceptable difference between the |
2287 | - /// the expected and the actual</param> |
2288 | - /// <param name="message">The message to display in case of failure</param> |
2289 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
2290 | - public static void AreEqual(double expected, double? actual, double delta, string message, params object[] args) |
2291 | - { |
2292 | - AssertDoublesAreEqual(expected, (double)actual, delta ,message, args); |
2293 | - } |
2294 | - /// <summary> |
2295 | - /// Verifies that two doubles are equal considering a delta. If the |
2296 | - /// expected value is infinity then the delta value is ignored. If |
2297 | - /// they are not equal then an <see cref="AssertionException"/> is |
2298 | - /// thrown. |
2299 | - /// </summary> |
2300 | - /// <param name="expected">The expected value</param> |
2301 | - /// <param name="actual">The actual value</param> |
2302 | - /// <param name="delta">The maximum acceptable difference between the |
2303 | - /// the expected and the actual</param> |
2304 | - /// <param name="message">The message to display in case of failure</param> |
2305 | - public static void AreEqual(double expected, double? actual, double delta, string message) |
2306 | - { |
2307 | - AssertDoublesAreEqual(expected, (double)actual, delta ,message, null); |
2308 | - } |
2309 | - /// <summary> |
2310 | - /// Verifies that two doubles are equal considering a delta. If the |
2311 | - /// expected value is infinity then the delta value is ignored. If |
2312 | - /// they are not equal then an <see cref="AssertionException"/> is |
2313 | - /// thrown. |
2314 | - /// </summary> |
2315 | - /// <param name="expected">The expected value</param> |
2316 | - /// <param name="actual">The actual value</param> |
2317 | - /// <param name="delta">The maximum acceptable difference between the |
2318 | - /// the expected and the actual</param> |
2319 | - public static void AreEqual(double expected, double? actual, double delta) |
2320 | - { |
2321 | - AssertDoublesAreEqual(expected, (double)actual, delta ,null, null); |
2322 | - } |
2323 | -#endif |
2324 | - |
2325 | - #endregion |
2326 | - |
2327 | - #region AreEqual |
2328 | - |
2329 | - /// <summary> |
2330 | - /// Verifies that two objects are equal. Two objects are considered |
2331 | - /// equal if both are null, or if both have the same value. NUnit |
2332 | - /// has special semantics for some object types. |
2333 | - /// If they are not equal an <see cref="AssertionException"/> is thrown. |
2334 | - /// </summary> |
2335 | - /// <param name="expected">The value that is expected</param> |
2336 | - /// <param name="actual">The actual value</param> |
2337 | - /// <param name="message">The message to display in case of failure</param> |
2338 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
2339 | - public static void AreEqual(object expected, object actual, string message, params object[] args) |
2340 | - { |
2341 | - Assert.That(actual, Is.EqualTo(expected) ,message, args); |
2342 | - } |
2343 | - /// <summary> |
2344 | - /// Verifies that two objects are equal. Two objects are considered |
2345 | - /// equal if both are null, or if both have the same value. NUnit |
2346 | - /// has special semantics for some object types. |
2347 | - /// If they are not equal an <see cref="AssertionException"/> is thrown. |
2348 | - /// </summary> |
2349 | - /// <param name="expected">The value that is expected</param> |
2350 | - /// <param name="actual">The actual value</param> |
2351 | - /// <param name="message">The message to display in case of failure</param> |
2352 | - public static void AreEqual(object expected, object actual, string message) |
2353 | - { |
2354 | - Assert.That(actual, Is.EqualTo(expected) ,message, null); |
2355 | - } |
2356 | - /// <summary> |
2357 | - /// Verifies that two objects are equal. Two objects are considered |
2358 | - /// equal if both are null, or if both have the same value. NUnit |
2359 | - /// has special semantics for some object types. |
2360 | - /// If they are not equal an <see cref="AssertionException"/> is thrown. |
2361 | - /// </summary> |
2362 | - /// <param name="expected">The value that is expected</param> |
2363 | - /// <param name="actual">The actual value</param> |
2364 | - public static void AreEqual(object expected, object actual) |
2365 | - { |
2366 | - Assert.That(actual, Is.EqualTo(expected) ,null, null); |
2367 | - } |
2368 | - |
2369 | - #endregion |
2370 | - |
2371 | - #region AreNotEqual |
2372 | - |
2373 | - /// <summary> |
2374 | - /// Verifies that two values are not equal. If they are equal, then an |
2375 | - /// <see cref="AssertionException"/> is thrown. |
2376 | - /// </summary> |
2377 | - /// <param name="expected">The expected value</param> |
2378 | - /// <param name="actual">The actual value</param> |
2379 | - /// <param name="message">The message to display in case of failure</param> |
2380 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
2381 | - public static void AreNotEqual(int expected, int actual, string message, params object[] args) |
2382 | - { |
2383 | - Assert.That(actual, Is.Not.EqualTo(expected) ,message, args); |
2384 | - } |
2385 | - /// <summary> |
2386 | - /// Verifies that two values are not equal. If they are equal, then an |
2387 | - /// <see cref="AssertionException"/> is thrown. |
2388 | - /// </summary> |
2389 | - /// <param name="expected">The expected value</param> |
2390 | - /// <param name="actual">The actual value</param> |
2391 | - /// <param name="message">The message to display in case of failure</param> |
2392 | - public static void AreNotEqual(int expected, int actual, string message) |
2393 | - { |
2394 | - Assert.That(actual, Is.Not.EqualTo(expected) ,message, null); |
2395 | - } |
2396 | - /// <summary> |
2397 | - /// Verifies that two values are not equal. If they are equal, then an |
2398 | - /// <see cref="AssertionException"/> is thrown. |
2399 | - /// </summary> |
2400 | - /// <param name="expected">The expected value</param> |
2401 | - /// <param name="actual">The actual value</param> |
2402 | - public static void AreNotEqual(int expected, int actual) |
2403 | - { |
2404 | - Assert.That(actual, Is.Not.EqualTo(expected) ,null, null); |
2405 | - } |
2406 | - |
2407 | - /// <summary> |
2408 | - /// Verifies that two values are not equal. If they are equal, then an |
2409 | - /// <see cref="AssertionException"/> is thrown. |
2410 | - /// </summary> |
2411 | - /// <param name="expected">The expected value</param> |
2412 | - /// <param name="actual">The actual value</param> |
2413 | - /// <param name="message">The message to display in case of failure</param> |
2414 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
2415 | - public static void AreNotEqual(long expected, long actual, string message, params object[] args) |
2416 | - { |
2417 | - Assert.That(actual, Is.Not.EqualTo(expected) ,message, args); |
2418 | - } |
2419 | - /// <summary> |
2420 | - /// Verifies that two values are not equal. If they are equal, then an |
2421 | - /// <see cref="AssertionException"/> is thrown. |
2422 | - /// </summary> |
2423 | - /// <param name="expected">The expected value</param> |
2424 | - /// <param name="actual">The actual value</param> |
2425 | - /// <param name="message">The message to display in case of failure</param> |
2426 | - public static void AreNotEqual(long expected, long actual, string message) |
2427 | - { |
2428 | - Assert.That(actual, Is.Not.EqualTo(expected) ,message, null); |
2429 | - } |
2430 | - /// <summary> |
2431 | - /// Verifies that two values are not equal. If they are equal, then an |
2432 | - /// <see cref="AssertionException"/> is thrown. |
2433 | - /// </summary> |
2434 | - /// <param name="expected">The expected value</param> |
2435 | - /// <param name="actual">The actual value</param> |
2436 | - public static void AreNotEqual(long expected, long actual) |
2437 | - { |
2438 | - Assert.That(actual, Is.Not.EqualTo(expected) ,null, null); |
2439 | - } |
2440 | - |
2441 | - /// <summary> |
2442 | - /// Verifies that two values are not equal. If they are equal, then an |
2443 | - /// <see cref="AssertionException"/> is thrown. |
2444 | - /// </summary> |
2445 | - /// <param name="expected">The expected value</param> |
2446 | - /// <param name="actual">The actual value</param> |
2447 | - /// <param name="message">The message to display in case of failure</param> |
2448 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
2449 | - [CLSCompliant(false)] |
2450 | - public static void AreNotEqual(uint expected, uint actual, string message, params object[] args) |
2451 | - { |
2452 | - Assert.That(actual, Is.Not.EqualTo(expected) ,message, args); |
2453 | - } |
2454 | - /// <summary> |
2455 | - /// Verifies that two values are not equal. If they are equal, then an |
2456 | - /// <see cref="AssertionException"/> is thrown. |
2457 | - /// </summary> |
2458 | - /// <param name="expected">The expected value</param> |
2459 | - /// <param name="actual">The actual value</param> |
2460 | - /// <param name="message">The message to display in case of failure</param> |
2461 | - [CLSCompliant(false)] |
2462 | - public static void AreNotEqual(uint expected, uint actual, string message) |
2463 | - { |
2464 | - Assert.That(actual, Is.Not.EqualTo(expected) ,message, null); |
2465 | - } |
2466 | - /// <summary> |
2467 | - /// Verifies that two values are not equal. If they are equal, then an |
2468 | - /// <see cref="AssertionException"/> is thrown. |
2469 | - /// </summary> |
2470 | - /// <param name="expected">The expected value</param> |
2471 | - /// <param name="actual">The actual value</param> |
2472 | - [CLSCompliant(false)] |
2473 | - public static void AreNotEqual(uint expected, uint actual) |
2474 | - { |
2475 | - Assert.That(actual, Is.Not.EqualTo(expected) ,null, null); |
2476 | - } |
2477 | - |
2478 | - /// <summary> |
2479 | - /// Verifies that two values are not equal. If they are equal, then an |
2480 | - /// <see cref="AssertionException"/> is thrown. |
2481 | - /// </summary> |
2482 | - /// <param name="expected">The expected value</param> |
2483 | - /// <param name="actual">The actual value</param> |
2484 | - /// <param name="message">The message to display in case of failure</param> |
2485 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
2486 | - [CLSCompliant(false)] |
2487 | - public static void AreNotEqual(ulong expected, ulong actual, string message, params object[] args) |
2488 | - { |
2489 | - Assert.That(actual, Is.Not.EqualTo(expected) ,message, args); |
2490 | - } |
2491 | - /// <summary> |
2492 | - /// Verifies that two values are not equal. If they are equal, then an |
2493 | - /// <see cref="AssertionException"/> is thrown. |
2494 | - /// </summary> |
2495 | - /// <param name="expected">The expected value</param> |
2496 | - /// <param name="actual">The actual value</param> |
2497 | - /// <param name="message">The message to display in case of failure</param> |
2498 | - [CLSCompliant(false)] |
2499 | - public static void AreNotEqual(ulong expected, ulong actual, string message) |
2500 | - { |
2501 | - Assert.That(actual, Is.Not.EqualTo(expected) ,message, null); |
2502 | - } |
2503 | - /// <summary> |
2504 | - /// Verifies that two values are not equal. If they are equal, then an |
2505 | - /// <see cref="AssertionException"/> is thrown. |
2506 | - /// </summary> |
2507 | - /// <param name="expected">The expected value</param> |
2508 | - /// <param name="actual">The actual value</param> |
2509 | - [CLSCompliant(false)] |
2510 | - public static void AreNotEqual(ulong expected, ulong actual) |
2511 | - { |
2512 | - Assert.That(actual, Is.Not.EqualTo(expected) ,null, null); |
2513 | - } |
2514 | - |
2515 | - /// <summary> |
2516 | - /// Verifies that two values are not equal. If they are equal, then an |
2517 | - /// <see cref="AssertionException"/> is thrown. |
2518 | - /// </summary> |
2519 | - /// <param name="expected">The expected value</param> |
2520 | - /// <param name="actual">The actual value</param> |
2521 | - /// <param name="message">The message to display in case of failure</param> |
2522 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
2523 | - public static void AreNotEqual(decimal expected, decimal actual, string message, params object[] args) |
2524 | - { |
2525 | - Assert.That(actual, Is.Not.EqualTo(expected) ,message, args); |
2526 | - } |
2527 | - /// <summary> |
2528 | - /// Verifies that two values are not equal. If they are equal, then an |
2529 | - /// <see cref="AssertionException"/> is thrown. |
2530 | - /// </summary> |
2531 | - /// <param name="expected">The expected value</param> |
2532 | - /// <param name="actual">The actual value</param> |
2533 | - /// <param name="message">The message to display in case of failure</param> |
2534 | - public static void AreNotEqual(decimal expected, decimal actual, string message) |
2535 | - { |
2536 | - Assert.That(actual, Is.Not.EqualTo(expected) ,message, null); |
2537 | - } |
2538 | - /// <summary> |
2539 | - /// Verifies that two values are not equal. If they are equal, then an |
2540 | - /// <see cref="AssertionException"/> is thrown. |
2541 | - /// </summary> |
2542 | - /// <param name="expected">The expected value</param> |
2543 | - /// <param name="actual">The actual value</param> |
2544 | - public static void AreNotEqual(decimal expected, decimal actual) |
2545 | - { |
2546 | - Assert.That(actual, Is.Not.EqualTo(expected) ,null, null); |
2547 | - } |
2548 | - |
2549 | - /// <summary> |
2550 | - /// Verifies that two values are not equal. If they are equal, then an |
2551 | - /// <see cref="AssertionException"/> is thrown. |
2552 | - /// </summary> |
2553 | - /// <param name="expected">The expected value</param> |
2554 | - /// <param name="actual">The actual value</param> |
2555 | - /// <param name="message">The message to display in case of failure</param> |
2556 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
2557 | - public static void AreNotEqual(float expected, float actual, string message, params object[] args) |
2558 | - { |
2559 | - Assert.That(actual, Is.Not.EqualTo(expected) ,message, args); |
2560 | - } |
2561 | - /// <summary> |
2562 | - /// Verifies that two values are not equal. If they are equal, then an |
2563 | - /// <see cref="AssertionException"/> is thrown. |
2564 | - /// </summary> |
2565 | - /// <param name="expected">The expected value</param> |
2566 | - /// <param name="actual">The actual value</param> |
2567 | - /// <param name="message">The message to display in case of failure</param> |
2568 | - public static void AreNotEqual(float expected, float actual, string message) |
2569 | - { |
2570 | - Assert.That(actual, Is.Not.EqualTo(expected) ,message, null); |
2571 | - } |
2572 | - /// <summary> |
2573 | - /// Verifies that two values are not equal. If they are equal, then an |
2574 | - /// <see cref="AssertionException"/> is thrown. |
2575 | - /// </summary> |
2576 | - /// <param name="expected">The expected value</param> |
2577 | - /// <param name="actual">The actual value</param> |
2578 | - public static void AreNotEqual(float expected, float actual) |
2579 | - { |
2580 | - Assert.That(actual, Is.Not.EqualTo(expected) ,null, null); |
2581 | - } |
2582 | - |
2583 | - /// <summary> |
2584 | - /// Verifies that two values are not equal. If they are equal, then an |
2585 | - /// <see cref="AssertionException"/> is thrown. |
2586 | - /// </summary> |
2587 | - /// <param name="expected">The expected value</param> |
2588 | - /// <param name="actual">The actual value</param> |
2589 | - /// <param name="message">The message to display in case of failure</param> |
2590 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
2591 | - public static void AreNotEqual(double expected, double actual, string message, params object[] args) |
2592 | - { |
2593 | - Assert.That(actual, Is.Not.EqualTo(expected) ,message, args); |
2594 | - } |
2595 | - /// <summary> |
2596 | - /// Verifies that two values are not equal. If they are equal, then an |
2597 | - /// <see cref="AssertionException"/> is thrown. |
2598 | - /// </summary> |
2599 | - /// <param name="expected">The expected value</param> |
2600 | - /// <param name="actual">The actual value</param> |
2601 | - /// <param name="message">The message to display in case of failure</param> |
2602 | - public static void AreNotEqual(double expected, double actual, string message) |
2603 | - { |
2604 | - Assert.That(actual, Is.Not.EqualTo(expected) ,message, null); |
2605 | - } |
2606 | - /// <summary> |
2607 | - /// Verifies that two values are not equal. If they are equal, then an |
2608 | - /// <see cref="AssertionException"/> is thrown. |
2609 | - /// </summary> |
2610 | - /// <param name="expected">The expected value</param> |
2611 | - /// <param name="actual">The actual value</param> |
2612 | - public static void AreNotEqual(double expected, double actual) |
2613 | - { |
2614 | - Assert.That(actual, Is.Not.EqualTo(expected) ,null, null); |
2615 | - } |
2616 | - |
2617 | - #endregion |
2618 | - |
2619 | - #region AreNotEqual |
2620 | - |
2621 | - /// <summary> |
2622 | - /// Verifies that two objects are not equal. Two objects are considered |
2623 | - /// equal if both are null, or if both have the same value. NUnit |
2624 | - /// has special semantics for some object types. |
2625 | - /// If they are equal an <see cref="AssertionException"/> is thrown. |
2626 | - /// </summary> |
2627 | - /// <param name="expected">The value that is expected</param> |
2628 | - /// <param name="actual">The actual value</param> |
2629 | - /// <param name="message">The message to display in case of failure</param> |
2630 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
2631 | - public static void AreNotEqual(object expected, object actual, string message, params object[] args) |
2632 | - { |
2633 | - Assert.That(actual, Is.Not.EqualTo(expected) ,message, args); |
2634 | - } |
2635 | - /// <summary> |
2636 | - /// Verifies that two objects are not equal. Two objects are considered |
2637 | - /// equal if both are null, or if both have the same value. NUnit |
2638 | - /// has special semantics for some object types. |
2639 | - /// If they are equal an <see cref="AssertionException"/> is thrown. |
2640 | - /// </summary> |
2641 | - /// <param name="expected">The value that is expected</param> |
2642 | - /// <param name="actual">The actual value</param> |
2643 | - /// <param name="message">The message to display in case of failure</param> |
2644 | - public static void AreNotEqual(object expected, object actual, string message) |
2645 | - { |
2646 | - Assert.That(actual, Is.Not.EqualTo(expected) ,message, null); |
2647 | - } |
2648 | - /// <summary> |
2649 | - /// Verifies that two objects are not equal. Two objects are considered |
2650 | - /// equal if both are null, or if both have the same value. NUnit |
2651 | - /// has special semantics for some object types. |
2652 | - /// If they are equal an <see cref="AssertionException"/> is thrown. |
2653 | - /// </summary> |
2654 | - /// <param name="expected">The value that is expected</param> |
2655 | - /// <param name="actual">The actual value</param> |
2656 | - public static void AreNotEqual(object expected, object actual) |
2657 | - { |
2658 | - Assert.That(actual, Is.Not.EqualTo(expected) ,null, null); |
2659 | - } |
2660 | - |
2661 | - #endregion |
2662 | - |
2663 | - #region AreSame |
2664 | - |
2665 | - /// <summary> |
2666 | - /// Asserts that two objects refer to the same object. If they |
2667 | - /// are not the same an <see cref="AssertionException"/> is thrown. |
2668 | - /// </summary> |
2669 | - /// <param name="expected">The expected object</param> |
2670 | - /// <param name="actual">The actual object</param> |
2671 | - /// <param name="message">The message to display in case of failure</param> |
2672 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
2673 | - public static void AreSame(object expected, object actual, string message, params object[] args) |
2674 | - { |
2675 | - Assert.That(actual, Is.SameAs(expected) ,message, args); |
2676 | - } |
2677 | - /// <summary> |
2678 | - /// Asserts that two objects refer to the same object. If they |
2679 | - /// are not the same an <see cref="AssertionException"/> is thrown. |
2680 | - /// </summary> |
2681 | - /// <param name="expected">The expected object</param> |
2682 | - /// <param name="actual">The actual object</param> |
2683 | - /// <param name="message">The message to display in case of failure</param> |
2684 | - public static void AreSame(object expected, object actual, string message) |
2685 | - { |
2686 | - Assert.That(actual, Is.SameAs(expected) ,message, null); |
2687 | - } |
2688 | - /// <summary> |
2689 | - /// Asserts that two objects refer to the same object. If they |
2690 | - /// are not the same an <see cref="AssertionException"/> is thrown. |
2691 | - /// </summary> |
2692 | - /// <param name="expected">The expected object</param> |
2693 | - /// <param name="actual">The actual object</param> |
2694 | - public static void AreSame(object expected, object actual) |
2695 | - { |
2696 | - Assert.That(actual, Is.SameAs(expected) ,null, null); |
2697 | - } |
2698 | - |
2699 | - #endregion |
2700 | - |
2701 | - #region AreNotSame |
2702 | - |
2703 | - /// <summary> |
2704 | - /// Asserts that two objects do not refer to the same object. If they |
2705 | - /// are the same an <see cref="AssertionException"/> is thrown. |
2706 | - /// </summary> |
2707 | - /// <param name="expected">The expected object</param> |
2708 | - /// <param name="actual">The actual object</param> |
2709 | - /// <param name="message">The message to display in case of failure</param> |
2710 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
2711 | - public static void AreNotSame(object expected, object actual, string message, params object[] args) |
2712 | - { |
2713 | - Assert.That(actual, Is.Not.SameAs(expected) ,message, args); |
2714 | - } |
2715 | - /// <summary> |
2716 | - /// Asserts that two objects do not refer to the same object. If they |
2717 | - /// are the same an <see cref="AssertionException"/> is thrown. |
2718 | - /// </summary> |
2719 | - /// <param name="expected">The expected object</param> |
2720 | - /// <param name="actual">The actual object</param> |
2721 | - /// <param name="message">The message to display in case of failure</param> |
2722 | - public static void AreNotSame(object expected, object actual, string message) |
2723 | - { |
2724 | - Assert.That(actual, Is.Not.SameAs(expected) ,message, null); |
2725 | - } |
2726 | - /// <summary> |
2727 | - /// Asserts that two objects do not refer to the same object. If they |
2728 | - /// are the same an <see cref="AssertionException"/> is thrown. |
2729 | - /// </summary> |
2730 | - /// <param name="expected">The expected object</param> |
2731 | - /// <param name="actual">The actual object</param> |
2732 | - public static void AreNotSame(object expected, object actual) |
2733 | - { |
2734 | - Assert.That(actual, Is.Not.SameAs(expected) ,null, null); |
2735 | - } |
2736 | - |
2737 | - #endregion |
2738 | - |
2739 | - #region Greater |
2740 | - |
2741 | -#if !NUNITLITE |
2742 | - /// <summary> |
2743 | - /// Verifies that the first value is greater than the second |
2744 | - /// value. If it is not, then an |
2745 | - /// <see cref="AssertionException"/> is thrown. |
2746 | - /// </summary> |
2747 | - /// <param name="arg1">The first value, expected to be greater</param> |
2748 | - /// <param name="arg2">The second value, expected to be less</param> |
2749 | - /// <param name="message">The message to display in case of failure</param> |
2750 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
2751 | - public static void Greater(int arg1, int arg2, string message, params object[] args) |
2752 | - { |
2753 | - Assert.That(arg1, Is.GreaterThan(arg2) ,message, args); |
2754 | - } |
2755 | - /// <summary> |
2756 | - /// Verifies that the first value is greater than the second |
2757 | - /// value. If it is not, then an |
2758 | - /// <see cref="AssertionException"/> is thrown. |
2759 | - /// </summary> |
2760 | - /// <param name="arg1">The first value, expected to be greater</param> |
2761 | - /// <param name="arg2">The second value, expected to be less</param> |
2762 | - /// <param name="message">The message to display in case of failure</param> |
2763 | - public static void Greater(int arg1, int arg2, string message) |
2764 | - { |
2765 | - Assert.That(arg1, Is.GreaterThan(arg2) ,message, null); |
2766 | - } |
2767 | - /// <summary> |
2768 | - /// Verifies that the first value is greater than the second |
2769 | - /// value. If it is not, then an |
2770 | - /// <see cref="AssertionException"/> is thrown. |
2771 | - /// </summary> |
2772 | - /// <param name="arg1">The first value, expected to be greater</param> |
2773 | - /// <param name="arg2">The second value, expected to be less</param> |
2774 | - public static void Greater(int arg1, int arg2) |
2775 | - { |
2776 | - Assert.That(arg1, Is.GreaterThan(arg2) ,null, null); |
2777 | - } |
2778 | - |
2779 | - /// <summary> |
2780 | - /// Verifies that the first value is greater than the second |
2781 | - /// value. If it is not, then an |
2782 | - /// <see cref="AssertionException"/> is thrown. |
2783 | - /// </summary> |
2784 | - /// <param name="arg1">The first value, expected to be greater</param> |
2785 | - /// <param name="arg2">The second value, expected to be less</param> |
2786 | - /// <param name="message">The message to display in case of failure</param> |
2787 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
2788 | - [CLSCompliant(false)] |
2789 | - public static void Greater(uint arg1, uint arg2, string message, params object[] args) |
2790 | - { |
2791 | - Assert.That(arg1, Is.GreaterThan(arg2) ,message, args); |
2792 | - } |
2793 | - /// <summary> |
2794 | - /// Verifies that the first value is greater than the second |
2795 | - /// value. If it is not, then an |
2796 | - /// <see cref="AssertionException"/> is thrown. |
2797 | - /// </summary> |
2798 | - /// <param name="arg1">The first value, expected to be greater</param> |
2799 | - /// <param name="arg2">The second value, expected to be less</param> |
2800 | - /// <param name="message">The message to display in case of failure</param> |
2801 | - [CLSCompliant(false)] |
2802 | - public static void Greater(uint arg1, uint arg2, string message) |
2803 | - { |
2804 | - Assert.That(arg1, Is.GreaterThan(arg2) ,message, null); |
2805 | - } |
2806 | - /// <summary> |
2807 | - /// Verifies that the first value is greater than the second |
2808 | - /// value. If it is not, then an |
2809 | - /// <see cref="AssertionException"/> is thrown. |
2810 | - /// </summary> |
2811 | - /// <param name="arg1">The first value, expected to be greater</param> |
2812 | - /// <param name="arg2">The second value, expected to be less</param> |
2813 | - [CLSCompliant(false)] |
2814 | - public static void Greater(uint arg1, uint arg2) |
2815 | - { |
2816 | - Assert.That(arg1, Is.GreaterThan(arg2) ,null, null); |
2817 | - } |
2818 | - |
2819 | - /// <summary> |
2820 | - /// Verifies that the first value is greater than the second |
2821 | - /// value. If it is not, then an |
2822 | - /// <see cref="AssertionException"/> is thrown. |
2823 | - /// </summary> |
2824 | - /// <param name="arg1">The first value, expected to be greater</param> |
2825 | - /// <param name="arg2">The second value, expected to be less</param> |
2826 | - /// <param name="message">The message to display in case of failure</param> |
2827 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
2828 | - public static void Greater(long arg1, long arg2, string message, params object[] args) |
2829 | - { |
2830 | - Assert.That(arg1, Is.GreaterThan(arg2) ,message, args); |
2831 | - } |
2832 | - /// <summary> |
2833 | - /// Verifies that the first value is greater than the second |
2834 | - /// value. If it is not, then an |
2835 | - /// <see cref="AssertionException"/> is thrown. |
2836 | - /// </summary> |
2837 | - /// <param name="arg1">The first value, expected to be greater</param> |
2838 | - /// <param name="arg2">The second value, expected to be less</param> |
2839 | - /// <param name="message">The message to display in case of failure</param> |
2840 | - public static void Greater(long arg1, long arg2, string message) |
2841 | - { |
2842 | - Assert.That(arg1, Is.GreaterThan(arg2) ,message, null); |
2843 | - } |
2844 | - /// <summary> |
2845 | - /// Verifies that the first value is greater than the second |
2846 | - /// value. If it is not, then an |
2847 | - /// <see cref="AssertionException"/> is thrown. |
2848 | - /// </summary> |
2849 | - /// <param name="arg1">The first value, expected to be greater</param> |
2850 | - /// <param name="arg2">The second value, expected to be less</param> |
2851 | - public static void Greater(long arg1, long arg2) |
2852 | - { |
2853 | - Assert.That(arg1, Is.GreaterThan(arg2) ,null, null); |
2854 | - } |
2855 | - |
2856 | - /// <summary> |
2857 | - /// Verifies that the first value is greater than the second |
2858 | - /// value. If it is not, then an |
2859 | - /// <see cref="AssertionException"/> is thrown. |
2860 | - /// </summary> |
2861 | - /// <param name="arg1">The first value, expected to be greater</param> |
2862 | - /// <param name="arg2">The second value, expected to be less</param> |
2863 | - /// <param name="message">The message to display in case of failure</param> |
2864 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
2865 | - [CLSCompliant(false)] |
2866 | - public static void Greater(ulong arg1, ulong arg2, string message, params object[] args) |
2867 | - { |
2868 | - Assert.That(arg1, Is.GreaterThan(arg2) ,message, args); |
2869 | - } |
2870 | - /// <summary> |
2871 | - /// Verifies that the first value is greater than the second |
2872 | - /// value. If it is not, then an |
2873 | - /// <see cref="AssertionException"/> is thrown. |
2874 | - /// </summary> |
2875 | - /// <param name="arg1">The first value, expected to be greater</param> |
2876 | - /// <param name="arg2">The second value, expected to be less</param> |
2877 | - /// <param name="message">The message to display in case of failure</param> |
2878 | - [CLSCompliant(false)] |
2879 | - public static void Greater(ulong arg1, ulong arg2, string message) |
2880 | - { |
2881 | - Assert.That(arg1, Is.GreaterThan(arg2) ,message, null); |
2882 | - } |
2883 | - /// <summary> |
2884 | - /// Verifies that the first value is greater than the second |
2885 | - /// value. If it is not, then an |
2886 | - /// <see cref="AssertionException"/> is thrown. |
2887 | - /// </summary> |
2888 | - /// <param name="arg1">The first value, expected to be greater</param> |
2889 | - /// <param name="arg2">The second value, expected to be less</param> |
2890 | - [CLSCompliant(false)] |
2891 | - public static void Greater(ulong arg1, ulong arg2) |
2892 | - { |
2893 | - Assert.That(arg1, Is.GreaterThan(arg2) ,null, null); |
2894 | - } |
2895 | - |
2896 | - /// <summary> |
2897 | - /// Verifies that the first value is greater than the second |
2898 | - /// value. If it is not, then an |
2899 | - /// <see cref="AssertionException"/> is thrown. |
2900 | - /// </summary> |
2901 | - /// <param name="arg1">The first value, expected to be greater</param> |
2902 | - /// <param name="arg2">The second value, expected to be less</param> |
2903 | - /// <param name="message">The message to display in case of failure</param> |
2904 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
2905 | - public static void Greater(decimal arg1, decimal arg2, string message, params object[] args) |
2906 | - { |
2907 | - Assert.That(arg1, Is.GreaterThan(arg2) ,message, args); |
2908 | - } |
2909 | - /// <summary> |
2910 | - /// Verifies that the first value is greater than the second |
2911 | - /// value. If it is not, then an |
2912 | - /// <see cref="AssertionException"/> is thrown. |
2913 | - /// </summary> |
2914 | - /// <param name="arg1">The first value, expected to be greater</param> |
2915 | - /// <param name="arg2">The second value, expected to be less</param> |
2916 | - /// <param name="message">The message to display in case of failure</param> |
2917 | - public static void Greater(decimal arg1, decimal arg2, string message) |
2918 | - { |
2919 | - Assert.That(arg1, Is.GreaterThan(arg2) ,message, null); |
2920 | - } |
2921 | - /// <summary> |
2922 | - /// Verifies that the first value is greater than the second |
2923 | - /// value. If it is not, then an |
2924 | - /// <see cref="AssertionException"/> is thrown. |
2925 | - /// </summary> |
2926 | - /// <param name="arg1">The first value, expected to be greater</param> |
2927 | - /// <param name="arg2">The second value, expected to be less</param> |
2928 | - public static void Greater(decimal arg1, decimal arg2) |
2929 | - { |
2930 | - Assert.That(arg1, Is.GreaterThan(arg2) ,null, null); |
2931 | - } |
2932 | - |
2933 | - /// <summary> |
2934 | - /// Verifies that the first value is greater than the second |
2935 | - /// value. If it is not, then an |
2936 | - /// <see cref="AssertionException"/> is thrown. |
2937 | - /// </summary> |
2938 | - /// <param name="arg1">The first value, expected to be greater</param> |
2939 | - /// <param name="arg2">The second value, expected to be less</param> |
2940 | - /// <param name="message">The message to display in case of failure</param> |
2941 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
2942 | - public static void Greater(double arg1, double arg2, string message, params object[] args) |
2943 | - { |
2944 | - Assert.That(arg1, Is.GreaterThan(arg2) ,message, args); |
2945 | - } |
2946 | - /// <summary> |
2947 | - /// Verifies that the first value is greater than the second |
2948 | - /// value. If it is not, then an |
2949 | - /// <see cref="AssertionException"/> is thrown. |
2950 | - /// </summary> |
2951 | - /// <param name="arg1">The first value, expected to be greater</param> |
2952 | - /// <param name="arg2">The second value, expected to be less</param> |
2953 | - /// <param name="message">The message to display in case of failure</param> |
2954 | - public static void Greater(double arg1, double arg2, string message) |
2955 | - { |
2956 | - Assert.That(arg1, Is.GreaterThan(arg2) ,message, null); |
2957 | - } |
2958 | - /// <summary> |
2959 | - /// Verifies that the first value is greater than the second |
2960 | - /// value. If it is not, then an |
2961 | - /// <see cref="AssertionException"/> is thrown. |
2962 | - /// </summary> |
2963 | - /// <param name="arg1">The first value, expected to be greater</param> |
2964 | - /// <param name="arg2">The second value, expected to be less</param> |
2965 | - public static void Greater(double arg1, double arg2) |
2966 | - { |
2967 | - Assert.That(arg1, Is.GreaterThan(arg2) ,null, null); |
2968 | - } |
2969 | - |
2970 | - /// <summary> |
2971 | - /// Verifies that the first value is greater than the second |
2972 | - /// value. If it is not, then an |
2973 | - /// <see cref="AssertionException"/> is thrown. |
2974 | - /// </summary> |
2975 | - /// <param name="arg1">The first value, expected to be greater</param> |
2976 | - /// <param name="arg2">The second value, expected to be less</param> |
2977 | - /// <param name="message">The message to display in case of failure</param> |
2978 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
2979 | - public static void Greater(float arg1, float arg2, string message, params object[] args) |
2980 | - { |
2981 | - Assert.That(arg1, Is.GreaterThan(arg2) ,message, args); |
2982 | - } |
2983 | - /// <summary> |
2984 | - /// Verifies that the first value is greater than the second |
2985 | - /// value. If it is not, then an |
2986 | - /// <see cref="AssertionException"/> is thrown. |
2987 | - /// </summary> |
2988 | - /// <param name="arg1">The first value, expected to be greater</param> |
2989 | - /// <param name="arg2">The second value, expected to be less</param> |
2990 | - /// <param name="message">The message to display in case of failure</param> |
2991 | - public static void Greater(float arg1, float arg2, string message) |
2992 | - { |
2993 | - Assert.That(arg1, Is.GreaterThan(arg2) ,message, null); |
2994 | - } |
2995 | - /// <summary> |
2996 | - /// Verifies that the first value is greater than the second |
2997 | - /// value. If it is not, then an |
2998 | - /// <see cref="AssertionException"/> is thrown. |
2999 | - /// </summary> |
3000 | - /// <param name="arg1">The first value, expected to be greater</param> |
3001 | - /// <param name="arg2">The second value, expected to be less</param> |
3002 | - public static void Greater(float arg1, float arg2) |
3003 | - { |
3004 | - Assert.That(arg1, Is.GreaterThan(arg2) ,null, null); |
3005 | - } |
3006 | - |
3007 | - /// <summary> |
3008 | - /// Verifies that the first value is greater than the second |
3009 | - /// value. If it is not, then an |
3010 | - /// <see cref="AssertionException"/> is thrown. |
3011 | - /// </summary> |
3012 | - /// <param name="arg1">The first value, expected to be greater</param> |
3013 | - /// <param name="arg2">The second value, expected to be less</param> |
3014 | - /// <param name="message">The message to display in case of failure</param> |
3015 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
3016 | - public static void Greater(IComparable arg1, IComparable arg2, string message, params object[] args) |
3017 | - { |
3018 | - Assert.That(arg1, Is.GreaterThan(arg2) ,message, args); |
3019 | - } |
3020 | - /// <summary> |
3021 | - /// Verifies that the first value is greater than the second |
3022 | - /// value. If it is not, then an |
3023 | - /// <see cref="AssertionException"/> is thrown. |
3024 | - /// </summary> |
3025 | - /// <param name="arg1">The first value, expected to be greater</param> |
3026 | - /// <param name="arg2">The second value, expected to be less</param> |
3027 | - /// <param name="message">The message to display in case of failure</param> |
3028 | - public static void Greater(IComparable arg1, IComparable arg2, string message) |
3029 | - { |
3030 | - Assert.That(arg1, Is.GreaterThan(arg2) ,message, null); |
3031 | - } |
3032 | - /// <summary> |
3033 | - /// Verifies that the first value is greater than the second |
3034 | - /// value. If it is not, then an |
3035 | - /// <see cref="AssertionException"/> is thrown. |
3036 | - /// </summary> |
3037 | - /// <param name="arg1">The first value, expected to be greater</param> |
3038 | - /// <param name="arg2">The second value, expected to be less</param> |
3039 | - public static void Greater(IComparable arg1, IComparable arg2) |
3040 | - { |
3041 | - Assert.That(arg1, Is.GreaterThan(arg2) ,null, null); |
3042 | - } |
3043 | -#endif |
3044 | - |
3045 | - #endregion |
3046 | - |
3047 | - #region Less |
3048 | - |
3049 | -#if !NUNITLITE |
3050 | - /// <summary> |
3051 | - /// Verifies that the first value is less than the second |
3052 | - /// value. If it is not, then an |
3053 | - /// <see cref="AssertionException"/> is thrown. |
3054 | - /// </summary> |
3055 | - /// <param name="arg1">The first value, expected to be less</param> |
3056 | - /// <param name="arg2">The second value, expected to be greater</param> |
3057 | - /// <param name="message">The message to display in case of failure</param> |
3058 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
3059 | - public static void Less(int arg1, int arg2, string message, params object[] args) |
3060 | - { |
3061 | - Assert.That(arg1, Is.LessThan(arg2) ,message, args); |
3062 | - } |
3063 | - /// <summary> |
3064 | - /// Verifies that the first value is less than the second |
3065 | - /// value. If it is not, then an |
3066 | - /// <see cref="AssertionException"/> is thrown. |
3067 | - /// </summary> |
3068 | - /// <param name="arg1">The first value, expected to be less</param> |
3069 | - /// <param name="arg2">The second value, expected to be greater</param> |
3070 | - /// <param name="message">The message to display in case of failure</param> |
3071 | - public static void Less(int arg1, int arg2, string message) |
3072 | - { |
3073 | - Assert.That(arg1, Is.LessThan(arg2) ,message, null); |
3074 | - } |
3075 | - /// <summary> |
3076 | - /// Verifies that the first value is less than the second |
3077 | - /// value. If it is not, then an |
3078 | - /// <see cref="AssertionException"/> is thrown. |
3079 | - /// </summary> |
3080 | - /// <param name="arg1">The first value, expected to be less</param> |
3081 | - /// <param name="arg2">The second value, expected to be greater</param> |
3082 | - public static void Less(int arg1, int arg2) |
3083 | - { |
3084 | - Assert.That(arg1, Is.LessThan(arg2) ,null, null); |
3085 | - } |
3086 | - |
3087 | - /// <summary> |
3088 | - /// Verifies that the first value is less than the second |
3089 | - /// value. If it is not, then an |
3090 | - /// <see cref="AssertionException"/> is thrown. |
3091 | - /// </summary> |
3092 | - /// <param name="arg1">The first value, expected to be less</param> |
3093 | - /// <param name="arg2">The second value, expected to be greater</param> |
3094 | - /// <param name="message">The message to display in case of failure</param> |
3095 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
3096 | - [CLSCompliant(false)] |
3097 | - public static void Less(uint arg1, uint arg2, string message, params object[] args) |
3098 | - { |
3099 | - Assert.That(arg1, Is.LessThan(arg2) ,message, args); |
3100 | - } |
3101 | - /// <summary> |
3102 | - /// Verifies that the first value is less than the second |
3103 | - /// value. If it is not, then an |
3104 | - /// <see cref="AssertionException"/> is thrown. |
3105 | - /// </summary> |
3106 | - /// <param name="arg1">The first value, expected to be less</param> |
3107 | - /// <param name="arg2">The second value, expected to be greater</param> |
3108 | - /// <param name="message">The message to display in case of failure</param> |
3109 | - [CLSCompliant(false)] |
3110 | - public static void Less(uint arg1, uint arg2, string message) |
3111 | - { |
3112 | - Assert.That(arg1, Is.LessThan(arg2) ,message, null); |
3113 | - } |
3114 | - /// <summary> |
3115 | - /// Verifies that the first value is less than the second |
3116 | - /// value. If it is not, then an |
3117 | - /// <see cref="AssertionException"/> is thrown. |
3118 | - /// </summary> |
3119 | - /// <param name="arg1">The first value, expected to be less</param> |
3120 | - /// <param name="arg2">The second value, expected to be greater</param> |
3121 | - [CLSCompliant(false)] |
3122 | - public static void Less(uint arg1, uint arg2) |
3123 | - { |
3124 | - Assert.That(arg1, Is.LessThan(arg2) ,null, null); |
3125 | - } |
3126 | - |
3127 | - /// <summary> |
3128 | - /// Verifies that the first value is less than the second |
3129 | - /// value. If it is not, then an |
3130 | - /// <see cref="AssertionException"/> is thrown. |
3131 | - /// </summary> |
3132 | - /// <param name="arg1">The first value, expected to be less</param> |
3133 | - /// <param name="arg2">The second value, expected to be greater</param> |
3134 | - /// <param name="message">The message to display in case of failure</param> |
3135 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
3136 | - public static void Less(long arg1, long arg2, string message, params object[] args) |
3137 | - { |
3138 | - Assert.That(arg1, Is.LessThan(arg2) ,message, args); |
3139 | - } |
3140 | - /// <summary> |
3141 | - /// Verifies that the first value is less than the second |
3142 | - /// value. If it is not, then an |
3143 | - /// <see cref="AssertionException"/> is thrown. |
3144 | - /// </summary> |
3145 | - /// <param name="arg1">The first value, expected to be less</param> |
3146 | - /// <param name="arg2">The second value, expected to be greater</param> |
3147 | - /// <param name="message">The message to display in case of failure</param> |
3148 | - public static void Less(long arg1, long arg2, string message) |
3149 | - { |
3150 | - Assert.That(arg1, Is.LessThan(arg2) ,message, null); |
3151 | - } |
3152 | - /// <summary> |
3153 | - /// Verifies that the first value is less than the second |
3154 | - /// value. If it is not, then an |
3155 | - /// <see cref="AssertionException"/> is thrown. |
3156 | - /// </summary> |
3157 | - /// <param name="arg1">The first value, expected to be less</param> |
3158 | - /// <param name="arg2">The second value, expected to be greater</param> |
3159 | - public static void Less(long arg1, long arg2) |
3160 | - { |
3161 | - Assert.That(arg1, Is.LessThan(arg2) ,null, null); |
3162 | - } |
3163 | - |
3164 | - /// <summary> |
3165 | - /// Verifies that the first value is less than the second |
3166 | - /// value. If it is not, then an |
3167 | - /// <see cref="AssertionException"/> is thrown. |
3168 | - /// </summary> |
3169 | - /// <param name="arg1">The first value, expected to be less</param> |
3170 | - /// <param name="arg2">The second value, expected to be greater</param> |
3171 | - /// <param name="message">The message to display in case of failure</param> |
3172 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
3173 | - [CLSCompliant(false)] |
3174 | - public static void Less(ulong arg1, ulong arg2, string message, params object[] args) |
3175 | - { |
3176 | - Assert.That(arg1, Is.LessThan(arg2) ,message, args); |
3177 | - } |
3178 | - /// <summary> |
3179 | - /// Verifies that the first value is less than the second |
3180 | - /// value. If it is not, then an |
3181 | - /// <see cref="AssertionException"/> is thrown. |
3182 | - /// </summary> |
3183 | - /// <param name="arg1">The first value, expected to be less</param> |
3184 | - /// <param name="arg2">The second value, expected to be greater</param> |
3185 | - /// <param name="message">The message to display in case of failure</param> |
3186 | - [CLSCompliant(false)] |
3187 | - public static void Less(ulong arg1, ulong arg2, string message) |
3188 | - { |
3189 | - Assert.That(arg1, Is.LessThan(arg2) ,message, null); |
3190 | - } |
3191 | - /// <summary> |
3192 | - /// Verifies that the first value is less than the second |
3193 | - /// value. If it is not, then an |
3194 | - /// <see cref="AssertionException"/> is thrown. |
3195 | - /// </summary> |
3196 | - /// <param name="arg1">The first value, expected to be less</param> |
3197 | - /// <param name="arg2">The second value, expected to be greater</param> |
3198 | - [CLSCompliant(false)] |
3199 | - public static void Less(ulong arg1, ulong arg2) |
3200 | - { |
3201 | - Assert.That(arg1, Is.LessThan(arg2) ,null, null); |
3202 | - } |
3203 | - |
3204 | - /// <summary> |
3205 | - /// Verifies that the first value is less than the second |
3206 | - /// value. If it is not, then an |
3207 | - /// <see cref="AssertionException"/> is thrown. |
3208 | - /// </summary> |
3209 | - /// <param name="arg1">The first value, expected to be less</param> |
3210 | - /// <param name="arg2">The second value, expected to be greater</param> |
3211 | - /// <param name="message">The message to display in case of failure</param> |
3212 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
3213 | - public static void Less(decimal arg1, decimal arg2, string message, params object[] args) |
3214 | - { |
3215 | - Assert.That(arg1, Is.LessThan(arg2) ,message, args); |
3216 | - } |
3217 | - /// <summary> |
3218 | - /// Verifies that the first value is less than the second |
3219 | - /// value. If it is not, then an |
3220 | - /// <see cref="AssertionException"/> is thrown. |
3221 | - /// </summary> |
3222 | - /// <param name="arg1">The first value, expected to be less</param> |
3223 | - /// <param name="arg2">The second value, expected to be greater</param> |
3224 | - /// <param name="message">The message to display in case of failure</param> |
3225 | - public static void Less(decimal arg1, decimal arg2, string message) |
3226 | - { |
3227 | - Assert.That(arg1, Is.LessThan(arg2) ,message, null); |
3228 | - } |
3229 | - /// <summary> |
3230 | - /// Verifies that the first value is less than the second |
3231 | - /// value. If it is not, then an |
3232 | - /// <see cref="AssertionException"/> is thrown. |
3233 | - /// </summary> |
3234 | - /// <param name="arg1">The first value, expected to be less</param> |
3235 | - /// <param name="arg2">The second value, expected to be greater</param> |
3236 | - public static void Less(decimal arg1, decimal arg2) |
3237 | - { |
3238 | - Assert.That(arg1, Is.LessThan(arg2) ,null, null); |
3239 | - } |
3240 | - |
3241 | - /// <summary> |
3242 | - /// Verifies that the first value is less than the second |
3243 | - /// value. If it is not, then an |
3244 | - /// <see cref="AssertionException"/> is thrown. |
3245 | - /// </summary> |
3246 | - /// <param name="arg1">The first value, expected to be less</param> |
3247 | - /// <param name="arg2">The second value, expected to be greater</param> |
3248 | - /// <param name="message">The message to display in case of failure</param> |
3249 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
3250 | - public static void Less(double arg1, double arg2, string message, params object[] args) |
3251 | - { |
3252 | - Assert.That(arg1, Is.LessThan(arg2) ,message, args); |
3253 | - } |
3254 | - /// <summary> |
3255 | - /// Verifies that the first value is less than the second |
3256 | - /// value. If it is not, then an |
3257 | - /// <see cref="AssertionException"/> is thrown. |
3258 | - /// </summary> |
3259 | - /// <param name="arg1">The first value, expected to be less</param> |
3260 | - /// <param name="arg2">The second value, expected to be greater</param> |
3261 | - /// <param name="message">The message to display in case of failure</param> |
3262 | - public static void Less(double arg1, double arg2, string message) |
3263 | - { |
3264 | - Assert.That(arg1, Is.LessThan(arg2) ,message, null); |
3265 | - } |
3266 | - /// <summary> |
3267 | - /// Verifies that the first value is less than the second |
3268 | - /// value. If it is not, then an |
3269 | - /// <see cref="AssertionException"/> is thrown. |
3270 | - /// </summary> |
3271 | - /// <param name="arg1">The first value, expected to be less</param> |
3272 | - /// <param name="arg2">The second value, expected to be greater</param> |
3273 | - public static void Less(double arg1, double arg2) |
3274 | - { |
3275 | - Assert.That(arg1, Is.LessThan(arg2) ,null, null); |
3276 | - } |
3277 | - |
3278 | - /// <summary> |
3279 | - /// Verifies that the first value is less than the second |
3280 | - /// value. If it is not, then an |
3281 | - /// <see cref="AssertionException"/> is thrown. |
3282 | - /// </summary> |
3283 | - /// <param name="arg1">The first value, expected to be less</param> |
3284 | - /// <param name="arg2">The second value, expected to be greater</param> |
3285 | - /// <param name="message">The message to display in case of failure</param> |
3286 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
3287 | - public static void Less(float arg1, float arg2, string message, params object[] args) |
3288 | - { |
3289 | - Assert.That(arg1, Is.LessThan(arg2) ,message, args); |
3290 | - } |
3291 | - /// <summary> |
3292 | - /// Verifies that the first value is less than the second |
3293 | - /// value. If it is not, then an |
3294 | - /// <see cref="AssertionException"/> is thrown. |
3295 | - /// </summary> |
3296 | - /// <param name="arg1">The first value, expected to be less</param> |
3297 | - /// <param name="arg2">The second value, expected to be greater</param> |
3298 | - /// <param name="message">The message to display in case of failure</param> |
3299 | - public static void Less(float arg1, float arg2, string message) |
3300 | - { |
3301 | - Assert.That(arg1, Is.LessThan(arg2) ,message, null); |
3302 | - } |
3303 | - /// <summary> |
3304 | - /// Verifies that the first value is less than the second |
3305 | - /// value. If it is not, then an |
3306 | - /// <see cref="AssertionException"/> is thrown. |
3307 | - /// </summary> |
3308 | - /// <param name="arg1">The first value, expected to be less</param> |
3309 | - /// <param name="arg2">The second value, expected to be greater</param> |
3310 | - public static void Less(float arg1, float arg2) |
3311 | - { |
3312 | - Assert.That(arg1, Is.LessThan(arg2) ,null, null); |
3313 | - } |
3314 | - |
3315 | - /// <summary> |
3316 | - /// Verifies that the first value is less than the second |
3317 | - /// value. If it is not, then an |
3318 | - /// <see cref="AssertionException"/> is thrown. |
3319 | - /// </summary> |
3320 | - /// <param name="arg1">The first value, expected to be less</param> |
3321 | - /// <param name="arg2">The second value, expected to be greater</param> |
3322 | - /// <param name="message">The message to display in case of failure</param> |
3323 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
3324 | - public static void Less(IComparable arg1, IComparable arg2, string message, params object[] args) |
3325 | - { |
3326 | - Assert.That(arg1, Is.LessThan(arg2) ,message, args); |
3327 | - } |
3328 | - /// <summary> |
3329 | - /// Verifies that the first value is less than the second |
3330 | - /// value. If it is not, then an |
3331 | - /// <see cref="AssertionException"/> is thrown. |
3332 | - /// </summary> |
3333 | - /// <param name="arg1">The first value, expected to be less</param> |
3334 | - /// <param name="arg2">The second value, expected to be greater</param> |
3335 | - /// <param name="message">The message to display in case of failure</param> |
3336 | - public static void Less(IComparable arg1, IComparable arg2, string message) |
3337 | - { |
3338 | - Assert.That(arg1, Is.LessThan(arg2) ,message, null); |
3339 | - } |
3340 | - /// <summary> |
3341 | - /// Verifies that the first value is less than the second |
3342 | - /// value. If it is not, then an |
3343 | - /// <see cref="AssertionException"/> is thrown. |
3344 | - /// </summary> |
3345 | - /// <param name="arg1">The first value, expected to be less</param> |
3346 | - /// <param name="arg2">The second value, expected to be greater</param> |
3347 | - public static void Less(IComparable arg1, IComparable arg2) |
3348 | - { |
3349 | - Assert.That(arg1, Is.LessThan(arg2) ,null, null); |
3350 | - } |
3351 | -#endif |
3352 | - |
3353 | - #endregion |
3354 | - |
3355 | - #region GreaterOrEqual |
3356 | - |
3357 | -#if !NUNITLITE |
3358 | - /// <summary> |
3359 | - /// Verifies that the first value is greater than or equal tothe second |
3360 | - /// value. If it is not, then an |
3361 | - /// <see cref="AssertionException"/> is thrown. |
3362 | - /// </summary> |
3363 | - /// <param name="arg1">The first value, expected to be greater</param> |
3364 | - /// <param name="arg2">The second value, expected to be less</param> |
3365 | - /// <param name="message">The message to display in case of failure</param> |
3366 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
3367 | - public static void GreaterOrEqual(int arg1, int arg2, string message, params object[] args) |
3368 | - { |
3369 | - Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, args); |
3370 | - } |
3371 | - /// <summary> |
3372 | - /// Verifies that the first value is greater than or equal tothe second |
3373 | - /// value. If it is not, then an |
3374 | - /// <see cref="AssertionException"/> is thrown. |
3375 | - /// </summary> |
3376 | - /// <param name="arg1">The first value, expected to be greater</param> |
3377 | - /// <param name="arg2">The second value, expected to be less</param> |
3378 | - /// <param name="message">The message to display in case of failure</param> |
3379 | - public static void GreaterOrEqual(int arg1, int arg2, string message) |
3380 | - { |
3381 | - Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, null); |
3382 | - } |
3383 | - /// <summary> |
3384 | - /// Verifies that the first value is greater than or equal tothe second |
3385 | - /// value. If it is not, then an |
3386 | - /// <see cref="AssertionException"/> is thrown. |
3387 | - /// </summary> |
3388 | - /// <param name="arg1">The first value, expected to be greater</param> |
3389 | - /// <param name="arg2">The second value, expected to be less</param> |
3390 | - public static void GreaterOrEqual(int arg1, int arg2) |
3391 | - { |
3392 | - Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,null, null); |
3393 | - } |
3394 | - |
3395 | - /// <summary> |
3396 | - /// Verifies that the first value is greater than or equal tothe second |
3397 | - /// value. If it is not, then an |
3398 | - /// <see cref="AssertionException"/> is thrown. |
3399 | - /// </summary> |
3400 | - /// <param name="arg1">The first value, expected to be greater</param> |
3401 | - /// <param name="arg2">The second value, expected to be less</param> |
3402 | - /// <param name="message">The message to display in case of failure</param> |
3403 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
3404 | - [CLSCompliant(false)] |
3405 | - public static void GreaterOrEqual(uint arg1, uint arg2, string message, params object[] args) |
3406 | - { |
3407 | - Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, args); |
3408 | - } |
3409 | - /// <summary> |
3410 | - /// Verifies that the first value is greater than or equal tothe second |
3411 | - /// value. If it is not, then an |
3412 | - /// <see cref="AssertionException"/> is thrown. |
3413 | - /// </summary> |
3414 | - /// <param name="arg1">The first value, expected to be greater</param> |
3415 | - /// <param name="arg2">The second value, expected to be less</param> |
3416 | - /// <param name="message">The message to display in case of failure</param> |
3417 | - [CLSCompliant(false)] |
3418 | - public static void GreaterOrEqual(uint arg1, uint arg2, string message) |
3419 | - { |
3420 | - Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, null); |
3421 | - } |
3422 | - /// <summary> |
3423 | - /// Verifies that the first value is greater than or equal tothe second |
3424 | - /// value. If it is not, then an |
3425 | - /// <see cref="AssertionException"/> is thrown. |
3426 | - /// </summary> |
3427 | - /// <param name="arg1">The first value, expected to be greater</param> |
3428 | - /// <param name="arg2">The second value, expected to be less</param> |
3429 | - [CLSCompliant(false)] |
3430 | - public static void GreaterOrEqual(uint arg1, uint arg2) |
3431 | - { |
3432 | - Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,null, null); |
3433 | - } |
3434 | - |
3435 | - /// <summary> |
3436 | - /// Verifies that the first value is greater than or equal tothe second |
3437 | - /// value. If it is not, then an |
3438 | - /// <see cref="AssertionException"/> is thrown. |
3439 | - /// </summary> |
3440 | - /// <param name="arg1">The first value, expected to be greater</param> |
3441 | - /// <param name="arg2">The second value, expected to be less</param> |
3442 | - /// <param name="message">The message to display in case of failure</param> |
3443 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
3444 | - public static void GreaterOrEqual(long arg1, long arg2, string message, params object[] args) |
3445 | - { |
3446 | - Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, args); |
3447 | - } |
3448 | - /// <summary> |
3449 | - /// Verifies that the first value is greater than or equal tothe second |
3450 | - /// value. If it is not, then an |
3451 | - /// <see cref="AssertionException"/> is thrown. |
3452 | - /// </summary> |
3453 | - /// <param name="arg1">The first value, expected to be greater</param> |
3454 | - /// <param name="arg2">The second value, expected to be less</param> |
3455 | - /// <param name="message">The message to display in case of failure</param> |
3456 | - public static void GreaterOrEqual(long arg1, long arg2, string message) |
3457 | - { |
3458 | - Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, null); |
3459 | - } |
3460 | - /// <summary> |
3461 | - /// Verifies that the first value is greater than or equal tothe second |
3462 | - /// value. If it is not, then an |
3463 | - /// <see cref="AssertionException"/> is thrown. |
3464 | - /// </summary> |
3465 | - /// <param name="arg1">The first value, expected to be greater</param> |
3466 | - /// <param name="arg2">The second value, expected to be less</param> |
3467 | - public static void GreaterOrEqual(long arg1, long arg2) |
3468 | - { |
3469 | - Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,null, null); |
3470 | - } |
3471 | - |
3472 | - /// <summary> |
3473 | - /// Verifies that the first value is greater than or equal tothe second |
3474 | - /// value. If it is not, then an |
3475 | - /// <see cref="AssertionException"/> is thrown. |
3476 | - /// </summary> |
3477 | - /// <param name="arg1">The first value, expected to be greater</param> |
3478 | - /// <param name="arg2">The second value, expected to be less</param> |
3479 | - /// <param name="message">The message to display in case of failure</param> |
3480 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
3481 | - [CLSCompliant(false)] |
3482 | - public static void GreaterOrEqual(ulong arg1, ulong arg2, string message, params object[] args) |
3483 | - { |
3484 | - Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, args); |
3485 | - } |
3486 | - /// <summary> |
3487 | - /// Verifies that the first value is greater than or equal tothe second |
3488 | - /// value. If it is not, then an |
3489 | - /// <see cref="AssertionException"/> is thrown. |
3490 | - /// </summary> |
3491 | - /// <param name="arg1">The first value, expected to be greater</param> |
3492 | - /// <param name="arg2">The second value, expected to be less</param> |
3493 | - /// <param name="message">The message to display in case of failure</param> |
3494 | - [CLSCompliant(false)] |
3495 | - public static void GreaterOrEqual(ulong arg1, ulong arg2, string message) |
3496 | - { |
3497 | - Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, null); |
3498 | - } |
3499 | - /// <summary> |
3500 | - /// Verifies that the first value is greater than or equal tothe second |
3501 | - /// value. If it is not, then an |
3502 | - /// <see cref="AssertionException"/> is thrown. |
3503 | - /// </summary> |
3504 | - /// <param name="arg1">The first value, expected to be greater</param> |
3505 | - /// <param name="arg2">The second value, expected to be less</param> |
3506 | - [CLSCompliant(false)] |
3507 | - public static void GreaterOrEqual(ulong arg1, ulong arg2) |
3508 | - { |
3509 | - Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,null, null); |
3510 | - } |
3511 | - |
3512 | - /// <summary> |
3513 | - /// Verifies that the first value is greater than or equal tothe second |
3514 | - /// value. If it is not, then an |
3515 | - /// <see cref="AssertionException"/> is thrown. |
3516 | - /// </summary> |
3517 | - /// <param name="arg1">The first value, expected to be greater</param> |
3518 | - /// <param name="arg2">The second value, expected to be less</param> |
3519 | - /// <param name="message">The message to display in case of failure</param> |
3520 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
3521 | - public static void GreaterOrEqual(decimal arg1, decimal arg2, string message, params object[] args) |
3522 | - { |
3523 | - Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, args); |
3524 | - } |
3525 | - /// <summary> |
3526 | - /// Verifies that the first value is greater than or equal tothe second |
3527 | - /// value. If it is not, then an |
3528 | - /// <see cref="AssertionException"/> is thrown. |
3529 | - /// </summary> |
3530 | - /// <param name="arg1">The first value, expected to be greater</param> |
3531 | - /// <param name="arg2">The second value, expected to be less</param> |
3532 | - /// <param name="message">The message to display in case of failure</param> |
3533 | - public static void GreaterOrEqual(decimal arg1, decimal arg2, string message) |
3534 | - { |
3535 | - Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, null); |
3536 | - } |
3537 | - /// <summary> |
3538 | - /// Verifies that the first value is greater than or equal tothe second |
3539 | - /// value. If it is not, then an |
3540 | - /// <see cref="AssertionException"/> is thrown. |
3541 | - /// </summary> |
3542 | - /// <param name="arg1">The first value, expected to be greater</param> |
3543 | - /// <param name="arg2">The second value, expected to be less</param> |
3544 | - public static void GreaterOrEqual(decimal arg1, decimal arg2) |
3545 | - { |
3546 | - Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,null, null); |
3547 | - } |
3548 | - |
3549 | - /// <summary> |
3550 | - /// Verifies that the first value is greater than or equal tothe second |
3551 | - /// value. If it is not, then an |
3552 | - /// <see cref="AssertionException"/> is thrown. |
3553 | - /// </summary> |
3554 | - /// <param name="arg1">The first value, expected to be greater</param> |
3555 | - /// <param name="arg2">The second value, expected to be less</param> |
3556 | - /// <param name="message">The message to display in case of failure</param> |
3557 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
3558 | - public static void GreaterOrEqual(double arg1, double arg2, string message, params object[] args) |
3559 | - { |
3560 | - Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, args); |
3561 | - } |
3562 | - /// <summary> |
3563 | - /// Verifies that the first value is greater than or equal tothe second |
3564 | - /// value. If it is not, then an |
3565 | - /// <see cref="AssertionException"/> is thrown. |
3566 | - /// </summary> |
3567 | - /// <param name="arg1">The first value, expected to be greater</param> |
3568 | - /// <param name="arg2">The second value, expected to be less</param> |
3569 | - /// <param name="message">The message to display in case of failure</param> |
3570 | - public static void GreaterOrEqual(double arg1, double arg2, string message) |
3571 | - { |
3572 | - Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, null); |
3573 | - } |
3574 | - /// <summary> |
3575 | - /// Verifies that the first value is greater than or equal tothe second |
3576 | - /// value. If it is not, then an |
3577 | - /// <see cref="AssertionException"/> is thrown. |
3578 | - /// </summary> |
3579 | - /// <param name="arg1">The first value, expected to be greater</param> |
3580 | - /// <param name="arg2">The second value, expected to be less</param> |
3581 | - public static void GreaterOrEqual(double arg1, double arg2) |
3582 | - { |
3583 | - Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,null, null); |
3584 | - } |
3585 | - |
3586 | - /// <summary> |
3587 | - /// Verifies that the first value is greater than or equal tothe second |
3588 | - /// value. If it is not, then an |
3589 | - /// <see cref="AssertionException"/> is thrown. |
3590 | - /// </summary> |
3591 | - /// <param name="arg1">The first value, expected to be greater</param> |
3592 | - /// <param name="arg2">The second value, expected to be less</param> |
3593 | - /// <param name="message">The message to display in case of failure</param> |
3594 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
3595 | - public static void GreaterOrEqual(float arg1, float arg2, string message, params object[] args) |
3596 | - { |
3597 | - Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, args); |
3598 | - } |
3599 | - /// <summary> |
3600 | - /// Verifies that the first value is greater than or equal tothe second |
3601 | - /// value. If it is not, then an |
3602 | - /// <see cref="AssertionException"/> is thrown. |
3603 | - /// </summary> |
3604 | - /// <param name="arg1">The first value, expected to be greater</param> |
3605 | - /// <param name="arg2">The second value, expected to be less</param> |
3606 | - /// <param name="message">The message to display in case of failure</param> |
3607 | - public static void GreaterOrEqual(float arg1, float arg2, string message) |
3608 | - { |
3609 | - Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, null); |
3610 | - } |
3611 | - /// <summary> |
3612 | - /// Verifies that the first value is greater than or equal tothe second |
3613 | - /// value. If it is not, then an |
3614 | - /// <see cref="AssertionException"/> is thrown. |
3615 | - /// </summary> |
3616 | - /// <param name="arg1">The first value, expected to be greater</param> |
3617 | - /// <param name="arg2">The second value, expected to be less</param> |
3618 | - public static void GreaterOrEqual(float arg1, float arg2) |
3619 | - { |
3620 | - Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,null, null); |
3621 | - } |
3622 | - |
3623 | - /// <summary> |
3624 | - /// Verifies that the first value is greater than or equal tothe second |
3625 | - /// value. If it is not, then an |
3626 | - /// <see cref="AssertionException"/> is thrown. |
3627 | - /// </summary> |
3628 | - /// <param name="arg1">The first value, expected to be greater</param> |
3629 | - /// <param name="arg2">The second value, expected to be less</param> |
3630 | - /// <param name="message">The message to display in case of failure</param> |
3631 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
3632 | - public static void GreaterOrEqual(IComparable arg1, IComparable arg2, string message, params object[] args) |
3633 | - { |
3634 | - Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, args); |
3635 | - } |
3636 | - /// <summary> |
3637 | - /// Verifies that the first value is greater than or equal tothe second |
3638 | - /// value. If it is not, then an |
3639 | - /// <see cref="AssertionException"/> is thrown. |
3640 | - /// </summary> |
3641 | - /// <param name="arg1">The first value, expected to be greater</param> |
3642 | - /// <param name="arg2">The second value, expected to be less</param> |
3643 | - /// <param name="message">The message to display in case of failure</param> |
3644 | - public static void GreaterOrEqual(IComparable arg1, IComparable arg2, string message) |
3645 | - { |
3646 | - Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, null); |
3647 | - } |
3648 | - /// <summary> |
3649 | - /// Verifies that the first value is greater than or equal tothe second |
3650 | - /// value. If it is not, then an |
3651 | - /// <see cref="AssertionException"/> is thrown. |
3652 | - /// </summary> |
3653 | - /// <param name="arg1">The first value, expected to be greater</param> |
3654 | - /// <param name="arg2">The second value, expected to be less</param> |
3655 | - public static void GreaterOrEqual(IComparable arg1, IComparable arg2) |
3656 | - { |
3657 | - Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,null, null); |
3658 | - } |
3659 | -#endif |
3660 | - |
3661 | - #endregion |
3662 | - |
3663 | - #region LessOrEqual |
3664 | - |
3665 | -#if !NUNITLITE |
3666 | - /// <summary> |
3667 | - /// Verifies that the first value is less than or equal to the second |
3668 | - /// value. If it is not, then an |
3669 | - /// <see cref="AssertionException"/> is thrown. |
3670 | - /// </summary> |
3671 | - /// <param name="arg1">The first value, expected to be less</param> |
3672 | - /// <param name="arg2">The second value, expected to be greater</param> |
3673 | - /// <param name="message">The message to display in case of failure</param> |
3674 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
3675 | - public static void LessOrEqual(int arg1, int arg2, string message, params object[] args) |
3676 | - { |
3677 | - Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, args); |
3678 | - } |
3679 | - /// <summary> |
3680 | - /// Verifies that the first value is less than or equal to the second |
3681 | - /// value. If it is not, then an |
3682 | - /// <see cref="AssertionException"/> is thrown. |
3683 | - /// </summary> |
3684 | - /// <param name="arg1">The first value, expected to be less</param> |
3685 | - /// <param name="arg2">The second value, expected to be greater</param> |
3686 | - /// <param name="message">The message to display in case of failure</param> |
3687 | - public static void LessOrEqual(int arg1, int arg2, string message) |
3688 | - { |
3689 | - Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, null); |
3690 | - } |
3691 | - /// <summary> |
3692 | - /// Verifies that the first value is less than or equal to the second |
3693 | - /// value. If it is not, then an |
3694 | - /// <see cref="AssertionException"/> is thrown. |
3695 | - /// </summary> |
3696 | - /// <param name="arg1">The first value, expected to be less</param> |
3697 | - /// <param name="arg2">The second value, expected to be greater</param> |
3698 | - public static void LessOrEqual(int arg1, int arg2) |
3699 | - { |
3700 | - Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,null, null); |
3701 | - } |
3702 | - |
3703 | - /// <summary> |
3704 | - /// Verifies that the first value is less than or equal to the second |
3705 | - /// value. If it is not, then an |
3706 | - /// <see cref="AssertionException"/> is thrown. |
3707 | - /// </summary> |
3708 | - /// <param name="arg1">The first value, expected to be less</param> |
3709 | - /// <param name="arg2">The second value, expected to be greater</param> |
3710 | - /// <param name="message">The message to display in case of failure</param> |
3711 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
3712 | - [CLSCompliant(false)] |
3713 | - public static void LessOrEqual(uint arg1, uint arg2, string message, params object[] args) |
3714 | - { |
3715 | - Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, args); |
3716 | - } |
3717 | - /// <summary> |
3718 | - /// Verifies that the first value is less than or equal to the second |
3719 | - /// value. If it is not, then an |
3720 | - /// <see cref="AssertionException"/> is thrown. |
3721 | - /// </summary> |
3722 | - /// <param name="arg1">The first value, expected to be less</param> |
3723 | - /// <param name="arg2">The second value, expected to be greater</param> |
3724 | - /// <param name="message">The message to display in case of failure</param> |
3725 | - [CLSCompliant(false)] |
3726 | - public static void LessOrEqual(uint arg1, uint arg2, string message) |
3727 | - { |
3728 | - Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, null); |
3729 | - } |
3730 | - /// <summary> |
3731 | - /// Verifies that the first value is less than or equal to the second |
3732 | - /// value. If it is not, then an |
3733 | - /// <see cref="AssertionException"/> is thrown. |
3734 | - /// </summary> |
3735 | - /// <param name="arg1">The first value, expected to be less</param> |
3736 | - /// <param name="arg2">The second value, expected to be greater</param> |
3737 | - [CLSCompliant(false)] |
3738 | - public static void LessOrEqual(uint arg1, uint arg2) |
3739 | - { |
3740 | - Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,null, null); |
3741 | - } |
3742 | - |
3743 | - /// <summary> |
3744 | - /// Verifies that the first value is less than or equal to the second |
3745 | - /// value. If it is not, then an |
3746 | - /// <see cref="AssertionException"/> is thrown. |
3747 | - /// </summary> |
3748 | - /// <param name="arg1">The first value, expected to be less</param> |
3749 | - /// <param name="arg2">The second value, expected to be greater</param> |
3750 | - /// <param name="message">The message to display in case of failure</param> |
3751 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
3752 | - public static void LessOrEqual(long arg1, long arg2, string message, params object[] args) |
3753 | - { |
3754 | - Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, args); |
3755 | - } |
3756 | - /// <summary> |
3757 | - /// Verifies that the first value is less than or equal to the second |
3758 | - /// value. If it is not, then an |
3759 | - /// <see cref="AssertionException"/> is thrown. |
3760 | - /// </summary> |
3761 | - /// <param name="arg1">The first value, expected to be less</param> |
3762 | - /// <param name="arg2">The second value, expected to be greater</param> |
3763 | - /// <param name="message">The message to display in case of failure</param> |
3764 | - public static void LessOrEqual(long arg1, long arg2, string message) |
3765 | - { |
3766 | - Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, null); |
3767 | - } |
3768 | - /// <summary> |
3769 | - /// Verifies that the first value is less than or equal to the second |
3770 | - /// value. If it is not, then an |
3771 | - /// <see cref="AssertionException"/> is thrown. |
3772 | - /// </summary> |
3773 | - /// <param name="arg1">The first value, expected to be less</param> |
3774 | - /// <param name="arg2">The second value, expected to be greater</param> |
3775 | - public static void LessOrEqual(long arg1, long arg2) |
3776 | - { |
3777 | - Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,null, null); |
3778 | - } |
3779 | - |
3780 | - /// <summary> |
3781 | - /// Verifies that the first value is less than or equal to the second |
3782 | - /// value. If it is not, then an |
3783 | - /// <see cref="AssertionException"/> is thrown. |
3784 | - /// </summary> |
3785 | - /// <param name="arg1">The first value, expected to be less</param> |
3786 | - /// <param name="arg2">The second value, expected to be greater</param> |
3787 | - /// <param name="message">The message to display in case of failure</param> |
3788 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
3789 | - [CLSCompliant(false)] |
3790 | - public static void LessOrEqual(ulong arg1, ulong arg2, string message, params object[] args) |
3791 | - { |
3792 | - Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, args); |
3793 | - } |
3794 | - /// <summary> |
3795 | - /// Verifies that the first value is less than or equal to the second |
3796 | - /// value. If it is not, then an |
3797 | - /// <see cref="AssertionException"/> is thrown. |
3798 | - /// </summary> |
3799 | - /// <param name="arg1">The first value, expected to be less</param> |
3800 | - /// <param name="arg2">The second value, expected to be greater</param> |
3801 | - /// <param name="message">The message to display in case of failure</param> |
3802 | - [CLSCompliant(false)] |
3803 | - public static void LessOrEqual(ulong arg1, ulong arg2, string message) |
3804 | - { |
3805 | - Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, null); |
3806 | - } |
3807 | - /// <summary> |
3808 | - /// Verifies that the first value is less than or equal to the second |
3809 | - /// value. If it is not, then an |
3810 | - /// <see cref="AssertionException"/> is thrown. |
3811 | - /// </summary> |
3812 | - /// <param name="arg1">The first value, expected to be less</param> |
3813 | - /// <param name="arg2">The second value, expected to be greater</param> |
3814 | - [CLSCompliant(false)] |
3815 | - public static void LessOrEqual(ulong arg1, ulong arg2) |
3816 | - { |
3817 | - Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,null, null); |
3818 | - } |
3819 | - |
3820 | - /// <summary> |
3821 | - /// Verifies that the first value is less than or equal to the second |
3822 | - /// value. If it is not, then an |
3823 | - /// <see cref="AssertionException"/> is thrown. |
3824 | - /// </summary> |
3825 | - /// <param name="arg1">The first value, expected to be less</param> |
3826 | - /// <param name="arg2">The second value, expected to be greater</param> |
3827 | - /// <param name="message">The message to display in case of failure</param> |
3828 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
3829 | - public static void LessOrEqual(decimal arg1, decimal arg2, string message, params object[] args) |
3830 | - { |
3831 | - Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, args); |
3832 | - } |
3833 | - /// <summary> |
3834 | - /// Verifies that the first value is less than or equal to the second |
3835 | - /// value. If it is not, then an |
3836 | - /// <see cref="AssertionException"/> is thrown. |
3837 | - /// </summary> |
3838 | - /// <param name="arg1">The first value, expected to be less</param> |
3839 | - /// <param name="arg2">The second value, expected to be greater</param> |
3840 | - /// <param name="message">The message to display in case of failure</param> |
3841 | - public static void LessOrEqual(decimal arg1, decimal arg2, string message) |
3842 | - { |
3843 | - Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, null); |
3844 | - } |
3845 | - /// <summary> |
3846 | - /// Verifies that the first value is less than or equal to the second |
3847 | - /// value. If it is not, then an |
3848 | - /// <see cref="AssertionException"/> is thrown. |
3849 | - /// </summary> |
3850 | - /// <param name="arg1">The first value, expected to be less</param> |
3851 | - /// <param name="arg2">The second value, expected to be greater</param> |
3852 | - public static void LessOrEqual(decimal arg1, decimal arg2) |
3853 | - { |
3854 | - Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,null, null); |
3855 | - } |
3856 | - |
3857 | - /// <summary> |
3858 | - /// Verifies that the first value is less than or equal to the second |
3859 | - /// value. If it is not, then an |
3860 | - /// <see cref="AssertionException"/> is thrown. |
3861 | - /// </summary> |
3862 | - /// <param name="arg1">The first value, expected to be less</param> |
3863 | - /// <param name="arg2">The second value, expected to be greater</param> |
3864 | - /// <param name="message">The message to display in case of failure</param> |
3865 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
3866 | - public static void LessOrEqual(double arg1, double arg2, string message, params object[] args) |
3867 | - { |
3868 | - Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, args); |
3869 | - } |
3870 | - /// <summary> |
3871 | - /// Verifies that the first value is less than or equal to the second |
3872 | - /// value. If it is not, then an |
3873 | - /// <see cref="AssertionException"/> is thrown. |
3874 | - /// </summary> |
3875 | - /// <param name="arg1">The first value, expected to be less</param> |
3876 | - /// <param name="arg2">The second value, expected to be greater</param> |
3877 | - /// <param name="message">The message to display in case of failure</param> |
3878 | - public static void LessOrEqual(double arg1, double arg2, string message) |
3879 | - { |
3880 | - Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, null); |
3881 | - } |
3882 | - /// <summary> |
3883 | - /// Verifies that the first value is less than or equal to the second |
3884 | - /// value. If it is not, then an |
3885 | - /// <see cref="AssertionException"/> is thrown. |
3886 | - /// </summary> |
3887 | - /// <param name="arg1">The first value, expected to be less</param> |
3888 | - /// <param name="arg2">The second value, expected to be greater</param> |
3889 | - public static void LessOrEqual(double arg1, double arg2) |
3890 | - { |
3891 | - Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,null, null); |
3892 | - } |
3893 | - |
3894 | - /// <summary> |
3895 | - /// Verifies that the first value is less than or equal to the second |
3896 | - /// value. If it is not, then an |
3897 | - /// <see cref="AssertionException"/> is thrown. |
3898 | - /// </summary> |
3899 | - /// <param name="arg1">The first value, expected to be less</param> |
3900 | - /// <param name="arg2">The second value, expected to be greater</param> |
3901 | - /// <param name="message">The message to display in case of failure</param> |
3902 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
3903 | - public static void LessOrEqual(float arg1, float arg2, string message, params object[] args) |
3904 | - { |
3905 | - Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, args); |
3906 | - } |
3907 | - /// <summary> |
3908 | - /// Verifies that the first value is less than or equal to the second |
3909 | - /// value. If it is not, then an |
3910 | - /// <see cref="AssertionException"/> is thrown. |
3911 | - /// </summary> |
3912 | - /// <param name="arg1">The first value, expected to be less</param> |
3913 | - /// <param name="arg2">The second value, expected to be greater</param> |
3914 | - /// <param name="message">The message to display in case of failure</param> |
3915 | - public static void LessOrEqual(float arg1, float arg2, string message) |
3916 | - { |
3917 | - Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, null); |
3918 | - } |
3919 | - /// <summary> |
3920 | - /// Verifies that the first value is less than or equal to the second |
3921 | - /// value. If it is not, then an |
3922 | - /// <see cref="AssertionException"/> is thrown. |
3923 | - /// </summary> |
3924 | - /// <param name="arg1">The first value, expected to be less</param> |
3925 | - /// <param name="arg2">The second value, expected to be greater</param> |
3926 | - public static void LessOrEqual(float arg1, float arg2) |
3927 | - { |
3928 | - Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,null, null); |
3929 | - } |
3930 | - |
3931 | - /// <summary> |
3932 | - /// Verifies that the first value is less than or equal to the second |
3933 | - /// value. If it is not, then an |
3934 | - /// <see cref="AssertionException"/> is thrown. |
3935 | - /// </summary> |
3936 | - /// <param name="arg1">The first value, expected to be less</param> |
3937 | - /// <param name="arg2">The second value, expected to be greater</param> |
3938 | - /// <param name="message">The message to display in case of failure</param> |
3939 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
3940 | - public static void LessOrEqual(IComparable arg1, IComparable arg2, string message, params object[] args) |
3941 | - { |
3942 | - Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, args); |
3943 | - } |
3944 | - /// <summary> |
3945 | - /// Verifies that the first value is less than or equal to the second |
3946 | - /// value. If it is not, then an |
3947 | - /// <see cref="AssertionException"/> is thrown. |
3948 | - /// </summary> |
3949 | - /// <param name="arg1">The first value, expected to be less</param> |
3950 | - /// <param name="arg2">The second value, expected to be greater</param> |
3951 | - /// <param name="message">The message to display in case of failure</param> |
3952 | - public static void LessOrEqual(IComparable arg1, IComparable arg2, string message) |
3953 | - { |
3954 | - Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, null); |
3955 | - } |
3956 | - /// <summary> |
3957 | - /// Verifies that the first value is less than or equal to the second |
3958 | - /// value. If it is not, then an |
3959 | - /// <see cref="AssertionException"/> is thrown. |
3960 | - /// </summary> |
3961 | - /// <param name="arg1">The first value, expected to be less</param> |
3962 | - /// <param name="arg2">The second value, expected to be greater</param> |
3963 | - public static void LessOrEqual(IComparable arg1, IComparable arg2) |
3964 | - { |
3965 | - Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,null, null); |
3966 | - } |
3967 | -#endif |
3968 | - |
3969 | - #endregion |
3970 | - |
3971 | - #region Contains |
3972 | - |
3973 | -#if !NUNITLITE |
3974 | - /// <summary> |
3975 | - /// Asserts that an object is contained in a list. |
3976 | - /// </summary> |
3977 | - /// <param name="expected">The expected object</param> |
3978 | - /// <param name="actual">The list to be examined</param> |
3979 | - /// <param name="message">The message to display in case of failure</param> |
3980 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
3981 | - public static void Contains(object expected, ICollection actual, string message, params object[] args) |
3982 | - { |
3983 | - Assert.That(actual, new CollectionContainsConstraint(expected) ,message, args); |
3984 | - } |
3985 | - /// <summary> |
3986 | - /// Asserts that an object is contained in a list. |
3987 | - /// </summary> |
3988 | - /// <param name="expected">The expected object</param> |
3989 | - /// <param name="actual">The list to be examined</param> |
3990 | - /// <param name="message">The message to display in case of failure</param> |
3991 | - public static void Contains(object expected, ICollection actual, string message) |
3992 | - { |
3993 | - Assert.That(actual, new CollectionContainsConstraint(expected) ,message, null); |
3994 | - } |
3995 | - /// <summary> |
3996 | - /// Asserts that an object is contained in a list. |
3997 | - /// </summary> |
3998 | - /// <param name="expected">The expected object</param> |
3999 | - /// <param name="actual">The list to be examined</param> |
4000 | - public static void Contains(object expected, ICollection actual) |
4001 | - { |
4002 | - Assert.That(actual, new CollectionContainsConstraint(expected) ,null, null); |
4003 | - } |
4004 | -#endif |
4005 | - |
4006 | - #endregion |
4007 | - |
4008 | - |
4009 | - #region Helper Methods |
4010 | - /// <summary> |
4011 | - /// Helper for Assert.AreEqual(double expected, double actual, ...) |
4012 | - /// allowing code generation to work consistently. |
4013 | - /// </summary> |
4014 | - /// <param name="expected">The expected value</param> |
4015 | - /// <param name="actual">The actual value</param> |
4016 | - /// <param name="delta">The maximum acceptable difference between the |
4017 | - /// the expected and the actual</param> |
4018 | - /// <param name="message">The message to display in case of failure</param> |
4019 | - /// <param name="args">Array of objects to be used in formatting the message</param> |
4020 | - protected static void AssertDoublesAreEqual(double expected, double actual, double delta, string message, object[] args) |
4021 | - { |
4022 | - if (double.IsNaN(expected) || double.IsInfinity(expected)) |
4023 | - Assert.That(actual, Is.EqualTo(expected), message, args); |
4024 | - else |
4025 | - Assert.That(actual, Is.EqualTo(expected).Within(delta), message, args); |
4026 | - } |
4027 | - #endregion |
4028 | - } |
4029 | -} |
4030 | +// *********************************************************************** |
4031 | +// Copyright (c) 2009 Charlie Poole |
4032 | +// |
4033 | +// Permission is hereby granted, free of charge, to any person obtaining |
4034 | +// a copy of this software and associated documentation files (the |
4035 | +// "Software"), to deal in the Software without restriction, including |
4036 | +// without limitation the rights to use, copy, modify, merge, publish, |
4037 | +// distribute, sublicense, and/or sell copies of the Software, and to |
4038 | +// permit persons to whom the Software is furnished to do so, subject to |
4039 | +// the following conditions: |
4040 | +// |
4041 | +// The above copyright notice and this permission notice shall be |
4042 | +// included in all copies or substantial portions of the Software. |
4043 | +// |
4044 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
4045 | +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
4046 | +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
4047 | +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
4048 | +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
4049 | +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
4050 | +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
4051 | +// *********************************************************************** |
4052 | + |
4053 | +// **************************************************************** |
4054 | +// Generated by the NUnit Syntax Generator |
4055 | +// |
4056 | +// Command Line: GenSyntax.exe -syntax:SyntaxElements.txt Shared/Framework/Is.cs Shared/Framework/Has.cs NUnit/Framework/Text.cs Shared/Framework/Throws.cs Shared/Framework/Constraints/ConstraintFactory.cs Shared/Framework/Constraints/ConstraintExpression.cs Shared/Framework/Assert.cs |
4057 | +// |
4058 | +// DO NOT MODIFY THIS FILE DIRECTLY |
4059 | +// **************************************************************** |
4060 | + |
4061 | +using System; |
4062 | +using System.Collections; |
4063 | +using System.ComponentModel; |
4064 | +using NUnit.Framework.Constraints; |
4065 | + |
4066 | +namespace NUnit.Framework |
4067 | +{ |
4068 | + /// <summary> |
4069 | + /// Delegate used by tests that execute code and |
4070 | + /// capture any thrown exception. |
4071 | + /// </summary> |
4072 | + public delegate void TestDelegate(); |
4073 | + |
4074 | + /// <summary> |
4075 | + /// The Assert class contains a collection of static methods that |
4076 | + /// implement the most common assertions used in NUnit. |
4077 | + /// </summary> |
4078 | + public class Assert |
4079 | + { |
4080 | + #region Constructor |
4081 | + |
4082 | + /// <summary> |
4083 | + /// We don't actually want any instances of this object, but some people |
4084 | + /// like to inherit from it to add other static methods. Hence, the |
4085 | + /// protected constructor disallows any instances of this object. |
4086 | + /// </summary> |
4087 | + protected Assert() { } |
4088 | + |
4089 | + #endregion |
4090 | + |
4091 | + #region Assert Counting |
4092 | + |
4093 | + private static int counter = 0; |
4094 | + |
4095 | + /// <summary> |
4096 | + /// Gets the number of assertions executed so far and |
4097 | + /// resets the counter to zero. |
4098 | + /// </summary> |
4099 | + public static int Counter |
4100 | + { |
4101 | + get |
4102 | + { |
4103 | + int cnt = counter; |
4104 | + counter = 0; |
4105 | + return cnt; |
4106 | + } |
4107 | + } |
4108 | + |
4109 | + private static void IncrementAssertCount() |
4110 | + { |
4111 | + ++counter; |
4112 | + } |
4113 | + |
4114 | + #endregion |
4115 | + |
4116 | + #region Equals and ReferenceEquals |
4117 | + |
4118 | +#if !NETCF |
4119 | + /// <summary> |
4120 | + /// The Equals method throws an AssertionException. This is done |
4121 | + /// to make sure there is no mistake by calling this function. |
4122 | + /// </summary> |
4123 | + /// <param name="a"></param> |
4124 | + /// <param name="b"></param> |
4125 | + [EditorBrowsable(EditorBrowsableState.Never)] |
4126 | + public static new bool Equals(object a, object b) |
4127 | + { |
4128 | + throw new InvalidOperationException("Assert.Equals should not be used for Assertions"); |
4129 | + } |
4130 | + |
4131 | + /// <summary> |
4132 | + /// override the default ReferenceEquals to throw an AssertionException. This |
4133 | + /// implementation makes sure there is no mistake in calling this function |
4134 | + /// as part of Assert. |
4135 | + /// </summary> |
4136 | + /// <param name="a"></param> |
4137 | + /// <param name="b"></param> |
4138 | + public static new void ReferenceEquals(object a, object b) |
4139 | + { |
4140 | + throw new InvalidOperationException("Assert.ReferenceEquals should not be used for Assertions"); |
4141 | + } |
4142 | +#endif |
4143 | + |
4144 | + #endregion |
4145 | + |
4146 | + #region Utility Asserts |
4147 | + |
4148 | + #region Pass |
4149 | + |
4150 | +#if !NUNITLITE |
4151 | + /// <summary> |
4152 | + /// Throws a <see cref="SuccessException"/> with the message and arguments |
4153 | + /// that are passed in. This allows a test to be cut short, with a result |
4154 | + /// of success returned to NUnit. |
4155 | + /// </summary> |
4156 | + /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param> |
4157 | + /// <param name="args">Arguments to be used in formatting the message</param> |
4158 | + static public void Pass(string message, params object[] args) |
4159 | + { |
4160 | + if (message == null) message = string.Empty; |
4161 | + else if (args != null && args.Length > 0) |
4162 | + message = string.Format(message, args); |
4163 | + |
4164 | + throw new SuccessException(message); |
4165 | + } |
4166 | + |
4167 | + /// <summary> |
4168 | + /// Throws a <see cref="SuccessException"/> with the message and arguments |
4169 | + /// that are passed in. This allows a test to be cut short, with a result |
4170 | + /// of success returned to NUnit. |
4171 | + /// </summary> |
4172 | + /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param> |
4173 | + static public void Pass(string message) |
4174 | + { |
4175 | + Assert.Pass(message, null); |
4176 | + } |
4177 | + |
4178 | + /// <summary> |
4179 | + /// Throws a <see cref="SuccessException"/> with the message and arguments |
4180 | + /// that are passed in. This allows a test to be cut short, with a result |
4181 | + /// of success returned to NUnit. |
4182 | + /// </summary> |
4183 | + static public void Pass() |
4184 | + { |
4185 | + Assert.Pass(string.Empty, null); |
4186 | + } |
4187 | +#endif |
4188 | + #endregion |
4189 | + |
4190 | + #region Fail |
4191 | + |
4192 | + /// <summary> |
4193 | + /// Throws an <see cref="AssertionException"/> with the message and arguments |
4194 | + /// that are passed in. This is used by the other Assert functions. |
4195 | + /// </summary> |
4196 | + /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param> |
4197 | + /// <param name="args">Arguments to be used in formatting the message</param> |
4198 | + static public void Fail(string message, params object[] args) |
4199 | + { |
4200 | + if (message == null) message = string.Empty; |
4201 | + else if (args != null && args.Length > 0) |
4202 | + message = string.Format(message, args); |
4203 | + |
4204 | + throw new AssertionException(message); |
4205 | + } |
4206 | + |
4207 | + /// <summary> |
4208 | + /// Throws an <see cref="AssertionException"/> with the message that is |
4209 | + /// passed in. This is used by the other Assert functions. |
4210 | + /// </summary> |
4211 | + /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param> |
4212 | + static public void Fail(string message) |
4213 | + { |
4214 | + Assert.Fail(message, null); |
4215 | + } |
4216 | + |
4217 | + /// <summary> |
4218 | + /// Throws an <see cref="AssertionException"/>. |
4219 | + /// This is used by the other Assert functions. |
4220 | + /// </summary> |
4221 | + static public void Fail() |
4222 | + { |
4223 | + Assert.Fail(string.Empty, null); |
4224 | + } |
4225 | + |
4226 | + #endregion |
4227 | + |
4228 | + #region Ignore |
4229 | + |
4230 | +#if !NUNITLITE |
4231 | + /// <summary> |
4232 | + /// Throws an <see cref="IgnoreException"/> with the message and arguments |
4233 | + /// that are passed in. This causes the test to be reported as ignored. |
4234 | + /// </summary> |
4235 | + /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param> |
4236 | + /// <param name="args">Arguments to be used in formatting the message</param> |
4237 | + static public void Ignore(string message, params object[] args) |
4238 | + { |
4239 | + if (message == null) message = string.Empty; |
4240 | + else if (args != null && args.Length > 0) |
4241 | + message = string.Format(message, args); |
4242 | + |
4243 | + throw new IgnoreException(message); |
4244 | + } |
4245 | + |
4246 | + /// <summary> |
4247 | + /// Throws an <see cref="IgnoreException"/> with the message that is |
4248 | + /// passed in. This causes the test to be reported as ignored. |
4249 | + /// </summary> |
4250 | + /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param> |
4251 | + static public void Ignore(string message) |
4252 | + { |
4253 | + Assert.Ignore(message, null); |
4254 | + } |
4255 | + |
4256 | + /// <summary> |
4257 | + /// Throws an <see cref="IgnoreException"/>. |
4258 | + /// This causes the test to be reported as ignored. |
4259 | + /// </summary> |
4260 | + static public void Ignore() |
4261 | + { |
4262 | + Assert.Ignore(string.Empty, null); |
4263 | + } |
4264 | +#endif |
4265 | + |
4266 | + #endregion |
4267 | + |
4268 | + #region InConclusive |
4269 | + |
4270 | +#if !NUNITLITE |
4271 | + /// <summary> |
4272 | + /// Throws an <see cref="InconclusiveException"/> with the message and arguments |
4273 | + /// that are passed in. This causes the test to be reported as inconclusive. |
4274 | + /// </summary> |
4275 | + /// <param name="message">The message to initialize the <see cref="InconclusiveException"/> with.</param> |
4276 | + /// <param name="args">Arguments to be used in formatting the message</param> |
4277 | + static public void Inconclusive(string message, params object[] args) |
4278 | + { |
4279 | + if (message == null) message = string.Empty; |
4280 | + else if (args != null && args.Length > 0) |
4281 | + message = string.Format(message, args); |
4282 | + |
4283 | + throw new InconclusiveException(message); |
4284 | + } |
4285 | + |
4286 | + /// <summary> |
4287 | + /// Throws an <see cref="InconclusiveException"/> with the message that is |
4288 | + /// passed in. This causes the test to be reported as inconclusive. |
4289 | + /// </summary> |
4290 | + /// <param name="message">The message to initialize the <see cref="InconclusiveException"/> with.</param> |
4291 | + static public void Inconclusive(string message) |
4292 | + { |
4293 | + Assert.Inconclusive(message, null); |
4294 | + } |
4295 | + |
4296 | + /// <summary> |
4297 | + /// Throws an <see cref="InconclusiveException"/>. |
4298 | + /// This causes the test to be reported as Inconclusive. |
4299 | + /// </summary> |
4300 | + static public void Inconclusive() |
4301 | + { |
4302 | + Assert.Inconclusive(string.Empty, null); |
4303 | + } |
4304 | +#endif |
4305 | + |
4306 | + #endregion |
4307 | + |
4308 | + #endregion |
4309 | + |
4310 | + #region Assert.That |
4311 | + |
4312 | + #region Object |
4313 | + /// <summary> |
4314 | + /// Apply a constraint to an actual value, succeeding if the constraint |
4315 | + /// is satisfied and throwing an assertion exception on failure. |
4316 | + /// </summary> |
4317 | + /// <param name="expression">A Constraint to be applied</param> |
4318 | + /// <param name="actual">The actual value to test</param> |
4319 | + static public void That(object actual, IResolveConstraint expression) |
4320 | + { |
4321 | + Assert.That(actual, expression, null, null); |
4322 | + } |
4323 | + |
4324 | + /// <summary> |
4325 | + /// Apply a constraint to an actual value, succeeding if the constraint |
4326 | + /// is satisfied and throwing an assertion exception on failure. |
4327 | + /// </summary> |
4328 | + /// <param name="expression">A Constraint to be applied</param> |
4329 | + /// <param name="actual">The actual value to test</param> |
4330 | + /// <param name="message">The message that will be displayed on failure</param> |
4331 | + static public void That(object actual, IResolveConstraint expression, string message) |
4332 | + { |
4333 | + Assert.That(actual, expression, message, null); |
4334 | + } |
4335 | + |
4336 | + /// <summary> |
4337 | + /// Apply a constraint to an actual value, succeeding if the constraint |
4338 | + /// is satisfied and throwing an assertion exception on failure. |
4339 | + /// </summary> |
4340 | + /// <param name="expression">A Constraint expression to be applied</param> |
4341 | + /// <param name="actual">The actual value to test</param> |
4342 | + /// <param name="message">The message that will be displayed on failure</param> |
4343 | + /// <param name="args">Arguments to be used in formatting the message</param> |
4344 | + static public void That(object actual, IResolveConstraint expression, string message, params object[] args) |
4345 | + { |
4346 | + Constraint constraint = expression.Resolve(); |
4347 | + |
4348 | + Assert.IncrementAssertCount(); |
4349 | + if (!constraint.Matches(actual)) |
4350 | + { |
4351 | + MessageWriter writer = new TextMessageWriter(message, args); |
4352 | + constraint.WriteMessageTo(writer); |
4353 | + throw new AssertionException(writer.ToString()); |
4354 | + } |
4355 | + } |
4356 | + #endregion |
4357 | + |
4358 | + #region ActualValueDelegate |
4359 | +#if !NUNITLITE |
4360 | + /// <summary> |
4361 | + /// Apply a constraint to an actual value, succeeding if the constraint |
4362 | + /// is satisfied and throwing an assertion exception on failure. |
4363 | + /// </summary> |
4364 | + /// <param name="expr">A Constraint expression to be applied</param> |
4365 | + /// <param name="del">An ActualValueDelegate returning the value to be tested</param> |
4366 | + static public void That(ActualValueDelegate del, IResolveConstraint expr) |
4367 | + { |
4368 | + Assert.That(del, expr.Resolve(), null, null); |
4369 | + } |
4370 | + |
4371 | + /// <summary> |
4372 | + /// Apply a constraint to an actual value, succeeding if the constraint |
4373 | + /// is satisfied and throwing an assertion exception on failure. |
4374 | + /// </summary> |
4375 | + /// <param name="expr">A Constraint expression to be applied</param> |
4376 | + /// <param name="del">An ActualValueDelegate returning the value to be tested</param> |
4377 | + /// <param name="message">The message that will be displayed on failure</param> |
4378 | + static public void That(ActualValueDelegate del, IResolveConstraint expr, string message) |
4379 | + { |
4380 | + Assert.That(del, expr.Resolve(), message, null); |
4381 | + } |
4382 | + |
4383 | + /// <summary> |
4384 | + /// Apply a constraint to an actual value, succeeding if the constraint |
4385 | + /// is satisfied and throwing an assertion exception on failure. |
4386 | + /// </summary> |
4387 | + /// <param name="del">An ActualValueDelegate returning the value to be tested</param> |
4388 | + /// <param name="expr">A Constraint expression to be applied</param> |
4389 | + /// <param name="message">The message that will be displayed on failure</param> |
4390 | + /// <param name="args">Arguments to be used in formatting the message</param> |
4391 | + static public void That(ActualValueDelegate del, IResolveConstraint expr, string message, params object[] args) |
4392 | + { |
4393 | + Constraint constraint = expr.Resolve(); |
4394 | + |
4395 | + Assert.IncrementAssertCount(); |
4396 | + if (!constraint.Matches(del)) |
4397 | + { |
4398 | + MessageWriter writer = new TextMessageWriter(message, args); |
4399 | + constraint.WriteMessageTo(writer); |
4400 | + throw new AssertionException(writer.ToString()); |
4401 | + } |
4402 | + } |
4403 | +#endif |
4404 | + #endregion |
4405 | + |
4406 | + #region ref Object |
4407 | +#if CLR_2_0 |
4408 | + /// <summary> |
4409 | + /// Apply a constraint to a referenced value, succeeding if the constraint |
4410 | + /// is satisfied and throwing an assertion exception on failure. |
4411 | + /// </summary> |
4412 | + /// <param name="actual">The actual value to test</param> |
4413 | + /// <param name="expression">A Constraint to be applied</param> |
4414 | + static public void That<T>(ref T actual, IResolveConstraint expression) |
4415 | + { |
4416 | + Assert.That(ref actual, expression, null, null); |
4417 | + } |
4418 | + |
4419 | + /// <summary> |
4420 | + /// Apply a constraint to a referenced value, succeeding if the constraint |
4421 | + /// is satisfied and throwing an assertion exception on failure. |
4422 | + /// </summary> |
4423 | + /// <param name="actual">The actual value to test</param> |
4424 | + /// <param name="expression">A Constraint to be applied</param> |
4425 | + /// <param name="message">The message that will be displayed on failure</param> |
4426 | + static public void That<T>(ref T actual, IResolveConstraint expression, string message) |
4427 | + { |
4428 | + Assert.That(ref actual, expression, message, null); |
4429 | + } |
4430 | + |
4431 | + /// <summary> |
4432 | + /// Apply a constraint to a referenced value, succeeding if the constraint |
4433 | + /// is satisfied and throwing an assertion exception on failure. |
4434 | + /// </summary> |
4435 | + /// <param name="actual">The actual value to test</param> |
4436 | + /// <param name="expression">A Constraint to be applied</param> |
4437 | + /// <param name="message">The message that will be displayed on failure</param> |
4438 | + /// <param name="args">Arguments to be used in formatting the message</param> |
4439 | + static public void That<T>(ref T actual, IResolveConstraint expression, string message, params object[] args) |
4440 | + { |
4441 | + Constraint constraint = expression.Resolve(); |
4442 | + |
4443 | + Assert.IncrementAssertCount(); |
4444 | + if (!constraint.Matches(ref actual)) |
4445 | + { |
4446 | + MessageWriter writer = new TextMessageWriter(message, args); |
4447 | + constraint.WriteMessageTo(writer); |
4448 | + throw new AssertionException(writer.ToString()); |
4449 | + } |
4450 | + } |
4451 | +#else |
4452 | + /// <summary> |
4453 | + /// Apply a constraint to a referenced boolean, succeeding if the constraint |
4454 | + /// is satisfied and throwing an assertion exception on failure. |
4455 | + /// </summary> |
4456 | + /// <param name="actual">The actual value to test</param> |
4457 | + /// <param name="expression">A Constraint to be applied</param> |
4458 | + static public void That(ref bool actual, IResolveConstraint expression) |
4459 | + { |
4460 | + Assert.That(ref actual, expression, null, null); |
4461 | + } |
4462 | + |
4463 | + /// <summary> |
4464 | + /// Apply a constraint to a referenced value, succeeding if the constraint |
4465 | + /// is satisfied and throwing an assertion exception on failure. |
4466 | + /// </summary> |
4467 | + /// <param name="actual">The actual value to test</param> |
4468 | + /// <param name="expression">A Constraint to be applied</param> |
4469 | + /// <param name="message">The message that will be displayed on failure</param> |
4470 | + static public void That(ref bool actual, IResolveConstraint expression, string message) |
4471 | + { |
4472 | + Assert.That(ref actual, expression, message, null); |
4473 | + } |
4474 | + |
4475 | + /// <summary> |
4476 | + /// Apply a constraint to a referenced value, succeeding if the constraint |
4477 | + /// is satisfied and throwing an assertion exception on failure. |
4478 | + /// </summary> |
4479 | + /// <param name="actual">The actual value to test</param> |
4480 | + /// <param name="expression">A Constraint to be applied</param> |
4481 | + /// <param name="message">The message that will be displayed on failure</param> |
4482 | + /// <param name="args">Arguments to be used in formatting the message</param> |
4483 | + static public void That(ref bool actual, IResolveConstraint expression, string message, params object[] args) |
4484 | + { |
4485 | + Constraint constraint = expression.Resolve(); |
4486 | + |
4487 | + Assert.IncrementAssertCount(); |
4488 | + if (!constraint.Matches(ref actual)) |
4489 | + { |
4490 | + MessageWriter writer = new TextMessageWriter(message, args); |
4491 | + constraint.WriteMessageTo(writer); |
4492 | + throw new AssertionException(writer.ToString()); |
4493 | + } |
4494 | + } |
4495 | +#endif |
4496 | + #endregion |
4497 | + |
4498 | + #region Boolean |
4499 | + /// <summary> |
4500 | + /// Asserts that a condition is true. If the condition is false the method throws |
4501 | + /// an <see cref="AssertionException"/>. |
4502 | + /// </summary> |
4503 | + /// <param name="condition">The evaluated condition</param> |
4504 | + /// <param name="message">The message to display if the condition is false</param> |
4505 | + /// <param name="args">Arguments to be used in formatting the message</param> |
4506 | + static public void That(bool condition, string message, params object[] args) |
4507 | + { |
4508 | + Assert.That(condition, Is.True, message, args); |
4509 | + } |
4510 | + |
4511 | + /// <summary> |
4512 | + /// Asserts that a condition is true. If the condition is false the method throws |
4513 | + /// an <see cref="AssertionException"/>. |
4514 | + /// </summary> |
4515 | + /// <param name="condition">The evaluated condition</param> |
4516 | + /// <param name="message">The message to display if the condition is false</param> |
4517 | + static public void That(bool condition, string message) |
4518 | + { |
4519 | + Assert.That(condition, Is.True, message, null); |
4520 | + } |
4521 | + |
4522 | + /// <summary> |
4523 | + /// Asserts that a condition is true. If the condition is false the method throws |
4524 | + /// an <see cref="AssertionException"/>. |
4525 | + /// </summary> |
4526 | + /// <param name="condition">The evaluated condition</param> |
4527 | + static public void That(bool condition) |
4528 | + { |
4529 | + Assert.That(condition, Is.True, null, null); |
4530 | + } |
4531 | + #endregion |
4532 | + |
4533 | + /// <summary> |
4534 | + /// Asserts that the code represented by a delegate throws an exception |
4535 | + /// that satisfies the constraint provided. |
4536 | + /// </summary> |
4537 | + /// <param name="code">A TestDelegate to be executed</param> |
4538 | + /// <param name="constraint">A ThrowsConstraint used in the test</param> |
4539 | + static public void That(TestDelegate code, IResolveConstraint constraint) |
4540 | + { |
4541 | + Assert.That((object)code, constraint); |
4542 | + } |
4543 | + #endregion |
4544 | + |
4545 | + #region Throws, Catch and DoesNotThrow |
4546 | + |
4547 | + #region Throws |
4548 | + /// <summary> |
4549 | + /// Verifies that a delegate throws a particular exception when called. |
4550 | + /// </summary> |
4551 | + /// <param name="expression">A constraint to be satisfied by the exception</param> |
4552 | + /// <param name="code">A TestSnippet delegate</param> |
4553 | + /// <param name="message">The message that will be displayed on failure</param> |
4554 | + /// <param name="args">Arguments to be used in formatting the message</param> |
4555 | + public static Exception Throws(IResolveConstraint expression, TestDelegate code, string message, params object[] args) |
4556 | + { |
4557 | + Exception caughtException = null; |
4558 | + |
4559 | + try |
4560 | + { |
4561 | + code(); |
4562 | + } |
4563 | + catch (Exception ex) |
4564 | + { |
4565 | + caughtException = ex; |
4566 | + } |
4567 | + |
4568 | + Assert.That(caughtException, expression, message, args); |
4569 | + |
4570 | + return caughtException; |
4571 | + } |
4572 | + |
4573 | + /// <summary> |
4574 | + /// Verifies that a delegate throws a particular exception when called. |
4575 | + /// </summary> |
4576 | + /// <param name="expression">A constraint to be satisfied by the exception</param> |
4577 | + /// <param name="code">A TestSnippet delegate</param> |
4578 | + /// <param name="message">The message that will be displayed on failure</param> |
4579 | + public static Exception Throws(IResolveConstraint expression, TestDelegate code, string message) |
4580 | + { |
4581 | + return Throws(expression, code, message, null); |
4582 | + } |
4583 | + |
4584 | + /// <summary> |
4585 | + /// Verifies that a delegate throws a particular exception when called. |
4586 | + /// </summary> |
4587 | + /// <param name="expression">A constraint to be satisfied by the exception</param> |
4588 | + /// <param name="code">A TestSnippet delegate</param> |
4589 | + public static Exception Throws(IResolveConstraint expression, TestDelegate code) |
4590 | + { |
4591 | + return Throws(expression, code, string.Empty, null); |
4592 | + } |
4593 | + |
4594 | + /// <summary> |
4595 | + /// Verifies that a delegate throws a particular exception when called. |
4596 | + /// </summary> |
4597 | + /// <param name="expectedExceptionType">The exception Type expected</param> |
4598 | + /// <param name="code">A TestSnippet delegate</param> |
4599 | + /// <param name="message">The message that will be displayed on failure</param> |
4600 | + /// <param name="args">Arguments to be used in formatting the message</param> |
4601 | + public static Exception Throws(Type expectedExceptionType, TestDelegate code, string message, params object[] args) |
4602 | + { |
4603 | + return Throws(new ExactTypeConstraint(expectedExceptionType), code, message, args); |
4604 | + } |
4605 | + |
4606 | + /// <summary> |
4607 | + /// Verifies that a delegate throws a particular exception when called. |
4608 | + /// </summary> |
4609 | + /// <param name="expectedExceptionType">The exception Type expected</param> |
4610 | + /// <param name="code">A TestSnippet delegate</param> |
4611 | + /// <param name="message">The message that will be displayed on failure</param> |
4612 | + public static Exception Throws(Type expectedExceptionType, TestDelegate code, string message) |
4613 | + { |
4614 | + return Throws(new ExactTypeConstraint(expectedExceptionType), code, message, null); |
4615 | + } |
4616 | + |
4617 | + /// <summary> |
4618 | + /// Verifies that a delegate throws a particular exception when called. |
4619 | + /// </summary> |
4620 | + /// <param name="expectedExceptionType">The exception Type expected</param> |
4621 | + /// <param name="code">A TestSnippet delegate</param> |
4622 | + public static Exception Throws(Type expectedExceptionType, TestDelegate code) |
4623 | + { |
4624 | + return Throws(new ExactTypeConstraint(expectedExceptionType), code, string.Empty, null); |
4625 | + } |
4626 | + |
4627 | + #endregion |
4628 | + |
4629 | + #region Throws<T> |
4630 | +#if CLR_2_0 |
4631 | + /// <summary> |
4632 | + /// Verifies that a delegate throws a particular exception when called. |
4633 | + /// </summary> |
4634 | + /// <typeparam name="T">Type of the expected exception</typeparam> |
4635 | + /// <param name="code">A TestSnippet delegate</param> |
4636 | + /// <param name="message">The message that will be displayed on failure</param> |
4637 | + /// <param name="args">Arguments to be used in formatting the message</param> |
4638 | + public static T Throws<T>(TestDelegate code, string message, params object[] args) where T : Exception |
4639 | + { |
4640 | + return (T)Throws(typeof(T), code, message, args); |
4641 | + } |
4642 | + |
4643 | + /// <summary> |
4644 | + /// Verifies that a delegate throws a particular exception when called. |
4645 | + /// </summary> |
4646 | + /// <typeparam name="T">Type of the expected exception</typeparam> |
4647 | + /// <param name="code">A TestSnippet delegate</param> |
4648 | + /// <param name="message">The message that will be displayed on failure</param> |
4649 | + public static T Throws<T>(TestDelegate code, string message) where T : Exception |
4650 | + { |
4651 | + return Throws<T>(code, message, null); |
4652 | + } |
4653 | + |
4654 | + /// <summary> |
4655 | + /// Verifies that a delegate throws a particular exception when called. |
4656 | + /// </summary> |
4657 | + /// <typeparam name="T">Type of the expected exception</typeparam> |
4658 | + /// <param name="code">A TestSnippet delegate</param> |
4659 | + public static T Throws<T>(TestDelegate code) where T : Exception |
4660 | + { |
4661 | + return Throws<T>(code, string.Empty, null); |
4662 | + } |
4663 | +#endif |
4664 | + #endregion |
4665 | + |
4666 | + #region Catch |
4667 | + /// <summary> |
4668 | + /// Verifies that a delegate throws an exception when called |
4669 | + /// and returns it. |
4670 | + /// </summary> |
4671 | + /// <param name="code">A TestDelegate</param> |
4672 | + /// <param name="message">The message that will be displayed on failure</param> |
4673 | + /// <param name="args">Arguments to be used in formatting the message</param> |
4674 | + public static Exception Catch(TestDelegate code, string message, params object[] args) |
4675 | + { |
4676 | + return Throws(new InstanceOfTypeConstraint(typeof(Exception)), code, message, args); |
4677 | + } |
4678 | + |
4679 | + /// <summary> |
4680 | + /// Verifies that a delegate throws an exception when called |
4681 | + /// and returns it. |
4682 | + /// </summary> |
4683 | + /// <param name="code">A TestDelegate</param> |
4684 | + /// <param name="message">The message that will be displayed on failure</param> |
4685 | + public static Exception Catch(TestDelegate code, string message) |
4686 | + { |
4687 | + return Throws(new InstanceOfTypeConstraint(typeof(Exception)), code, message); |
4688 | + } |
4689 | + |
4690 | + /// <summary> |
4691 | + /// Verifies that a delegate throws an exception when called |
4692 | + /// and returns it. |
4693 | + /// </summary> |
4694 | + /// <param name="code">A TestDelegate</param> |
4695 | + public static Exception Catch(TestDelegate code) |
4696 | + { |
4697 | + return Throws(new InstanceOfTypeConstraint(typeof(Exception)), code); |
4698 | + } |
4699 | + |
4700 | + /// <summary> |
4701 | + /// Verifies that a delegate throws an exception of a certain Type |
4702 | + /// or one derived from it when called and returns it. |
4703 | + /// </summary> |
4704 | + /// <param name="expectedExceptionType">The expected Exception Type</param> |
4705 | + /// <param name="code">A TestDelegate</param> |
4706 | + /// <param name="message">The message that will be displayed on failure</param> |
4707 | + /// <param name="args">Arguments to be used in formatting the message</param> |
4708 | + public static Exception Catch(Type expectedExceptionType, TestDelegate code, string message, params object[] args) |
4709 | + { |
4710 | + return Throws(new InstanceOfTypeConstraint(expectedExceptionType), code, message, args); |
4711 | + } |
4712 | + |
4713 | + /// <summary> |
4714 | + /// Verifies that a delegate throws an exception of a certain Type |
4715 | + /// or one derived from it when called and returns it. |
4716 | + /// </summary> |
4717 | + /// <param name="expectedExceptionType">The expected Exception Type</param> |
4718 | + /// <param name="code">A TestDelegate</param> |
4719 | + /// <param name="message">The message that will be displayed on failure</param> |
4720 | + public static Exception Catch(Type expectedExceptionType, TestDelegate code, string message) |
4721 | + { |
4722 | + return Throws(new InstanceOfTypeConstraint(expectedExceptionType), code, message); |
4723 | + } |
4724 | + |
4725 | + /// <summary> |
4726 | + /// Verifies that a delegate throws an exception of a certain Type |
4727 | + /// or one derived from it when called and returns it. |
4728 | + /// </summary> |
4729 | + /// <param name="expectedExceptionType">The expected Exception Type</param> |
4730 | + /// <param name="code">A TestDelegate</param> |
4731 | + public static Exception Catch(Type expectedExceptionType, TestDelegate code) |
4732 | + { |
4733 | + return Throws(new InstanceOfTypeConstraint(expectedExceptionType), code); |
4734 | + } |
4735 | + #endregion |
4736 | + |
4737 | + #region Catch<T> |
4738 | +#if CLR_2_0 |
4739 | + /// <summary> |
4740 | + /// Verifies that a delegate throws an exception of a certain Type |
4741 | + /// or one derived from it when called and returns it. |
4742 | + /// </summary> |
4743 | + /// <param name="code">A TestDelegate</param> |
4744 | + /// <param name="message">The message that will be displayed on failure</param> |
4745 | + /// <param name="args">Arguments to be used in formatting the message</param> |
4746 | + public static T Catch<T>(TestDelegate code, string message, params object[] args) where T : System.Exception |
4747 | + { |
4748 | + return (T)Throws(new InstanceOfTypeConstraint(typeof(T)), code, message, args); |
4749 | + } |
4750 | + |
4751 | + /// <summary> |
4752 | + /// Verifies that a delegate throws an exception of a certain Type |
4753 | + /// or one derived from it when called and returns it. |
4754 | + /// </summary> |
4755 | + /// <param name="code">A TestDelegate</param> |
4756 | + /// <param name="message">The message that will be displayed on failure</param> |
4757 | + public static T Catch<T>(TestDelegate code, string message) where T : System.Exception |
4758 | + { |
4759 | + return (T)Throws(new InstanceOfTypeConstraint(typeof(T)), code, message); |
4760 | + } |
4761 | + |
4762 | + /// <summary> |
4763 | + /// Verifies that a delegate throws an exception of a certain Type |
4764 | + /// or one derived from it when called and returns it. |
4765 | + /// </summary> |
4766 | + /// <param name="code">A TestDelegate</param> |
4767 | + public static T Catch<T>(TestDelegate code) where T : System.Exception |
4768 | + { |
4769 | + return (T)Throws(new InstanceOfTypeConstraint(typeof(T)), code); |
4770 | + } |
4771 | +#endif |
4772 | + #endregion |
4773 | + |
4774 | + #region DoesNotThrow |
4775 | + |
4776 | + /// <summary> |
4777 | + /// Verifies that a delegate does not throw an exception |
4778 | + /// </summary> |
4779 | + /// <param name="code">A TestSnippet delegate</param> |
4780 | + /// <param name="message">The message that will be displayed on failure</param> |
4781 | + /// <param name="args">Arguments to be used in formatting the message</param> |
4782 | + public static void DoesNotThrow(TestDelegate code, string message, params object[] args) |
4783 | + { |
4784 | + try |
4785 | + { |
4786 | + code(); |
4787 | + } |
4788 | + catch (Exception ex) |
4789 | + { |
4790 | + TextMessageWriter writer = new TextMessageWriter(message, args); |
4791 | + writer.WriteLine("Unexpected exception: {0}", ex.GetType()); |
4792 | + Assert.Fail(writer.ToString()); |
4793 | + } |
4794 | + } |
4795 | + |
4796 | + /// <summary> |
4797 | + /// Verifies that a delegate does not throw an exception. |
4798 | + /// </summary> |
4799 | + /// <param name="code">A TestSnippet delegate</param> |
4800 | + /// <param name="message">The message that will be displayed on failure</param> |
4801 | + public static void DoesNotThrow(TestDelegate code, string message) |
4802 | + { |
4803 | + DoesNotThrow(code, message, null); |
4804 | + } |
4805 | + |
4806 | + /// <summary> |
4807 | + /// Verifies that a delegate does not throw an exception. |
4808 | + /// </summary> |
4809 | + /// <param name="code">A TestSnippet delegate</param> |
4810 | + public static void DoesNotThrow(TestDelegate code) |
4811 | + { |
4812 | + DoesNotThrow(code, string.Empty, null); |
4813 | + } |
4814 | + |
4815 | + #endregion |
4816 | + |
4817 | + #endregion |
4818 | + |
4819 | + #region True |
4820 | + |
4821 | + /// <summary> |
4822 | + /// Asserts that a condition is true. If the condition is false the method throws |
4823 | + /// an <see cref="AssertionException"/>. |
4824 | + /// </summary> |
4825 | + /// <param name="condition">The evaluated condition</param> |
4826 | + /// <param name="message">The message to display in case of failure</param> |
4827 | + /// <param name="args">Array of objects to be used in formatting the message</param> |
4828 | +public static void True(bool condition, string message, params object[] args) |
4829 | + { |
4830 | + Assert.That(condition, Is.True ,message, args); |
4831 | + } |
4832 | + /// <summary> |
4833 | + /// Asserts that a condition is true. If the condition is false the method throws |
4834 | + /// an <see cref="AssertionException"/>. |
4835 | + /// </summary> |
4836 | + /// <param name="condition">The evaluated condition</param> |
4837 | + /// <param name="message">The message to display in case of failure</param> |
4838 | +public static void True(bool condition, string message) |
4839 | + { |
4840 | + Assert.That(condition, Is.True ,message, null); |
4841 | + } |
4842 | + /// <summary> |
4843 | + /// Asserts that a condition is true. If the condition is false the method throws |
4844 | + /// an <see cref="AssertionException"/>. |
4845 | + /// </summary> |
4846 | + /// <param name="condition">The evaluated condition</param> |
4847 | +public static void True(bool condition) |
4848 | + { |
4849 | + Assert.That(condition, Is.True ,null, null); |
4850 | + } |
4851 | + |
4852 | + /// <summary> |
4853 | + /// Asserts that a condition is true. If the condition is false the method throws |
4854 | + /// an <see cref="AssertionException"/>. |
4855 | + /// </summary> |
4856 | + /// <param name="condition">The evaluated condition</param> |
4857 | + /// <param name="message">The message to display in case of failure</param> |
4858 | + /// <param name="args">Array of objects to be used in formatting the message</param> |
4859 | +public static void IsTrue(bool condition, string message, params object[] args) |
4860 | + { |
4861 | + Assert.That(condition, Is.True ,message, args); |
4862 | + } |
4863 | + /// <summary> |
4864 | + /// Asserts that a condition is true. If the condition is false the method throws |
4865 | + /// an <see cref="AssertionException"/>. |
4866 | + /// </summary> |
4867 | + /// <param name="condition">The evaluated condition</param> |
4868 | + /// <param name="message">The message to display in case of failure</param> |
4869 | +public static void IsTrue(bool condition, string message) |
4870 | + { |
4871 | + Assert.That(condition, Is.True ,message, null); |
4872 | + } |
4873 | + /// <summary> |
4874 | + /// Asserts that a condition is true. If the condition is false the method throws |
4875 | + /// an <see cref="AssertionException"/>. |
4876 | + /// </summary> |
4877 | + /// <param name="condition">The evaluated condition</param> |
4878 | +public static void IsTrue(bool condition) |
4879 | + { |
4880 | + Assert.That(condition, Is.True ,null, null); |
4881 | + } |
4882 | + |
4883 | + #endregion |
4884 | + |
4885 | + #region False |
4886 | + |
4887 | + /// <summary> |
4888 | + /// Asserts that a condition is false. If the condition is true the method throws |
4889 | + /// an <see cref="AssertionException"/>. |
4890 | + /// </summary> |
4891 | + /// <param name="condition">The evaluated condition</param> |
4892 | + /// <param name="message">The message to display in case of failure</param> |
4893 | + /// <param name="args">Array of objects to be used in formatting the message</param> |
4894 | +public static void False(bool condition, string message, params object[] args) |
4895 | + { |
4896 | + Assert.That(condition, Is.False ,message, args); |
4897 | + } |
4898 | + /// <summary> |
4899 | + /// Asserts that a condition is false. If the condition is true the method throws |
4900 | + /// an <see cref="AssertionException"/>. |
4901 | + /// </summary> |
4902 | + /// <param name="condition">The evaluated condition</param> |
4903 | + /// <param name="message">The message to display in case of failure</param> |
4904 | +public static void False(bool condition, string message) |
4905 | + { |
4906 | + Assert.That(condition, Is.False ,message, null); |
4907 | + } |
4908 | + /// <summary> |
4909 | + /// Asserts that a condition is false. If the condition is true the method throws |
4910 | + /// an <see cref="AssertionException"/>. |
4911 | + /// </summary> |
4912 | + /// <param name="condition">The evaluated condition</param> |
4913 | +public static void False(bool condition) |
4914 | + { |
4915 | + Assert.That(condition, Is.False ,null, null); |
4916 | + } |
4917 | + |
4918 | + /// <summary> |
4919 | + /// Asserts that a condition is false. If the condition is true the method throws |
4920 | + /// an <see cref="AssertionException"/>. |
4921 | + /// </summary> |
4922 | + /// <param name="condition">The evaluated condition</param> |
4923 | + /// <param name="message">The message to display in case of failure</param> |
4924 | + /// <param name="args">Array of objects to be used in formatting the message</param> |
4925 | +public static void IsFalse(bool condition, string message, params object[] args) |
4926 | + { |
4927 | + Assert.That(condition, Is.False ,message, args); |
4928 | + } |
4929 | + /// <summary> |
4930 | + /// Asserts that a condition is false. If the condition is true the method throws |
4931 | + /// an <see cref="AssertionException"/>. |
4932 | + /// </summary> |
4933 | + /// <param name="condition">The evaluated condition</param> |
4934 | + /// <param name="message">The message to display in case of failure</param> |
4935 | +public static void IsFalse(bool condition, string message) |
4936 | + { |
4937 | + Assert.That(condition, Is.False ,message, null); |
4938 | + } |
4939 | + /// <summary> |
4940 | + /// Asserts that a condition is false. If the condition is true the method throws |
4941 | + /// an <see cref="AssertionException"/>. |
4942 | + /// </summary> |
4943 | + /// <param name="condition">The evaluated condition</param> |
4944 | +public static void IsFalse(bool condition) |
4945 | + { |
4946 | + Assert.That(condition, Is.False ,null, null); |
4947 | + } |
4948 | + |
4949 | + #endregion |
4950 | + |
4951 | + #region NotNull |
4952 | + |
4953 | + /// <summary> |
4954 | + /// Verifies that the object that is passed in is not equal to <code>null</code> |
4955 | + /// If the object is <code>null</code> then an <see cref="AssertionException"/> |
4956 | + /// is thrown. |
4957 | + /// </summary> |
4958 | + /// <param name="anObject">The object that is to be tested</param> |
4959 | + /// <param name="message">The message to display in case of failure</param> |
4960 | + /// <param name="args">Array of objects to be used in formatting the message</param> |
4961 | +public static void NotNull(object anObject, string message, params object[] args) |
4962 | + { |
4963 | + Assert.That(anObject, Is.Not.Null ,message, args); |
4964 | + } |
4965 | + /// <summary> |
4966 | + /// Verifies that the object that is passed in is not equal to <code>null</code> |
4967 | + /// If the object is <code>null</code> then an <see cref="AssertionException"/> |
4968 | + /// is thrown. |
4969 | + /// </summary> |
4970 | + /// <param name="anObject">The object that is to be tested</param> |
4971 | + /// <param name="message">The message to display in case of failure</param> |
4972 | +public static void NotNull(object anObject, string message) |
4973 | + { |
4974 | + Assert.That(anObject, Is.Not.Null ,message, null); |
4975 | + } |
4976 | + /// <summary> |
4977 | + /// Verifies that the object that is passed in is not equal to <code>null</code> |
4978 | + /// If the object is <code>null</code> then an <see cref="AssertionException"/> |
4979 | + /// is thrown. |
4980 | + /// </summary> |
4981 | + /// <param name="anObject">The object that is to be tested</param> |
4982 | +public static void NotNull(object anObject) |
4983 | + { |
4984 | + Assert.That(anObject, Is.Not.Null ,null, null); |
4985 | + } |
4986 | + |
4987 | + /// <summary> |
4988 | + /// Verifies that the object that is passed in is not equal to <code>null</code> |
4989 | + /// If the object is <code>null</code> then an <see cref="AssertionException"/> |
4990 | + /// is thrown. |
4991 | + /// </summary> |
4992 | + /// <param name="anObject">The object that is to be tested</param> |
4993 | + /// <param name="message">The message to display in case of failure</param> |
4994 | + /// <param name="args">Array of objects to be used in formatting the message</param> |
4995 | +public static void IsNotNull(object anObject, string message, params object[] args) |
4996 | + { |
4997 | + Assert.That(anObject, Is.Not.Null ,message, args); |
4998 | + } |
4999 | + /// <summary> |
5000 | + /// Verifies that the object that is passed in is not equal to <code>null</code> |
I fixed two bugs in this branch:
* Fixed bug #432805: Some Framework Tests don't run on Linux
* Fixed bug with newlines in exception messages on Linux