1 // ****************************************************************
\r
2 // This is free software licensed under the NUnit license. You
\r
3 // may obtain a copy of the license as well as information regarding
\r
4 // copyright ownership at http://nunit.org/?p=license&r=2.4.
\r
5 // ****************************************************************
\r
8 using System.Collections;
\r
9 using System.ComponentModel;
\r
10 using NUnit.Framework.Constraints;
\r
11 using NUnit.Framework.SyntaxHelpers;
\r
13 namespace NUnit.Framework
\r
16 /// The Assert class contains a collection of static methods that
\r
17 /// implement the most common assertions used in NUnit.
\r
21 #region Assert Counting
\r
23 private static int counter = 0;
\r
26 /// Gets the number of assertions executed so far and
\r
27 /// resets the counter to zero.
\r
29 public static int Counter
\r
39 private static void IncrementAssertCount()
\r
49 /// We don't actually want any instances of this object, but some people
\r
50 /// like to inherit from it to add other static methods. Hence, the
\r
51 /// protected constructor disallows any instances of this object.
\r
53 protected Assert() {}
\r
57 #region Equals and ReferenceEquals
\r
60 /// The Equals method throws an AssertionException. This is done
\r
61 /// to make sure there is no mistake by calling this function.
\r
63 /// <param name="a"></param>
\r
64 /// <param name="b"></param>
\r
65 [EditorBrowsable(EditorBrowsableState.Never)]
\r
66 public static new bool Equals(object a, object b)
\r
68 throw new AssertionException("Assert.Equals should not be used for Assertions");
\r
72 /// override the default ReferenceEquals to throw an AssertionException. This
\r
73 /// implementation makes sure there is no mistake in calling this function
\r
74 /// as part of Assert.
\r
76 /// <param name="a"></param>
\r
77 /// <param name="b"></param>
\r
78 public static new void ReferenceEquals(object a, object b)
\r
80 throw new AssertionException("Assert.ReferenceEquals should not be used for Assertions");
\r
88 /// Asserts that a condition is true. If the condition is false the method throws
\r
89 /// an <see cref="AssertionException"/>.
\r
91 /// <param name="condition">The evaluated condition</param>
\r
92 /// <param name="message">The message to display if the condition is false</param>
\r
93 /// <param name="args">Arguments to be used in formatting the message</param>
\r
94 static public void IsTrue(bool condition, string message, params object[] args)
\r
96 Assert.That(condition, Is.True, message, args);
\r
100 /// Asserts that a condition is true. If the condition is false the method throws
\r
101 /// an <see cref="AssertionException"/>.
\r
103 /// <param name="condition">The evaluated condition</param>
\r
104 /// <param name="message">The message to display if the condition is false</param>
\r
105 static public void IsTrue(bool condition, string message)
\r
107 Assert.IsTrue(condition, message, null);
\r
111 /// Asserts that a condition is true. If the condition is false the method throws
\r
112 /// an <see cref="AssertionException"/>.
\r
114 /// <param name="condition">The evaluated condition</param>
\r
115 static public void IsTrue(bool condition)
\r
117 Assert.IsTrue(condition, null, null);
\r
125 /// Asserts that a condition is false. If the condition is true the method throws
\r
126 /// an <see cref="AssertionException"/>.
\r
128 /// <param name="condition">The evaluated condition</param>
\r
129 /// <param name="message">The message to display if the condition is true</param>
\r
130 /// <param name="args">Arguments to be used in formatting the message</param>
\r
131 static public void IsFalse(bool condition, string message, params object[] args)
\r
133 Assert.That(condition, Is.False, message, args);
\r
137 /// Asserts that a condition is false. If the condition is true the method throws
\r
138 /// an <see cref="AssertionException"/>.
\r
140 /// <param name="condition">The evaluated condition</param>
\r
141 /// <param name="message">The message to display if the condition is true</param>
\r
142 static public void IsFalse(bool condition, string message)
\r
144 Assert.IsFalse( condition, message, null );
\r
148 /// Asserts that a condition is false. If the condition is true the method throws
\r
149 /// an <see cref="AssertionException"/>.
\r
151 /// <param name="condition">The evaluated condition</param>
\r
152 static public void IsFalse(bool condition)
\r
154 Assert.IsFalse(condition, string.Empty, null);
\r
162 /// Verifies that the object that is passed in is not equal to <code>null</code>
\r
163 /// If the object is <code>null</code> then an <see cref="AssertionException"/>
\r
166 /// <param name="anObject">The object that is to be tested</param>
\r
167 /// <param name="message">The message to be displayed when the object is null</param>
\r
168 /// <param name="args">Arguments to be used in formatting the message</param>
\r
169 static public void IsNotNull(Object anObject, string message, params object[] args)
\r
171 Assert.That(anObject, Is.Not.Null, message, args);
\r
175 /// Verifies that the object that is passed in is not equal to <code>null</code>
\r
176 /// If the object is <code>null</code> then an <see cref="AssertionException"/>
\r
179 /// <param name="anObject">The object that is to be tested</param>
\r
180 /// <param name="message">The message to be displayed when the object is null</param>
\r
181 static public void IsNotNull(Object anObject, string message)
\r
183 Assert.IsNotNull(anObject, message, null);
\r
187 /// Verifies that the object that is passed in is not equal to <code>null</code>
\r
188 /// If the object is <code>null</code> then an <see cref="AssertionException"/>
\r
191 /// <param name="anObject">The object that is to be tested</param>
\r
192 static public void IsNotNull(Object anObject)
\r
194 Assert.IsNotNull(anObject, string.Empty, null);
\r
202 /// Verifies that the object that is passed in is equal to <code>null</code>
\r
203 /// If the object is not <code>null</code> then an <see cref="AssertionException"/>
\r
206 /// <param name="anObject">The object that is to be tested</param>
\r
207 /// <param name="message">The message to be displayed when the object is not null</param>
\r
208 /// <param name="args">Arguments to be used in formatting the message</param>
\r
209 static public void IsNull(Object anObject, string message, params object[] args)
\r
211 Assert.That( anObject, Is.Null, message, args );
\r
215 /// Verifies that the object that is passed in is equal to <code>null</code>
\r
216 /// If the object is not <code>null</code> then an <see cref="AssertionException"/>
\r
219 /// <param name="anObject">The object that is to be tested</param>
\r
220 /// <param name="message">The message to be displayed when the object is not null</param>
\r
221 static public void IsNull(Object anObject, string message)
\r
223 Assert.IsNull(anObject, message, null);
\r
227 /// Verifies that the object that is passed in is equal to <code>null</code>
\r
228 /// If the object is not null <code>null</code> then an <see cref="AssertionException"/>
\r
231 /// <param name="anObject">The object that is to be tested</param>
\r
232 static public void IsNull(Object anObject)
\r
234 Assert.IsNull(anObject, string.Empty, null);
\r
242 /// Verifies that the double is passed is an <code>NaN</code> value.
\r
243 /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/>
\r
246 /// <param name="aDouble">The value that is to be tested</param>
\r
247 /// <param name="message">The message to be displayed when the object is not null</param>
\r
248 /// <param name="args">Arguments to be used in formatting the message</param>
\r
249 static public void IsNaN(double aDouble, string message, params object[] args)
\r
251 Assert.That(aDouble, Is.NaN, message, args);
\r
255 /// Verifies that the double is passed is an <code>NaN</code> value.
\r
256 /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/>
\r
259 /// <param name="aDouble">The object that is to be tested</param>
\r
260 /// <param name="message">The message to be displayed when the object is not null</param>
\r
261 static public void IsNaN(double aDouble, string message)
\r
263 Assert.IsNaN(aDouble, message, null);
\r
267 /// Verifies that the double is passed is an <code>NaN</code> value.
\r
268 /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/>
\r
271 /// <param name="aDouble">The object that is to be tested</param>
\r
272 static public void IsNaN(double aDouble)
\r
274 Assert.IsNaN(aDouble, string.Empty, null);
\r
282 /// Assert that a string is empty - that is equal to string.Empty
\r
284 /// <param name="aString">The string to be tested</param>
\r
285 /// <param name="message">The message to be displayed on failure</param>
\r
286 /// <param name="args">Arguments to be used in formatting the message</param>
\r
287 public static void IsEmpty( string aString, string message, params object[] args )
\r
289 Assert.That(aString, new EmptyStringConstraint(), message, args);
\r
293 /// Assert that a string is empty - that is equal to string.Emtpy
\r
295 /// <param name="aString">The string to be tested</param>
\r
296 /// <param name="message">The message to be displayed on failure</param>
\r
297 public static void IsEmpty( string aString, string message )
\r
299 IsEmpty( aString, message, null );
\r
303 /// Assert that a string is empty - that is equal to string.Emtpy
\r
305 /// <param name="aString">The string to be tested</param>
\r
306 public static void IsEmpty( string aString )
\r
308 IsEmpty( aString, string.Empty, null );
\r
312 /// Assert that an array, list or other collection is empty
\r
314 /// <param name="collection">An array, list or other collection implementing ICollection</param>
\r
315 /// <param name="message">The message to be displayed on failure</param>
\r
316 /// <param name="args">Arguments to be used in formatting the message</param>
\r
317 public static void IsEmpty( ICollection collection, string message, params object[] args )
\r
319 Assert.That(collection, new EmptyCollectionConstraint(), message, args);
\r
323 /// Assert that an array, list or other collection is empty
\r
325 /// <param name="collection">An array, list or other collection implementing ICollection</param>
\r
326 /// <param name="message">The message to be displayed on failure</param>
\r
327 public static void IsEmpty( ICollection collection, string message )
\r
329 IsEmpty( collection, message, null );
\r
333 /// Assert that an array,list or other collection is empty
\r
335 /// <param name="collection">An array, list or other collection implementing ICollection</param>
\r
336 public static void IsEmpty( ICollection collection )
\r
338 IsEmpty( collection, string.Empty, null );
\r
344 /// Assert that a string is not empty - that is not equal to string.Empty
\r
346 /// <param name="aString">The string to be tested</param>
\r
347 /// <param name="message">The message to be displayed on failure</param>
\r
348 /// <param name="args">Arguments to be used in formatting the message</param>
\r
349 public static void IsNotEmpty( string aString, string message, params object[] args )
\r
351 Assert.That(aString, Is.Not.Empty, message, args);
\r
355 /// Assert that a string is empty - that is equal to string.Emtpy
\r
357 /// <param name="aString">The string to be tested</param>
\r
358 /// <param name="message">The message to be displayed on failure</param>
\r
359 public static void IsNotEmpty( string aString, string message )
\r
361 IsNotEmpty( aString, message, null );
\r
365 /// Assert that a string is empty - that is equal to string.Emtpy
\r
367 /// <param name="aString">The string to be tested</param>
\r
368 public static void IsNotEmpty( string aString )
\r
370 IsNotEmpty( aString, string.Empty, null );
\r
374 /// Assert that an array, list or other collection is empty
\r
376 /// <param name="collection">An array, list or other collection implementing ICollection</param>
\r
377 /// <param name="message">The message to be displayed on failure</param>
\r
378 /// <param name="args">Arguments to be used in formatting the message</param>
\r
379 public static void IsNotEmpty( ICollection collection, string message, params object[] args )
\r
381 Assert.That(collection, Is.Not.Empty, message, args);
\r
385 /// Assert that an array, list or other collection is empty
\r
387 /// <param name="collection">An array, list or other collection implementing ICollection</param>
\r
388 /// <param name="message">The message to be displayed on failure</param>
\r
389 public static void IsNotEmpty( ICollection collection, string message )
\r
391 IsNotEmpty( collection, message, null );
\r
395 /// Assert that an array,list or other collection is empty
\r
397 /// <param name="collection">An array, list or other collection implementing ICollection</param>
\r
398 public static void IsNotEmpty( ICollection collection )
\r
400 IsNotEmpty( collection, string.Empty, null );
\r
404 #region IsAssignableFrom
\r
406 /// Asserts that an object may be assigned a value of a given Type.
\r
408 /// <param name="expected">The expected Type.</param>
\r
409 /// <param name="actual">The object under examination</param>
\r
410 static public void IsAssignableFrom( System.Type expected, object actual )
\r
412 IsAssignableFrom(expected, actual, "");
\r
416 /// Asserts that an object may be assigned a value of a given Type.
\r
418 /// <param name="expected">The expected Type.</param>
\r
419 /// <param name="actual">The object under examination</param>
\r
420 /// <param name="message">The messge to display in case of failure</param>
\r
421 static public void IsAssignableFrom( System.Type expected, object actual, string message )
\r
423 IsAssignableFrom(expected, actual, message, null);
\r
427 /// Asserts that an object may be assigned a value of a given Type.
\r
429 /// <param name="expected">The expected Type.</param>
\r
430 /// <param name="actual">The object under examination</param>
\r
431 /// <param name="message">The message to display in case of failure</param>
\r
432 /// <param name="args">Array of objects to be used in formatting the message</param>
\r
433 static public void IsAssignableFrom( System.Type expected, object actual, string message, params object[] args )
\r
435 Assert.That(actual, Is.AssignableFrom(expected), message, args);
\r
439 #region IsNotAssignableFrom
\r
441 /// Asserts that an object may not be assigned a value of a given Type.
\r
443 /// <param name="expected">The expected Type.</param>
\r
444 /// <param name="actual">The object under examination</param>
\r
445 static public void IsNotAssignableFrom( System.Type expected, object actual )
\r
447 IsNotAssignableFrom(expected, actual, "");
\r
451 /// Asserts that an object may not be assigned a value of a given Type.
\r
453 /// <param name="expected">The expected Type.</param>
\r
454 /// <param name="actual">The object under examination</param>
\r
455 /// <param name="message">The messge to display in case of failure</param>
\r
456 static public void IsNotAssignableFrom( System.Type expected, object actual, string message )
\r
458 IsNotAssignableFrom(expected, actual, message, null);
\r
462 /// Asserts that an object may not be assigned a value of a given Type.
\r
464 /// <param name="expected">The expected Type.</param>
\r
465 /// <param name="actual">The object under examination</param>
\r
466 /// <param name="message">The message to display in case of failure</param>
\r
467 /// <param name="args">Array of objects to be used in formatting the message</param>
\r
468 static public void IsNotAssignableFrom( System.Type expected, object actual, string message, params object[] args )
\r
470 Assert.That(actual, Is.Not.AssignableFrom(expected), message, args);
\r
474 #region IsInstanceOfType
\r
476 /// Asserts that an object is an instance of a given type.
\r
478 /// <param name="expected">The expected Type</param>
\r
479 /// <param name="actual">The object being examined</param>
\r
480 public static void IsInstanceOfType( System.Type expected, object actual )
\r
482 IsInstanceOfType( expected, actual, string.Empty, null );
\r
486 /// Asserts that an object is an instance of a given type.
\r
488 /// <param name="expected">The expected Type</param>
\r
489 /// <param name="actual">The object being examined</param>
\r
490 /// <param name="message">A message to display in case of failure</param>
\r
491 public static void IsInstanceOfType( System.Type expected, object actual, string message )
\r
493 IsInstanceOfType( expected, actual, message, null );
\r
497 /// Asserts that an object is an instance of a given type.
\r
499 /// <param name="expected">The expected Type</param>
\r
500 /// <param name="actual">The object being examined</param>
\r
501 /// <param name="message">A message to display in case of failure</param>
\r
502 /// <param name="args">An array of objects to be used in formatting the message</param>
\r
503 public static void IsInstanceOfType( System.Type expected, object actual, string message, params object[] args )
\r
505 Assert.That(actual, Is.InstanceOfType(expected), message, args);
\r
509 #region IsNotInstanceOfType
\r
511 /// Asserts that an object is not an instance of a given type.
\r
513 /// <param name="expected">The expected Type</param>
\r
514 /// <param name="actual">The object being examined</param>
\r
515 public static void IsNotInstanceOfType( System.Type expected, object actual )
\r
517 IsNotInstanceOfType( expected, actual, string.Empty, null );
\r
521 /// Asserts that an object is not an instance of a given type.
\r
523 /// <param name="expected">The expected Type</param>
\r
524 /// <param name="actual">The object being examined</param>
\r
525 /// <param name="message">A message to display in case of failure</param>
\r
526 public static void IsNotInstanceOfType( System.Type expected, object actual, string message )
\r
528 IsNotInstanceOfType( expected, actual, message, null );
\r
532 /// Asserts that an object is not an instance of a given type.
\r
534 /// <param name="expected">The expected Type</param>
\r
535 /// <param name="actual">The object being examined</param>
\r
536 /// <param name="message">A message to display in case of failure</param>
\r
537 /// <param name="args">An array of objects to be used in formatting the message</param>
\r
538 public static void IsNotInstanceOfType( System.Type expected, object actual, string message, params object[] args )
\r
540 Assert.That(actual, Is.Not.InstanceOfType(expected), message, args);
\r
549 /// Verifies that two ints are equal. If they are not, then an
\r
550 /// <see cref="AssertionException"/> is thrown.
\r
552 /// <param name="expected">The expected value</param>
\r
553 /// <param name="actual">The actual value</param>
\r
554 /// <param name="message">The message that will be displayed on failure</param>
\r
555 /// <param name="args">Arguments to be used in formatting the message</param>
\r
556 static public void AreEqual(int expected,
\r
557 int actual, string message, params object[] args)
\r
559 Assert.That(actual, Is.EqualTo(expected), message, args);
\r
563 /// Verifies that two ints are equal. If they are not, then an
\r
564 /// <see cref="AssertionException"/> is thrown.
\r
566 /// <param name="expected">The expected value</param>
\r
567 /// <param name="actual">The actual value</param>
\r
568 /// <param name="message">The message that will be displayed on failure</param>
\r
569 static public void AreEqual(int expected, int actual, string message)
\r
571 Assert.AreEqual(expected, actual, message, null);
\r
575 /// Verifies that two ints are equal. If they are not, then an
\r
576 /// <see cref="AssertionException"/> is thrown.
\r
578 /// <param name="expected">The expected value</param>
\r
579 /// <param name="actual">The actual value</param>
\r
580 static public void AreEqual(int expected, int actual)
\r
582 Assert.AreEqual(expected, actual, string.Empty, null);
\r
590 /// Verifies that two longs are equal. If they are not, then an
\r
591 /// <see cref="AssertionException"/> is thrown.
\r
593 /// <param name="expected">The expected value</param>
\r
594 /// <param name="actual">The actual value</param>
\r
595 /// <param name="message">The message that will be displayed on failure</param>
\r
596 /// <param name="args">Arguments to be used in formatting the message</param>
\r
597 static public void AreEqual(long expected,
\r
598 long actual, string message, params object[] args)
\r
600 Assert.That(actual, Is.EqualTo(expected), message, args);
\r
604 /// Verifies that two longs are equal. If they are not, then an
\r
605 /// <see cref="AssertionException"/> is thrown.
\r
607 /// <param name="expected">The expected value</param>
\r
608 /// <param name="actual">The actual value</param>
\r
609 /// <param name="message">The message that will be displayed on failure</param>
\r
610 static public void AreEqual(long expected, long actual, string message)
\r
612 Assert.AreEqual(expected, actual, message, null);
\r
616 /// Verifies that two longs are equal. If they are not, then an
\r
617 /// <see cref="AssertionException"/> is thrown.
\r
619 /// <param name="expected">The expected value</param>
\r
620 /// <param name="actual">The actual value</param>
\r
621 static public void AreEqual(long expected, long actual)
\r
623 Assert.AreEqual(expected, actual, string.Empty, null);
\r
631 /// Verifies that two uints are equal. If they are not, then an
\r
632 /// <see cref="AssertionException"/> is thrown.
\r
634 /// <param name="expected">The expected value</param>
\r
635 /// <param name="actual">The actual value</param>
\r
636 /// <param name="message">The message that will be displayed on failure</param>
\r
637 /// <param name="args">Arguments to be used in formatting the message</param>
\r
638 [CLSCompliant(false)]
\r
639 static public void AreEqual(uint expected,
\r
640 uint actual, string message, params object[] args)
\r
642 Assert.That(actual, Is.EqualTo(expected), message, args);
\r
646 /// Verifies that two uints are equal. If they are not, then an
\r
647 /// <see cref="AssertionException"/> is thrown.
\r
649 /// <param name="expected">The expected value</param>
\r
650 /// <param name="actual">The actual value</param>
\r
651 /// <param name="message">The message that will be displayed on failure</param>
\r
652 [CLSCompliant(false)]
\r
653 static public void AreEqual(uint expected, uint actual, string message)
\r
655 Assert.AreEqual(expected, actual, message, null);
\r
659 /// Verifies that two uints are equal. If they are not, then an
\r
660 /// <see cref="AssertionException"/> is thrown.
\r
662 /// <param name="expected">The expected value</param>
\r
663 /// <param name="actual">The actual value</param>
\r
664 [CLSCompliant(false)]
\r
665 static public void AreEqual(uint expected, uint actual)
\r
667 Assert.AreEqual(expected, actual, string.Empty, null);
\r
675 /// Verifies that two ulongs are equal. If they are not, then an
\r
676 /// <see cref="AssertionException"/> is thrown.
\r
678 /// <param name="expected">The expected value</param>
\r
679 /// <param name="actual">The actual value</param>
\r
680 /// <param name="message">The message that will be displayed on failure</param>
\r
681 /// <param name="args">Arguments to be used in formatting the message</param>
\r
682 [CLSCompliant(false)]
\r
683 static public void AreEqual(ulong expected,
\r
684 ulong actual, string message, params object[] args)
\r
686 Assert.That(actual, Is.EqualTo(expected), message, args);
\r
690 /// Verifies that two ulongs are equal. If they are not, then an
\r
691 /// <see cref="AssertionException"/> is thrown.
\r
693 /// <param name="expected">The expected value</param>
\r
694 /// <param name="actual">The actual value</param>
\r
695 /// <param name="message">The message that will be displayed on failure</param>
\r
696 [CLSCompliant(false)]
\r
697 static public void AreEqual(ulong expected, ulong actual, string message)
\r
699 Assert.AreEqual(expected, actual, message, null);
\r
703 /// Verifies that two ulongs are equal. If they are not, then an
\r
704 /// <see cref="AssertionException"/> is thrown.
\r
706 /// <param name="expected">The expected value</param>
\r
707 /// <param name="actual">The actual value</param>
\r
708 [CLSCompliant(false)]
\r
709 static public void AreEqual(ulong expected, ulong actual)
\r
711 Assert.AreEqual(expected, actual, string.Empty, null);
\r
719 /// Verifies that two decimals are equal. If they are not, then an
\r
720 /// <see cref="AssertionException"/> is thrown.
\r
722 /// <param name="expected">The expected value</param>
\r
723 /// <param name="actual">The actual value</param>
\r
724 /// <param name="message">The message that will be displayed on failure</param>
\r
725 /// <param name="args">Arguments to be used in formatting the message</param>
\r
726 static public void AreEqual(decimal expected,
\r
727 decimal actual, string message, params object[] args)
\r
729 Assert.That(actual, Is.EqualTo(expected), message, args);
\r
733 /// Verifies that two decimal are equal. If they are not, then an
\r
734 /// <see cref="AssertionException"/> is thrown.
\r
736 /// <param name="expected">The expected value</param>
\r
737 /// <param name="actual">The actual value</param>
\r
738 /// <param name="message">The message that will be displayed on failure</param>
\r
739 static public void AreEqual(decimal expected, decimal actual, string message)
\r
741 Assert.AreEqual( expected, actual, message, null );
\r
745 /// Verifies that two decimals are equal. If they are not, then an
\r
746 /// <see cref="AssertionException"/> is thrown.
\r
748 /// <param name="expected">The expected value</param>
\r
749 /// <param name="actual">The actual value</param>
\r
750 static public void AreEqual(decimal expected, decimal actual )
\r
752 Assert.AreEqual( expected, actual, string.Empty, null );
\r
760 /// Verifies that two doubles are equal considering a delta. If the
\r
761 /// expected value is infinity then the delta value is ignored. If
\r
762 /// they are not equals then an <see cref="AssertionException"/> is
\r
765 /// <param name="expected">The expected value</param>
\r
766 /// <param name="actual">The actual value</param>
\r
767 /// <param name="delta">The maximum acceptable difference between the
\r
768 /// the expected and the actual</param>
\r
769 /// <param name="message">The message that will be displayed on failure</param>
\r
770 /// <param name="args">Arguments to be used in formatting the message</param>
\r
771 static public void AreEqual(double expected,
\r
772 double actual, double delta, string message, params object[] args)
\r
774 Constraint constraint = new EqualConstraint( expected );
\r
775 if ( double.IsNaN(expected) || double.IsInfinity(expected) )
\r
776 Assert.That(actual, Is.EqualTo( expected ), message, args);
\r
778 Assert.That(actual, Is.EqualTo(expected).Within(delta), message, args);
\r
782 /// Verifies that two doubles are equal considering a delta. If the
\r
783 /// expected value is infinity then the delta value is ignored. If
\r
784 /// they are not equals then an <see cref="AssertionException"/> is
\r
787 /// <param name="expected">The expected value</param>
\r
788 /// <param name="actual">The actual value</param>
\r
789 /// <param name="delta">The maximum acceptable difference between the
\r
790 /// the expected and the actual</param>
\r
791 /// <param name="message">The message that will be displayed on failure</param>
\r
792 static public void AreEqual(double expected,
\r
793 double actual, double delta, string message)
\r
795 Assert.AreEqual( expected, actual, delta, message, null );
\r
799 /// Verifies that two doubles are equal considering a delta. If the
\r
800 /// expected value is infinity then the delta value is ignored. If
\r
801 /// they are not equals then an <see cref="AssertionException"/> is
\r
804 /// <param name="expected">The expected value</param>
\r
805 /// <param name="actual">The actual value</param>
\r
806 /// <param name="delta">The maximum acceptable difference between the
\r
807 /// the expected and the actual</param>
\r
808 static public void AreEqual(double expected, double actual, double delta)
\r
810 Assert.AreEqual(expected, actual, delta, string.Empty, null);
\r
818 /// Verifies that two floats are equal considering a delta. If the
\r
819 /// expected value is infinity then the delta value is ignored. If
\r
820 /// they are not equals then an <see cref="AssertionException"/> is
\r
823 /// <param name="expected">The expected value</param>
\r
824 /// <param name="actual">The actual value</param>
\r
825 /// <param name="delta">The maximum acceptable difference between the
\r
826 /// the expected and the actual</param>
\r
827 /// <param name="message">The message displayed upon failure</param>
\r
828 /// <param name="args">Arguments to be used in formatting the message</param>
\r
829 static public void AreEqual(float expected,
\r
830 float actual, float delta, string message, params object[] args)
\r
832 if (float.IsNaN(expected) || float.IsInfinity(expected))
\r
833 Assert.That(actual, Is.EqualTo( expected), message, args );
\r
835 Assert.That(actual, Is.EqualTo(expected).Within(delta), message, args);
\r
839 /// Verifies that two floats are equal considering a delta. If the
\r
840 /// expected value is infinity then the delta value is ignored. If
\r
841 /// they are not equals then an <see cref="AssertionException"/> is
\r
844 /// <param name="expected">The expected value</param>
\r
845 /// <param name="actual">The actual value</param>
\r
846 /// <param name="delta">The maximum acceptable difference between the
\r
847 /// the expected and the actual</param>
\r
848 /// <param name="message">The message displayed upon failure</param>
\r
849 static public void AreEqual(float expected, float actual, float delta, string message)
\r
851 Assert.AreEqual(expected, actual, delta, message, null);
\r
855 /// Verifies that two floats are equal considering a delta. If the
\r
856 /// expected value is infinity then the delta value is ignored. If
\r
857 /// they are not equals then an <see cref="AssertionException"/> is
\r
860 /// <param name="expected">The expected value</param>
\r
861 /// <param name="actual">The actual value</param>
\r
862 /// <param name="delta">The maximum acceptable difference between the
\r
863 /// the expected and the actual</param>
\r
864 static public void AreEqual(float expected, float actual, float delta)
\r
866 Assert.AreEqual(expected, actual, delta, string.Empty, null);
\r
874 /// Verifies that two objects are equal. Two objects are considered
\r
875 /// equal if both are null, or if both have the same value. All
\r
876 /// non-numeric types are compared by using the <c>Equals</c> method.
\r
877 /// Arrays are compared by comparing each element using the same rules.
\r
878 /// If they are not equal an <see cref="AssertionException"/> is thrown.
\r
880 /// <param name="expected">The value that is expected</param>
\r
881 /// <param name="actual">The actual value</param>
\r
882 /// <param name="message">The message to display if objects are not equal</param>
\r
883 /// <param name="args">Arguments to be used in formatting the message</param>
\r
884 static public void AreEqual(Object expected, Object actual, string message, params object[] args)
\r
886 Assert.That(actual, Is.EqualTo(expected), message, args);
\r
890 /// Verifies that two objects are equal. Two objects are considered
\r
891 /// equal if both are null, or if both have the same value. All
\r
892 /// non-numeric types are compared by using the <c>Equals</c> method.
\r
893 /// If they are not equal an <see cref="AssertionException"/> is thrown.
\r
895 /// <param name="expected">The value that is expected</param>
\r
896 /// <param name="actual">The actual value</param>
\r
897 /// <param name="message">The message to display if objects are not equal</param>
\r
898 static public void AreEqual(Object expected, Object actual, string message)
\r
900 Assert.AreEqual(expected, actual, message, null);
\r
904 /// Verifies that two objects are equal. Two objects are considered
\r
905 /// equal if both are null, or if both have the same value. All
\r
906 /// non-numeric types are compared by using the <c>Equals</c> method.
\r
907 /// If they are not equal an <see cref="AssertionException"/> is thrown.
\r
909 /// <param name="expected">The value that is expected</param>
\r
910 /// <param name="actual">The actual value</param>
\r
911 static public void AreEqual(Object expected, Object actual)
\r
913 Assert.AreEqual(expected, actual, string.Empty, null);
\r
920 #region AreNotEqual
\r
924 /// Asserts that two objects are not equal. If they are equal
\r
925 /// an <see cref="AssertionException"/> is thrown.
\r
927 /// <param name="expected">The expected object</param>
\r
928 /// <param name="actual">The actual object</param>
\r
929 /// <param name="message">The message to be displayed when the two objects are the same object.</param>
\r
930 /// <param name="args">Arguments to be used in formatting the message</param>
\r
931 static public void AreNotEqual( Object expected, Object actual, string message, params object[] args)
\r
933 Assert.That(actual, Is.Not.EqualTo(expected), message, args);
\r
937 /// Asserts that two objects are not equal. If they are equal
\r
938 /// an <see cref="AssertionException"/> is thrown.
\r
940 /// <param name="expected">The expected object</param>
\r
941 /// <param name="actual">The actual object</param>
\r
942 /// <param name="message">The message to be displayed when the objects are the same</param>
\r
943 static public void AreNotEqual(Object expected, Object actual, string message)
\r
945 Assert.AreNotEqual(expected, actual, message, null);
\r
949 /// Asserts that two objects are not equal. If they are equal
\r
950 /// an <see cref="AssertionException"/> is thrown.
\r
952 /// <param name="expected">The expected object</param>
\r
953 /// <param name="actual">The actual object</param>
\r
954 static public void AreNotEqual(Object expected, Object actual)
\r
956 Assert.AreNotEqual(expected, actual, string.Empty, null);
\r
963 /// Asserts that two ints are not equal. If they are equal
\r
964 /// an <see cref="AssertionException"/> is thrown.
\r
966 /// <param name="expected">The expected object</param>
\r
967 /// <param name="actual">The actual object</param>
\r
968 /// <param name="message">The message to be displayed when the two objects are the same object.</param>
\r
969 /// <param name="args">Arguments to be used in formatting the message</param>
\r
970 static public void AreNotEqual(int expected, int actual, string message, params object[] args)
\r
972 Assert.That(actual, Is.Not.EqualTo(expected), message, args);
\r
976 /// Asserts that two ints are not equal. If they are equal
\r
977 /// an <see cref="AssertionException"/> is thrown.
\r
979 /// <param name="expected">The expected object</param>
\r
980 /// <param name="actual">The actual object</param>
\r
981 /// <param name="message">The message to be displayed when the objects are the same</param>
\r
982 static public void AreNotEqual(int expected, int actual, string message)
\r
984 Assert.AreNotEqual(expected, actual, message, null);
\r
988 /// Asserts that two ints are not equal. If they are equal
\r
989 /// an <see cref="AssertionException"/> is thrown.
\r
991 /// <param name="expected">The expected object</param>
\r
992 /// <param name="actual">The actual object</param>
\r
993 static public void AreNotEqual(int expected, int actual)
\r
995 Assert.AreNotEqual(expected, actual, string.Empty, null);
\r
1001 /// Asserts that two longss are not equal. If they are equal
\r
1002 /// an <see cref="AssertionException"/> is thrown.
\r
1004 /// <param name="expected">The expected object</param>
\r
1005 /// <param name="actual">The actual object</param>
\r
1006 /// <param name="message">The message to be displayed when the two objects are the same object.</param>
\r
1007 /// <param name="args">Arguments to be used in formatting the message</param>
\r
1008 static public void AreNotEqual(long expected, long actual, string message, params object[] args)
\r
1010 Assert.That(actual, Is.Not.EqualTo(expected), message, args);
\r
1014 /// Asserts that two longs are not equal. If they are equal
\r
1015 /// an <see cref="AssertionException"/> is thrown.
\r
1017 /// <param name="expected">The expected object</param>
\r
1018 /// <param name="actual">The actual object</param>
\r
1019 /// <param name="message">The message to be displayed when the objects are the same</param>
\r
1020 static public void AreNotEqual(long expected, long actual, string message)
\r
1022 Assert.AreNotEqual(expected, actual, message, null);
\r
1026 /// Asserts that two longs are not equal. If they are equal
\r
1027 /// an <see cref="AssertionException"/> is thrown.
\r
1029 /// <param name="expected">The expected object</param>
\r
1030 /// <param name="actual">The actual object</param>
\r
1031 static public void AreNotEqual(long expected, long actual)
\r
1033 Assert.AreNotEqual(expected, actual, string.Empty, null);
\r
1039 /// Asserts that two uints are not equal. If they are equal
\r
1040 /// an <see cref="AssertionException"/> is thrown.
\r
1042 /// <param name="expected">The expected object</param>
\r
1043 /// <param name="actual">The actual object</param>
\r
1044 /// <param name="message">The message to be displayed when the two objects are the same object.</param>
\r
1045 /// <param name="args">Arguments to be used in formatting the message</param>
\r
1046 [CLSCompliant(false)]
\r
1047 static public void AreNotEqual(uint expected, uint actual, string message, params object[] args)
\r
1049 Assert.That(actual, Is.Not.EqualTo(expected), message, args);
\r
1053 /// Asserts that two uints are not equal. If they are equal
\r
1054 /// an <see cref="AssertionException"/> is thrown.
\r
1056 /// <param name="expected">The expected object</param>
\r
1057 /// <param name="actual">The actual object</param>
\r
1058 /// <param name="message">The message to be displayed when the objects are the same</param>
\r
1059 [CLSCompliant(false)]
\r
1060 static public void AreNotEqual(uint expected, uint actual, string message)
\r
1062 Assert.AreNotEqual(expected, actual, message, null);
\r
1066 /// Asserts that two uints are not equal. If they are equal
\r
1067 /// an <see cref="AssertionException"/> is thrown.
\r
1069 /// <param name="expected">The expected object</param>
\r
1070 /// <param name="actual">The actual object</param>
\r
1071 [CLSCompliant(false)]
\r
1072 static public void AreNotEqual(uint expected, uint actual)
\r
1074 Assert.AreNotEqual(expected, actual, string.Empty, null);
\r
1080 /// Asserts that two ulongs are not equal. If they are equal
\r
1081 /// an <see cref="AssertionException"/> is thrown.
\r
1083 /// <param name="expected">The expected object</param>
\r
1084 /// <param name="actual">The actual object</param>
\r
1085 /// <param name="message">The message to be displayed when the two objects are the same object.</param>
\r
1086 /// <param name="args">Arguments to be used in formatting the message</param>
\r
1087 [CLSCompliant(false)]
\r
1088 static public void AreNotEqual(ulong expected, ulong actual, string message, params object[] args)
\r
1090 Assert.That(actual, Is.Not.EqualTo(expected), message, args);
\r
1094 /// Asserts that two ulongs are not equal. If they are equal
\r
1095 /// an <see cref="AssertionException"/> is thrown.
\r
1097 /// <param name="expected">The expected object</param>
\r
1098 /// <param name="actual">The actual object</param>
\r
1099 /// <param name="message">The message to be displayed when the objects are the same</param>
\r
1100 [CLSCompliant(false)]
\r
1101 static public void AreNotEqual(ulong expected, ulong actual, string message)
\r
1103 Assert.AreNotEqual(expected, actual, message, null);
\r
1107 /// Asserts that two ulong are not equal. If they are equal
\r
1108 /// an <see cref="AssertionException"/> is thrown.
\r
1110 /// <param name="expected">The expected object</param>
\r
1111 /// <param name="actual">The actual object</param>
\r
1112 [CLSCompliant(false)]
\r
1113 static public void AreNotEqual(ulong expected, ulong actual)
\r
1115 Assert.AreNotEqual(expected, actual, string.Empty, null);
\r
1121 /// Asserts that two decimals are not equal. If they are equal
\r
1122 /// an <see cref="AssertionException"/> is thrown.
\r
1124 /// <param name="expected">The expected object</param>
\r
1125 /// <param name="actual">The actual object</param>
\r
1126 /// <param name="message">The message to be displayed when the two objects are the same object.</param>
\r
1127 /// <param name="args">Arguments to be used in formatting the message</param>
\r
1128 static public void AreNotEqual( decimal expected, decimal actual, string message, params object[] args)
\r
1130 Assert.That(actual, Is.Not.EqualTo(expected), message, args);
\r
1134 /// Asserts that two decimals are not equal. If they are equal
\r
1135 /// an <see cref="AssertionException"/> is thrown.
\r
1137 /// <param name="expected">The expected object</param>
\r
1138 /// <param name="actual">The actual object</param>
\r
1139 /// <param name="message">The message to be displayed when the objects are the same</param>
\r
1140 static public void AreNotEqual(decimal expected, decimal actual, string message)
\r
1142 Assert.AreNotEqual(expected, actual, message, null);
\r
1146 /// Asserts that two decimals are not equal. If they are equal
\r
1147 /// an <see cref="AssertionException"/> is thrown.
\r
1149 /// <param name="expected">The expected object</param>
\r
1150 /// <param name="actual">The actual object</param>
\r
1151 static public void AreNotEqual(decimal expected, decimal actual)
\r
1153 Assert.AreNotEqual(expected, actual, string.Empty, null);
\r
1159 /// Asserts that two floats are not equal. If they are equal
\r
1160 /// an <see cref="AssertionException"/> is thrown.
\r
1162 /// <param name="expected">The expected object</param>
\r
1163 /// <param name="actual">The actual object</param>
\r
1164 /// <param name="message">The message to be displayed when the two objects are the same object.</param>
\r
1165 /// <param name="args">Arguments to be used in formatting the message</param>
\r
1166 static public void AreNotEqual( float expected, float actual, string message, params object[] args)
\r
1168 Assert.That(actual, Is.Not.EqualTo(expected), message, args);
\r
1172 /// Asserts that two floats are not equal. If they are equal
\r
1173 /// an <see cref="AssertionException"/> is thrown.
\r
1175 /// <param name="expected">The expected object</param>
\r
1176 /// <param name="actual">The actual object</param>
\r
1177 /// <param name="message">The message to be displayed when the objects are the same</param>
\r
1178 static public void AreNotEqual(float expected, float actual, string message)
\r
1180 Assert.AreNotEqual(expected, actual, message, null);
\r
1184 /// Asserts that two floats are not equal. If they are equal
\r
1185 /// an <see cref="AssertionException"/> is thrown.
\r
1187 /// <param name="expected">The expected object</param>
\r
1188 /// <param name="actual">The actual object</param>
\r
1189 static public void AreNotEqual(float expected, float actual)
\r
1191 Assert.AreNotEqual(expected, actual, string.Empty, null);
\r
1197 /// Asserts that two doubles are not equal. If they are equal
\r
1198 /// an <see cref="AssertionException"/> is thrown.
\r
1200 /// <param name="expected">The expected object</param>
\r
1201 /// <param name="actual">The actual object</param>
\r
1202 /// <param name="message">The message to be displayed when the two objects are the same object.</param>
\r
1203 /// <param name="args">Arguments to be used in formatting the message</param>
\r
1204 static public void AreNotEqual( double expected, double actual, string message, params object[] args)
\r
1206 Assert.That(actual, Is.Not.EqualTo(expected), message, args);
\r
1210 /// Asserts that two doubles are not equal. If they are equal
\r
1211 /// an <see cref="AssertionException"/> is thrown.
\r
1213 /// <param name="expected">The expected object</param>
\r
1214 /// <param name="actual">The actual object</param>
\r
1215 /// <param name="message">The message to be displayed when the objects are the same</param>
\r
1216 static public void AreNotEqual(double expected, double actual, string message)
\r
1218 Assert.AreNotEqual(expected, actual, message, null);
\r
1222 /// Asserts that two doubles are not equal. If they are equal
\r
1223 /// an <see cref="AssertionException"/> is thrown.
\r
1225 /// <param name="expected">The expected object</param>
\r
1226 /// <param name="actual">The actual object</param>
\r
1227 static public void AreNotEqual(double expected, double actual)
\r
1229 Assert.AreNotEqual(expected, actual, string.Empty, null);
\r
1238 /// Asserts that two objects refer to the same object. If they
\r
1239 /// are not the same an <see cref="AssertionException"/> is thrown.
\r
1241 /// <param name="expected">The expected object</param>
\r
1242 /// <param name="actual">The actual object</param>
\r
1243 /// <param name="message">The message to be displayed when the two objects are not the same object.</param>
\r
1244 /// <param name="args">Arguments to be used in formatting the message</param>
\r
1245 static public void AreSame(Object expected, Object actual, string message, params object[] args)
\r
1247 Assert.That(actual, Is.SameAs(expected), message, args);
\r
1251 /// Asserts that two objects refer to the same object. If they
\r
1252 /// are not the same an <see cref="AssertionException"/> is thrown.
\r
1254 /// <param name="expected">The expected object</param>
\r
1255 /// <param name="actual">The actual object</param>
\r
1256 /// <param name="message">The message to be displayed when the object is null</param>
\r
1257 static public void AreSame(Object expected, Object actual, string message)
\r
1259 Assert.AreSame(expected, actual, message, null);
\r
1263 /// Asserts that two objects refer to the same object. If they
\r
1264 /// are not the same an <see cref="AssertionException"/> is thrown.
\r
1266 /// <param name="expected">The expected object</param>
\r
1267 /// <param name="actual">The actual object</param>
\r
1268 static public void AreSame(Object expected, Object actual)
\r
1270 Assert.AreSame(expected, actual, string.Empty, null);
\r
1275 #region AreNotSame
\r
1278 /// Asserts that two objects do not refer to the same object. If they
\r
1279 /// are the same an <see cref="AssertionException"/> is thrown.
\r
1281 /// <param name="expected">The expected object</param>
\r
1282 /// <param name="actual">The actual object</param>
\r
1283 /// <param name="message">The message to be displayed when the two objects are the same object.</param>
\r
1284 /// <param name="args">Arguments to be used in formatting the message</param>
\r
1285 static public void AreNotSame(Object expected, Object actual, string message, params object[] args)
\r
1287 Assert.That(actual, Is.Not.SameAs(expected), message, args);
\r
1291 /// Asserts that two objects do not refer to the same object. If they
\r
1292 /// are the same an <see cref="AssertionException"/> is thrown.
\r
1294 /// <param name="expected">The expected object</param>
\r
1295 /// <param name="actual">The actual object</param>
\r
1296 /// <param name="message">The message to be displayed when the objects are the same</param>
\r
1297 static public void AreNotSame(Object expected, Object actual, string message)
\r
1299 Assert.AreNotSame(expected, actual, message, null);
\r
1303 /// Asserts that two objects do not refer to the same object. If they
\r
1304 /// are the same an <see cref="AssertionException"/> is thrown.
\r
1306 /// <param name="expected">The expected object</param>
\r
1307 /// <param name="actual">The actual object</param>
\r
1308 static public void AreNotSame(Object expected, Object actual)
\r
1310 Assert.AreNotSame(expected, actual, string.Empty, null);
\r
1320 /// Verifies that the first value is greater than the second
\r
1321 /// value. If they are not, then an
\r
1322 /// <see cref="AssertionException"/> is thrown.
\r
1324 /// <param name="arg1">The first value, expected to be greater</param>
\r
1325 /// <param name="arg2">The second value, expected to be less</param>
\r
1326 /// <param name="message">The message that will be displayed on failure</param>
\r
1327 /// <param name="args">Arguments to be used in formatting the message</param>
\r
1328 static public void Greater(int arg1,
\r
1329 int arg2, string message, params object[] args)
\r
1331 Assert.That(arg1, Is.GreaterThan(arg2), message, args);
\r
1335 /// Verifies that the first value is greater than the second
\r
1336 /// value. If they are not, then an
\r
1337 /// <see cref="AssertionException"/> is thrown.
\r
1339 /// <param name="arg1">The first value, expected to be greater</param>
\r
1340 /// <param name="arg2">The second value, expected to be less</param>
\r
1341 /// <param name="message">The message that will be displayed on failure</param>
\r
1342 static public void Greater(int arg1, int arg2, string message)
\r
1344 Assert.Greater( arg1, arg2, message, null );
\r
1348 /// Verifies that the first value is greater than the second
\r
1349 /// value. If they are not, then an
\r
1350 /// <see cref="AssertionException"/> is thrown.
\r
1352 /// <param name="arg1">The first value, expected to be greater</param>
\r
1353 /// <param name="arg2">The second value, expected to be less</param>
\r
1354 static public void Greater(int arg1, int arg2 )
\r
1356 Assert.Greater( arg1, arg2, string.Empty, null );
\r
1364 /// Verifies that the first value is greater than the second
\r
1365 /// value. If they are not, then an
\r
1366 /// <see cref="AssertionException"/> is thrown.
\r
1368 /// <param name="arg1">The first value, expected to be greater</param>
\r
1369 /// <param name="arg2">The second value, expected to be less</param>
\r
1370 /// <param name="message">The message that will be displayed on failure</param>
\r
1371 /// <param name="args">Arguments to be used in formatting the message</param>
\r
1372 [CLSCompliant(false)]
\r
1373 static public void Greater(uint arg1,
\r
1374 uint arg2, string message, params object[] args)
\r
1376 Assert.That(arg1, Is.GreaterThan(arg2), message, args);
\r
1380 /// Verifies that the first value is greater than the second
\r
1381 /// value. If they are not, then an
\r
1382 /// <see cref="AssertionException"/> is thrown.
\r
1384 /// <param name="arg1">The first value, expected to be greater</param>
\r
1385 /// <param name="arg2">The second value, expected to be less</param>
\r
1386 /// <param name="message">The message that will be displayed on failure</param>
\r
1387 [CLSCompliant(false)]
\r
1388 static public void Greater(uint arg1, uint arg2, string message)
\r
1390 Assert.Greater( arg1, arg2, message, null );
\r
1394 /// Verifies that the first value is greater than the second
\r
1395 /// value. If they are not, then an
\r
1396 /// <see cref="AssertionException"/> is thrown.
\r
1398 /// <param name="arg1">The first value, expected to be greater</param>
\r
1399 /// <param name="arg2">The second value, expected to be less</param>
\r
1400 [CLSCompliant(false)]
\r
1401 static public void Greater(uint arg1, uint arg2 )
\r
1403 Assert.Greater( arg1, arg2, string.Empty, null );
\r
1411 /// Verifies that the first value is greater than the second
\r
1412 /// value. If they are not, then an
\r
1413 /// <see cref="AssertionException"/> is thrown.
\r
1415 /// <param name="arg1">The first value, expected to be greater</param>
\r
1416 /// <param name="arg2">The second value, expected to be less</param>
\r
1417 /// <param name="message">The message that will be displayed on failure</param>
\r
1418 /// <param name="args">Arguments to be used in formatting the message</param>
\r
1419 static public void Greater(long arg1,
\r
1420 long arg2, string message, params object[] args)
\r
1422 Assert.That(arg1, Is.GreaterThan(arg2), message, args);
\r
1426 /// Verifies that the first value is greater than the second
\r
1427 /// value. If they are not, then an
\r
1428 /// <see cref="AssertionException"/> is thrown.
\r
1430 /// <param name="arg1">The first value, expected to be greater</param>
\r
1431 /// <param name="arg2">The second value, expected to be less</param>
\r
1432 /// <param name="message">The message that will be displayed on failure</param>
\r
1433 static public void Greater(long arg1, long arg2, string message)
\r
1435 Assert.Greater( arg1, arg2, message, null );
\r
1439 /// Verifies that the first value is greater than the second
\r
1440 /// value. If they are not, then an
\r
1441 /// <see cref="AssertionException"/> is thrown.
\r
1443 /// <param name="arg1">The first value, expected to be greater</param>
\r
1444 /// <param name="arg2">The second value, expected to be less</param>
\r
1445 static public void Greater(long arg1, long arg2 )
\r
1447 Assert.Greater( arg1, arg2, string.Empty, null );
\r
1455 /// Verifies that the first value is greater than the second
\r
1456 /// value. If they are not, then an
\r
1457 /// <see cref="AssertionException"/> is thrown.
\r
1459 /// <param name="arg1">The first value, expected to be greater</param>
\r
1460 /// <param name="arg2">The second value, expected to be less</param>
\r
1461 /// <param name="message">The message that will be displayed on failure</param>
\r
1462 /// <param name="args">Arguments to be used in formatting the message</param>
\r
1463 [CLSCompliant(false)]
\r
1464 static public void Greater(ulong arg1,
\r
1465 ulong arg2, string message, params object[] args)
\r
1467 Assert.That(arg1, Is.GreaterThan(arg2), message, args);
\r
1471 /// Verifies that the first value is greater than the second
\r
1472 /// value. If they are not, then an
\r
1473 /// <see cref="AssertionException"/> is thrown.
\r
1475 /// <param name="arg1">The first value, expected to be greater</param>
\r
1476 /// <param name="arg2">The second value, expected to be less</param>
\r
1477 /// <param name="message">The message that will be displayed on failure</param>
\r
1478 [CLSCompliant(false)]
\r
1479 static public void Greater(ulong arg1, ulong arg2, string message)
\r
1481 Assert.Greater( arg1, arg2, message, null );
\r
1485 /// Verifies that the first value is greater than the second
\r
1486 /// value. If they are not, then an
\r
1487 /// <see cref="AssertionException"/> is thrown.
\r
1489 /// <param name="arg1">The first value, expected to be greater</param>
\r
1490 /// <param name="arg2">The second value, expected to be less</param>
\r
1491 [CLSCompliant(false)]
\r
1492 static public void Greater(ulong arg1, ulong arg2 )
\r
1494 Assert.Greater( arg1, arg2, string.Empty, null );
\r
1502 /// Verifies that the first value is greater than the second
\r
1503 /// value. If they are not, then an
\r
1504 /// <see cref="AssertionException"/> is thrown.
\r
1506 /// <param name="arg1">The first value, expected to be greater</param>
\r
1507 /// <param name="arg2">The second value, expected to be less</param>
\r
1508 /// <param name="message">The message that will be displayed on failure</param>
\r
1509 /// <param name="args">Arguments to be used in formatting the message</param>
\r
1510 static public void Greater(decimal arg1,
\r
1511 decimal arg2, string message, params object[] args)
\r
1513 Assert.That(arg1, Is.GreaterThan(arg2), message, args);
\r
1517 /// Verifies that the first value is greater than the second
\r
1518 /// value. If they are not, then an
\r
1519 /// <see cref="AssertionException"/> is thrown.
\r
1521 /// <param name="arg1">The first value, expected to be greater</param>
\r
1522 /// <param name="arg2">The second value, expected to be less</param>
\r
1523 /// <param name="message">The message that will be displayed on failure</param>
\r
1524 static public void Greater(decimal arg1, decimal arg2, string message)
\r
1526 Assert.Greater( arg1, arg2, message, null );
\r
1530 /// Verifies that the first value is greater than the second
\r
1531 /// value. If they are not, then an
\r
1532 /// <see cref="AssertionException"/> is thrown.
\r
1534 /// <param name="arg1">The first value, expected to be greater</param>
\r
1535 /// <param name="arg2">The second value, expected to be less</param>
\r
1536 static public void Greater(decimal arg1, decimal arg2 )
\r
1538 Assert.Greater( arg1, arg2, string.Empty, null );
\r
1546 /// Verifies that the first value is greater than the second
\r
1547 /// value. If they are not, then an
\r
1548 /// <see cref="AssertionException"/> is thrown.
\r
1550 /// <param name="arg1">The first value, expected to be greater</param>
\r
1551 /// <param name="arg2">The second value, expected to be less</param>
\r
1552 /// <param name="message">The message that will be displayed on failure</param>
\r
1553 /// <param name="args">Arguments to be used in formatting the message</param>
\r
1554 static public void Greater(double arg1,
\r
1555 double arg2, string message, params object[] args)
\r
1557 Assert.That(arg1, Is.GreaterThan(arg2), message, args);
\r
1561 /// Verifies that the first value is greater than the second
\r
1562 /// value. If they are not, then an
\r
1563 /// <see cref="AssertionException"/> is thrown.
\r
1565 /// <param name="arg1">The first value, expected to be greater</param>
\r
1566 /// <param name="arg2">The second value, expected to be less</param>
\r
1567 /// <param name="message">The message that will be displayed on failure</param>
\r
1568 static public void Greater(double arg1,
\r
1569 double arg2, string message)
\r
1571 Assert.Greater( arg1, arg2, message, null );
\r
1575 /// Verifies that the first value is greater than the second
\r
1576 /// value. If they are not, then an
\r
1577 /// <see cref="AssertionException"/> is thrown.
\r
1579 /// <param name="arg1">The first value, expected to be greater</param>
\r
1580 /// <param name="arg2">The second value, expected to be less</param>
\r
1581 static public void Greater(double arg1, double arg2)
\r
1583 Assert.Greater(arg1, arg2, string.Empty, null);
\r
1591 /// Verifies that the first value is greater than the second
\r
1592 /// value. If they are not, then an
\r
1593 /// <see cref="AssertionException"/> is thrown.
\r
1595 /// <param name="arg1">The first value, expected to be greater</param>
\r
1596 /// <param name="arg2">The second value, expected to be less</param>
\r
1597 /// <param name="message">The message that will be displayed on failure</param>
\r
1598 /// <param name="args">Arguments to be used in formatting the message</param>
\r
1599 static public void Greater(float arg1,
\r
1600 float arg2, string message, params object[] args)
\r
1602 Assert.That(arg1, Is.GreaterThan(arg2), message, args);
\r
1606 /// Verifies that the first value is greater than the second
\r
1607 /// value. If they are not, then an
\r
1608 /// <see cref="AssertionException"/> is thrown.
\r
1610 /// <param name="arg1">The first value, expected to be greater</param>
\r
1611 /// <param name="arg2">The second value, expected to be less</param>
\r
1612 /// <param name="message">The message that will be displayed on failure</param>
\r
1613 static public void Greater(float arg1, float arg2, string message)
\r
1615 Assert.Greater(arg1, arg2, message, null);
\r
1619 /// Verifies that the first value is greater than the second
\r
1620 /// value. If they are not, then an
\r
1621 /// <see cref="AssertionException"/> is thrown.
\r
1623 /// <param name="arg1">The first value, expected to be greater</param>
\r
1624 /// <param name="arg2">The second value, expected to be less</param>
\r
1625 static public void Greater(float arg1, float arg2)
\r
1627 Assert.Greater(arg1, arg2, string.Empty, null);
\r
1632 #region IComparables
\r
1635 /// Verifies that the first value is greater than the second
\r
1636 /// value. If they are not, then an
\r
1637 /// <see cref="AssertionException"/> is thrown.
\r
1639 /// <param name="arg1">The first value, expected to be greater</param>
\r
1640 /// <param name="arg2">The second value, expected to be less</param>
\r
1641 /// <param name="message">The message that will be displayed on failure</param>
\r
1642 /// <param name="args">Arguments to be used in formatting the message</param>
\r
1643 static public void Greater(IComparable arg1,
\r
1644 IComparable arg2, string message, params object[] args)
\r
1646 Assert.That(arg1, Is.GreaterThan(arg2), message, args);
\r
1650 /// Verifies that the first value is greater than the second
\r
1651 /// value. If they are not, then an
\r
1652 /// <see cref="AssertionException"/> is thrown.
\r
1654 /// <param name="arg1">The first value, expected to be greater</param>
\r
1655 /// <param name="arg2">The second value, expected to be less</param>
\r
1656 /// <param name="message">The message that will be displayed on failure</param>
\r
1657 static public void Greater(IComparable arg1, IComparable arg2, string message)
\r
1659 Assert.Greater(arg1, arg2, message, null);
\r
1663 /// Verifies that the first value is greater than the second
\r
1664 /// value. If they are not, then an
\r
1665 /// <see cref="AssertionException"/> is thrown.
\r
1667 /// <param name="arg1">The first value, expected to be greater</param>
\r
1668 /// <param name="arg2">The second value, expected to be less</param>
\r
1669 static public void Greater(IComparable arg1, IComparable arg2)
\r
1671 Assert.Greater(arg1, arg2, string.Empty, null);
\r
1683 /// Verifies that the first value is less than the second
\r
1684 /// value. If it is not, then an
\r
1685 /// <see cref="AssertionException"/> is thrown.
\r
1687 /// <param name="arg1">The first value, expected to be less</param>
\r
1688 /// <param name="arg2">The second value, expected to be greater</param>
\r
1689 /// <param name="message">The message that will be displayed on failure</param>
\r
1690 /// <param name="args">Arguments to be used in formatting the message</param>
\r
1691 static public void Less(int arg1, int arg2, string message, params object[] args)
\r
1693 Assert.That(arg1, Is.LessThan(arg2), message, args);
\r
1697 /// Verifies that the first value is less than the second
\r
1698 /// value. If it is not, then an
\r
1699 /// <see cref="AssertionException"/> is thrown.
\r
1701 /// <param name="arg1">The first value, expected to be less</param>
\r
1702 /// <param name="arg2">The second value, expected to be greater</param>
\r
1703 /// <param name="message">The message that will be displayed on failure</param>
\r
1704 static public void Less(int arg1, int arg2, string message)
\r
1706 Assert.Less(arg1, arg2, message, null);
\r
1710 /// Verifies that the first value is less than the second
\r
1711 /// value. If it is not, then an
\r
1712 /// <see cref="AssertionException"/> is thrown.
\r
1714 /// <param name="arg1">The first value, expected to be less</param>
\r
1715 /// <param name="arg2">The second value, expected to be greater</param>
\r
1716 static public void Less(int arg1, int arg2)
\r
1718 Assert.Less( arg1, arg2, string.Empty, null);
\r
1726 /// Verifies that the first value is less than the second
\r
1727 /// value. If it is not, then an
\r
1728 /// <see cref="AssertionException"/> is thrown.
\r
1730 /// <param name="arg1">The first value, expected to be less</param>
\r
1731 /// <param name="arg2">The second value, expected to be greater</param>
\r
1732 /// <param name="message">The message that will be displayed on failure</param>
\r
1733 /// <param name="args">Arguments to be used in formatting the message</param>
\r
1734 [CLSCompliant(false)]
\r
1735 static public void Less(uint arg1, uint arg2, string message, params object[] args)
\r
1737 Assert.That(arg1, Is.LessThan(arg2), message, args);
\r
1741 /// Verifies that the first value is less than the second
\r
1742 /// value. If it is not, then an
\r
1743 /// <see cref="AssertionException"/> is thrown.
\r
1745 /// <param name="arg1">The first value, expected to be less</param>
\r
1746 /// <param name="arg2">The second value, expected to be greater</param>
\r
1747 /// <param name="message">The message that will be displayed on failure</param>
\r
1748 [CLSCompliant(false)]
\r
1749 static public void Less(uint arg1, uint arg2, string message)
\r
1751 Assert.Less(arg1, arg2, message, null);
\r
1755 /// Verifies that the first value is less than the second
\r
1756 /// value. If it is not, then an
\r
1757 /// <see cref="AssertionException"/> is thrown.
\r
1759 /// <param name="arg1">The first value, expected to be less</param>
\r
1760 /// <param name="arg2">The second value, expected to be greater</param>
\r
1761 [CLSCompliant(false)]
\r
1762 static public void Less(uint arg1, uint arg2)
\r
1764 Assert.Less( arg1, arg2, string.Empty, null);
\r
1772 /// Verifies that the first value is less than the second
\r
1773 /// value. If it is not, then an
\r
1774 /// <see cref="AssertionException"/> is thrown.
\r
1776 /// <param name="arg1">The first value, expected to be less</param>
\r
1777 /// <param name="arg2">The second value, expected to be greater</param>
\r
1778 /// <param name="message">The message that will be displayed on failure</param>
\r
1779 /// <param name="args">Arguments to be used in formatting the message</param>
\r
1780 static public void Less(long arg1, long arg2, string message, params object[] args)
\r
1782 Assert.That(arg1, Is.LessThan(arg2), message, args);
\r
1786 /// Verifies that the first value is less than the second
\r
1787 /// value. If it is not, then an
\r
1788 /// <see cref="AssertionException"/> is thrown.
\r
1790 /// <param name="arg1">The first value, expected to be less</param>
\r
1791 /// <param name="arg2">The second value, expected to be greater</param>
\r
1792 /// <param name="message">The message that will be displayed on failure</param>
\r
1793 static public void Less(long arg1, long arg2, string message)
\r
1795 Assert.Less(arg1, arg2, message, null);
\r
1799 /// Verifies that the first value is less than the second
\r
1800 /// value. If it is not, then an
\r
1801 /// <see cref="AssertionException"/> is thrown.
\r
1803 /// <param name="arg1">The first value, expected to be less</param>
\r
1804 /// <param name="arg2">The second value, expected to be greater</param>
\r
1805 static public void Less(long arg1, long arg2)
\r
1807 Assert.Less( arg1, arg2, string.Empty, null);
\r
1815 /// Verifies that the first value is less than the second
\r
1816 /// value. If it is not, then an
\r
1817 /// <see cref="AssertionException"/> is thrown.
\r
1819 /// <param name="arg1">The first value, expected to be less</param>
\r
1820 /// <param name="arg2">The second value, expected to be greater</param>
\r
1821 /// <param name="message">The message that will be displayed on failure</param>
\r
1822 /// <param name="args">Arguments to be used in formatting the message</param>
\r
1823 [CLSCompliant(false)]
\r
1824 static public void Less(ulong arg1, ulong arg2, string message, params object[] args)
\r
1826 Assert.That(arg1, Is.LessThan(arg2), message, args);
\r
1830 /// Verifies that the first value is less than the second
\r
1831 /// value. If it is not, then an
\r
1832 /// <see cref="AssertionException"/> is thrown.
\r
1834 /// <param name="arg1">The first value, expected to be less</param>
\r
1835 /// <param name="arg2">The second value, expected to be greater</param>
\r
1836 /// <param name="message">The message that will be displayed on failure</param>
\r
1837 [CLSCompliant(false)]
\r
1838 static public void Less(ulong arg1, ulong arg2, string message)
\r
1840 Assert.Less(arg1, arg2, message, null);
\r
1844 /// Verifies that the first value is less than the second
\r
1845 /// value. If it is not, then an
\r
1846 /// <see cref="AssertionException"/> is thrown.
\r
1848 /// <param name="arg1">The first value, expected to be less</param>
\r
1849 /// <param name="arg2">The second value, expected to be greater</param>
\r
1850 [CLSCompliant(false)]
\r
1851 static public void Less(ulong arg1, ulong arg2)
\r
1853 Assert.Less( arg1, arg2, string.Empty, null);
\r
1861 /// Verifies that the first value is less than the second
\r
1862 /// value. If it is not, then an
\r
1863 /// <see cref="AssertionException"/> is thrown.
\r
1865 /// <param name="arg1">The first value, expected to be less</param>
\r
1866 /// <param name="arg2">The second value, expected to be greater</param>
\r
1867 /// <param name="message">The message that will be displayed on failure</param>
\r
1868 /// <param name="args">Arguments to be used in formatting the message</param>
\r
1869 static public void Less(decimal arg1, decimal arg2, string message, params object[] args)
\r
1871 Assert.That(arg1, Is.LessThan(arg2), message, args);
\r
1875 /// Verifies that the first value is less than the second
\r
1876 /// value. If it is not, then an
\r
1877 /// <see cref="AssertionException"/> is thrown.
\r
1879 /// <param name="arg1">The first value, expected to be less</param>
\r
1880 /// <param name="arg2">The second value, expected to be greater</param>
\r
1881 /// <param name="message">The message that will be displayed on failure</param>
\r
1882 static public void Less(decimal arg1, decimal arg2, string message)
\r
1884 Assert.Less(arg1, arg2, message, null);
\r
1888 /// Verifies that the first value is less than the second
\r
1889 /// value. If it is not, then an
\r
1890 /// <see cref="AssertionException"/> is thrown.
\r
1892 /// <param name="arg1">The first value, expected to be less</param>
\r
1893 /// <param name="arg2">The second value, expected to be greater</param>
\r
1894 static public void Less(decimal arg1, decimal arg2)
\r
1896 Assert.Less(arg1, arg2, string.Empty, null);
\r
1904 /// Verifies that the first value is less than the second
\r
1905 /// value. If it is not, then an
\r
1906 /// <see cref="AssertionException"/> is thrown.
\r
1908 /// <param name="arg1">The first value, expected to be less</param>
\r
1909 /// <param name="arg2">The second value, expected to be greater</param>
\r
1910 /// <param name="message">The message that will be displayed on failure</param>
\r
1911 /// <param name="args">Arguments to be used in formatting the message</param>
\r
1912 static public void Less(double arg1, double arg2, string message, params object[] args)
\r
1914 Assert.That(arg1, Is.LessThan(arg2), message, args);
\r
1918 /// Verifies that the first value is less than the second
\r
1919 /// value. If it is not, then an
\r
1920 /// <see cref="AssertionException"/> is thrown.
\r
1922 /// <param name="arg1">The first value, expected to be less</param>
\r
1923 /// <param name="arg2">The second value, expected to be greater</param>
\r
1924 /// <param name="message">The message that will be displayed on failure</param>
\r
1925 static public void Less(double arg1, double arg2, string message)
\r
1927 Assert.Less(arg1, arg2, message, null);
\r
1931 /// Verifies that the first value is less than the second
\r
1932 /// value. If it is not, then an
\r
1933 /// <see cref="AssertionException"/> is thrown.
\r
1935 /// <param name="arg1">The first value, expected to be less</param>
\r
1936 /// <param name="arg2">The second value, expected to be greater</param>
\r
1937 static public void Less(double arg1, double arg2)
\r
1939 Assert.Less(arg1, arg2, string.Empty, null);
\r
1947 /// Verifies that the first value is less than the second
\r
1948 /// value. If it is not, then an
\r
1949 /// <see cref="AssertionException"/> is thrown.
\r
1951 /// <param name="arg1">The first value, expected to be less</param>
\r
1952 /// <param name="arg2">The second value, expected to be greater</param>
\r
1953 /// <param name="message">The message that will be displayed on failure</param>
\r
1954 /// <param name="args">Arguments to be used in formatting the message</param>
\r
1955 static public void Less(float arg1, float arg2, string message, params object[] args)
\r
1957 Assert.That(arg1, Is.LessThan(arg2), message, args);
\r
1961 /// Verifies that the first value is less than the second
\r
1962 /// value. If it is not, then an
\r
1963 /// <see cref="AssertionException"/> is thrown.
\r
1965 /// <param name="arg1">The first value, expected to be less</param>
\r
1966 /// <param name="arg2">The second value, expected to be greater</param>
\r
1967 /// <param name="message">The message that will be displayed on failure</param>
\r
1968 static public void Less(float arg1, float arg2, string message)
\r
1970 Assert.Less(arg1, arg2, message, null);
\r
1974 /// Verifies that the first value is less than the second
\r
1975 /// value. If it is not, then an
\r
1976 /// <see cref="AssertionException"/> is thrown.
\r
1978 /// <param name="arg1">The first value, expected to be less</param>
\r
1979 /// <param name="arg2">The second value, expected to be greater</param>
\r
1980 static public void Less(float arg1, float arg2)
\r
1982 Assert.Less(arg1, arg2, string.Empty, null);
\r
1987 #region IComparables
\r
1990 /// Verifies that the first value is less than the second
\r
1991 /// value. If it is not, then an
\r
1992 /// <see cref="AssertionException"/> is thrown.
\r
1994 /// <param name="arg1">The first value, expected to be less</param>
\r
1995 /// <param name="arg2">The second value, expected to be greater</param>
\r
1996 /// <param name="message">The message that will be displayed on failure</param>
\r
1997 /// <param name="args">Arguments to be used in formatting the message</param>
\r
1998 static public void Less(IComparable arg1, IComparable arg2, string message, params object[] args)
\r
2000 Assert.That(arg1, Is.LessThan(arg2), message, args);
\r
2004 /// Verifies that the first value is less than the second
\r
2005 /// value. If it is not, then an
\r
2006 /// <see cref="AssertionException"/> is thrown.
\r
2008 /// <param name="arg1">The first value, expected to be less</param>
\r
2009 /// <param name="arg2">The second value, expected to be greater</param>
\r
2010 /// <param name="message">The message that will be displayed on failure</param>
\r
2011 static public void Less(IComparable arg1, IComparable arg2, string message)
\r
2013 Assert.Less(arg1, arg2, message, null);
\r
2017 /// Verifies that the first value is less than the second
\r
2018 /// value. If it is not, then an
\r
2019 /// <see cref="AssertionException"/> is thrown.
\r
2021 /// <param name="arg1">The first value, expected to be less</param>
\r
2022 /// <param name="arg2">The second value, expected to be greater</param>
\r
2023 static public void Less(IComparable arg1, IComparable arg2)
\r
2025 Assert.Less(arg1, arg2, string.Empty, null);
\r
2032 #region Collection Containment
\r
2035 /// Asserts that an object is contained in a list.
\r
2037 /// <param name="expected">The expected object</param>
\r
2038 /// <param name="actual">The list to be examined</param>
\r
2039 /// <param name="message">The message to display in case of failure</param>
\r
2040 /// <param name="args">Arguments used in formatting the message</param>
\r
2041 static public void Contains( object expected, ICollection actual, string message, params object[] args )
\r
2043 Assert.That(actual, new CollectionContainsConstraint(expected), message, args);
\r
2047 /// Asserts that an object is contained in a list.
\r
2049 /// <param name="expected">The expected object</param>
\r
2050 /// <param name="actual">The list to be examined</param>
\r
2051 /// <param name="message">The message to display in case of failure</param>
\r
2052 static public void Contains( object expected, ICollection actual, string message )
\r
2054 Contains( expected, actual, message, null );
\r
2058 /// Asserts that an object is contained in a list.
\r
2060 /// <param name="expected">The expected object</param>
\r
2061 /// <param name="actual">The list to be examined</param>
\r
2062 static public void Contains( object expected, ICollection actual )
\r
2064 Contains( expected, actual, string.Empty, null );
\r
2072 /// Throws an <see cref="AssertionException"/> with the message and arguments
\r
2073 /// that are passed in. This is used by the other Assert functions.
\r
2075 /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
\r
2076 /// <param name="args">Arguments to be used in formatting the message</param>
\r
2077 static public void Fail(string message, params object[] args )
\r
2079 if (message == null) message = string.Empty;
\r
2080 else if ( args != null && args.Length > 0 )
\r
2081 message = string.Format( message, args );
\r
2083 throw new AssertionException(message);
\r
2087 /// Throws an <see cref="AssertionException"/> with the message that is
\r
2088 /// passed in. This is used by the other Assert functions.
\r
2090 /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
\r
2091 static public void Fail(string message)
\r
2093 Assert.Fail(message, null);
\r
2097 /// Throws an <see cref="AssertionException"/>.
\r
2098 /// This is used by the other Assert functions.
\r
2100 static public void Fail()
\r
2102 Assert.Fail(string.Empty, null);
\r
2110 /// Throws an <see cref="IgnoreException"/> with the message and arguments
\r
2111 /// that are passed in. This causes the test to be reported as ignored.
\r
2113 /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
\r
2114 /// <param name="args">Arguments to be used in formatting the message</param>
\r
2115 static public void Ignore( string message, params object[] args )
\r
2117 if (message == null) message = string.Empty;
\r
2118 else if ( args != null && args.Length > 0 )
\r
2119 message = string.Format( message, args );
\r
2121 throw new IgnoreException(message);
\r
2125 /// Throws an <see cref="IgnoreException"/> with the message that is
\r
2126 /// passed in. This causes the test to be reported as ignored.
\r
2128 /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
\r
2129 static public void Ignore( string message )
\r
2131 Assert.Ignore( message, null );
\r
2135 /// Throws an <see cref="IgnoreException"/>.
\r
2136 /// This causes the test to be reported as ignored.
\r
2138 static public void Ignore()
\r
2140 Assert.Ignore( string.Empty, null );
\r
2148 /// NOTE: The use of asserters for extending NUnit has
\r
2149 /// now been replaced by the use of constraints. This
\r
2150 /// method is marked obsolete.
\r
2152 /// Test the condition asserted by an asserter and throw
\r
2153 /// an assertion exception using provided message on failure.
\r
2155 /// <param name="asserter">An object that implements IAsserter</param>
\r
2156 [Obsolete("Use Constraints rather than Asserters for new work")]
\r
2157 static public void DoAssert( IAsserter asserter )
\r
2159 Assert.IncrementAssertCount();
\r
2160 if ( !asserter.Test() )
\r
2161 throw new AssertionException( asserter.Message );
\r
2168 /// Apply a constraint to an actual value, succeeding if the constraint
\r
2169 /// is satisfied and throwing an assertion exception on failure.
\r
2171 /// <param name="constraint">A Constraint to be applied</param>
\r
2172 /// <param name="actual">The actual value to test</param>
\r
2173 static public void That( object actual, Constraint constraint )
\r
2175 Assert.That( actual, constraint, null, null );
\r
2179 /// Apply a constraint to an actual value, succeedingt if the constraint
\r
2180 /// is satisfied and throwing an assertion exception on failure.
\r
2182 /// <param name="constraint">A Constraint to be applied</param>
\r
2183 /// <param name="actual">The actual value to test</param>
\r
2184 /// <param name="message">The message that will be displayed on failure</param>
\r
2185 static public void That( object actual, Constraint constraint, string message )
\r
2187 Assert.That( actual, constraint, message, null );
\r
2191 /// Apply a constraint to an actual value, succeedingt if the constraint
\r
2192 /// is satisfied and throwing an assertion exception on failure.
\r
2194 /// <param name="constraint">A Constraint to be applied</param>
\r
2195 /// <param name="actual">The actual value to test</param>
\r
2196 /// <param name="message">The message that will be displayed on failure</param>
\r
2197 /// <param name="args">Arguments to be used in formatting the message</param>
\r
2198 static public void That( object actual, Constraint constraint, string message, params object[] args )
\r
2200 Assert.IncrementAssertCount();
\r
2201 if ( !constraint.Matches( actual ) )
\r
2203 MessageWriter writer = new TextMessageWriter( message, args );
\r
2204 constraint.WriteMessageTo( writer );
\r
2205 throw new AssertionException( writer.ToString() );
\r
2210 /// Asserts that a condition is true. If the condition is false the method throws
\r
2211 /// an <see cref="AssertionException"/>.
\r
2213 /// <param name="condition">The evaluated condition</param>
\r
2214 /// <param name="message">The message to display if the condition is false</param>
\r
2215 /// <param name="args">Arguments to be used in formatting the message</param>
\r
2216 static public void That(bool condition, string message, params object[] args)
\r
2218 Assert.That(condition, Is.True, message, args);
\r
2222 /// Asserts that a condition is true. If the condition is false the method throws
\r
2223 /// an <see cref="AssertionException"/>.
\r
2225 /// <param name="condition">The evaluated condition</param>
\r
2226 /// <param name="message">The message to display if the condition is false</param>
\r
2227 static public void That(bool condition, string message)
\r
2229 Assert.That(condition, Is.True, message, null);
\r
2233 /// Asserts that a condition is true. If the condition is false the method throws
\r
2234 /// an <see cref="AssertionException"/>.
\r
2236 /// <param name="condition">The evaluated condition</param>
\r
2237 static public void That(bool condition)
\r
2239 Assert.That(condition, Is.True, null, null);
\r
2243 #region GreaterOrEqual
\r
2248 /// Verifies that the first value is greater than or equal to the second
\r
2249 /// value. If they are not, then an
\r
2250 /// <see cref="AssertionException"/> is thrown.
\r
2252 /// <param name="arg1">The first value, expected to be greater</param>
\r
2253 /// <param name="arg2">The second value, expected to be less</param>
\r
2254 /// <param name="message">The message that will be displayed on failure</param>
\r
2255 /// <param name="args">Arguments to be used in formatting the message</param>
\r
2256 static public void GreaterOrEqual(int arg1,
\r
2257 int arg2, string message, params object[] args)
\r
2259 Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
\r
2263 /// Verifies that the first value is greater than or equal to the second
\r
2264 /// value. If they are not, then an
\r
2265 /// <see cref="AssertionException"/> is thrown.
\r
2267 /// <param name="arg1">The first value, expected to be greater</param>
\r
2268 /// <param name="arg2">The second value, expected to be less</param>
\r
2269 /// <param name="message">The message that will be displayed on failure</param>
\r
2270 static public void GreaterOrEqual(int arg1, int arg2, string message)
\r
2272 Assert.GreaterOrEqual(arg1, arg2, message, null);
\r
2276 /// Verifies that the first value is greater than or equal to the second
\r
2277 /// value. If they are not, then an
\r
2278 /// <see cref="AssertionException"/> is thrown.
\r
2280 /// <param name="arg1">The first value, expected to be greater</param>
\r
2281 /// <param name="arg2">The second value, expected to be less</param>
\r
2282 static public void GreaterOrEqual(int arg1, int arg2)
\r
2284 Assert.GreaterOrEqual(arg1, arg2, string.Empty, null);
\r
2292 /// Verifies that the first value is greater than or equal to the second
\r
2293 /// value. If they are not, then an
\r
2294 /// <see cref="AssertionException"/> is thrown.
\r
2296 /// <param name="arg1">The first value, expected to be greater</param>
\r
2297 /// <param name="arg2">The second value, expected to be less</param>
\r
2298 /// <param name="message">The message that will be displayed on failure</param>
\r
2299 /// <param name="args">Arguments to be used in formatting the message</param>
\r
2300 [CLSCompliant(false)]
\r
2301 static public void GreaterOrEqual(uint arg1,
\r
2302 uint arg2, string message, params object[] args)
\r
2304 Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
\r
2308 /// Verifies that the first value is greater than or equal to the second
\r
2309 /// value. If they are not, then an
\r
2310 /// <see cref="AssertionException"/> is thrown.
\r
2312 /// <param name="arg1">The first value, expected to be greater</param>
\r
2313 /// <param name="arg2">The second value, expected to be less</param>
\r
2314 /// <param name="message">The message that will be displayed on failure</param>
\r
2315 [CLSCompliant(false)]
\r
2316 static public void GreaterOrEqual(uint arg1, uint arg2, string message)
\r
2318 Assert.GreaterOrEqual(arg1, arg2, message, null);
\r
2322 /// Verifies that the first value is greater or equal to than the second
\r
2323 /// value. If they are not, then an
\r
2324 /// <see cref="AssertionException"/> is thrown.
\r
2326 /// <param name="arg1">The first value, expected to be greater</param>
\r
2327 /// <param name="arg2">The second value, expected to be less</param>
\r
2328 [CLSCompliant(false)]
\r
2329 static public void GreaterOrEqual(uint arg1, uint arg2)
\r
2331 Assert.GreaterOrEqual(arg1, arg2, string.Empty, null);
\r
2339 /// Verifies that the first value is greater than or equal to the second
\r
2340 /// value. If they are not, then an
\r
2341 /// <see cref="AssertionException"/> is thrown.
\r
2343 /// <param name="arg1">The first value, expected to be greater</param>
\r
2344 /// <param name="arg2">The second value, expected to be less</param>
\r
2345 /// <param name="message">The message that will be displayed on failure</param>
\r
2346 /// <param name="args">Arguments to be used in formatting the message</param>
\r
2347 static public void GreaterOrEqual(long arg1,
\r
2348 long arg2, string message, params object[] args)
\r
2350 Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
\r
2354 /// Verifies that the first value is greater than or equal to the second
\r
2355 /// value. If they are not, then an
\r
2356 /// <see cref="AssertionException"/> is thrown.
\r
2358 /// <param name="arg1">The first value, expected to be greater</param>
\r
2359 /// <param name="arg2">The second value, expected to be less</param>
\r
2360 /// <param name="message">The message that will be displayed on failure</param>
\r
2361 static public void GreaterOrEqual(long arg1, long arg2, string message)
\r
2363 Assert.GreaterOrEqual(arg1, arg2, message, null);
\r
2367 /// Verifies that the first value is greater or equal to than the second
\r
2368 /// value. If they are not, then an
\r
2369 /// <see cref="AssertionException"/> is thrown.
\r
2371 /// <param name="arg1">The first value, expected to be greater</param>
\r
2372 /// <param name="arg2">The second value, expected to be less</param>
\r
2373 static public void GreaterOrEqual(long arg1, long arg2)
\r
2375 Assert.GreaterOrEqual(arg1, arg2, string.Empty, null);
\r
2383 /// Verifies that the first value is greater than or equal to the second
\r
2384 /// value. If they are not, then an
\r
2385 /// <see cref="AssertionException"/> is thrown.
\r
2387 /// <param name="arg1">The first value, expected to be greater</param>
\r
2388 /// <param name="arg2">The second value, expected to be less</param>
\r
2389 /// <param name="message">The message that will be displayed on failure</param>
\r
2390 /// <param name="args">Arguments to be used in formatting the message</param>
\r
2391 [CLSCompliant(false)]
\r
2392 static public void GreaterOrEqual(ulong arg1,
\r
2393 ulong arg2, string message, params object[] args)
\r
2395 Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
\r
2399 /// Verifies that the first value is greater than or equal to the second
\r
2400 /// value. If they are not, then an
\r
2401 /// <see cref="AssertionException"/> is thrown.
\r
2403 /// <param name="arg1">The first value, expected to be greater</param>
\r
2404 /// <param name="arg2">The second value, expected to be less</param>
\r
2405 /// <param name="message">The message that will be displayed on failure</param>
\r
2406 [CLSCompliant(false)]
\r
2407 static public void GreaterOrEqual(ulong arg1, ulong arg2, string message)
\r
2409 Assert.GreaterOrEqual(arg1, arg2, message, null);
\r
2413 /// Verifies that the first value is greater or equal to than the second
\r
2414 /// value. If they are not, then an
\r
2415 /// <see cref="AssertionException"/> is thrown.
\r
2417 /// <param name="arg1">The first value, expected to be greater</param>
\r
2418 /// <param name="arg2">The second value, expected to be less</param>
\r
2419 [CLSCompliant(false)]
\r
2420 static public void GreaterOrEqual(ulong arg1, ulong arg2)
\r
2422 Assert.GreaterOrEqual(arg1, arg2, string.Empty, null);
\r
2430 /// Verifies that the first value is greater than or equal to the second
\r
2431 /// value. If they are not, then an
\r
2432 /// <see cref="AssertionException"/> is thrown.
\r
2434 /// <param name="arg1">The first value, expected to be greater</param>
\r
2435 /// <param name="arg2">The second value, expected to be less</param>
\r
2436 /// <param name="message">The message that will be displayed on failure</param>
\r
2437 /// <param name="args">Arguments to be used in formatting the message</param>
\r
2438 static public void GreaterOrEqual(decimal arg1,
\r
2439 decimal arg2, string message, params object[] args)
\r
2441 Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
\r
2445 /// Verifies that the first value is greater than or equal to the second
\r
2446 /// value. If they are not, then an
\r
2447 /// <see cref="AssertionException"/> is thrown.
\r
2449 /// <param name="arg1">The first value, expected to be greater</param>
\r
2450 /// <param name="arg2">The second value, expected to be less</param>
\r
2451 /// <param name="message">The message that will be displayed on failure</param>
\r
2452 static public void GreaterOrEqual(decimal arg1, decimal arg2, string message)
\r
2454 Assert.GreaterOrEqual(arg1, arg2, message, null);
\r
2458 /// Verifies that the first value is greater than or equal to the second
\r
2459 /// value. If they are not, then an
\r
2460 /// <see cref="AssertionException"/> is thrown.
\r
2462 /// <param name="arg1">The first value, expected to be greater</param>
\r
2463 /// <param name="arg2">The second value, expected to be less</param>
\r
2464 static public void GreaterOrEqual(decimal arg1, decimal arg2)
\r
2466 Assert.GreaterOrEqual(arg1, arg2, string.Empty, null);
\r
2474 /// Verifies that the first value is greater than or equal to the second
\r
2475 /// value. If they are not, then an
\r
2476 /// <see cref="AssertionException"/> is thrown.
\r
2478 /// <param name="arg1">The first value, expected to be greater</param>
\r
2479 /// <param name="arg2">The second value, expected to be less</param>
\r
2480 /// <param name="message">The message that will be displayed on failure</param>
\r
2481 /// <param name="args">Arguments to be used in formatting the message</param>
\r
2482 static public void GreaterOrEqual(double arg1,
\r
2483 double arg2, string message, params object[] args)
\r
2485 Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
\r
2489 /// Verifies that the first value is greater than or equal to the second
\r
2490 /// value. If they are not, then an
\r
2491 /// <see cref="AssertionException"/> is thrown.
\r
2493 /// <param name="arg1">The first value, expected to be greater</param>
\r
2494 /// <param name="arg2">The second value, expected to be less</param>
\r
2495 /// <param name="message">The message that will be displayed on failure</param>
\r
2496 static public void GreaterOrEqual(double arg1,
\r
2497 double arg2, string message)
\r
2499 Assert.GreaterOrEqual(arg1, arg2, message, null);
\r
2503 /// Verifies that the first value is greater than or equal to the second
\r
2504 /// value. If they are not, then an
\r
2505 /// <see cref="AssertionException"/> is thrown.
\r
2507 /// <param name="arg1">The first value, expected to be greater</param>
\r
2508 /// <param name="arg2">The second value, expected to be less</param>
\r
2509 static public void GreaterOrEqual(double arg1, double arg2)
\r
2511 Assert.GreaterOrEqual(arg1, arg2, string.Empty, null);
\r
2519 /// Verifies that the first value is greater than or equal to the second
\r
2520 /// value. If they are not, then an
\r
2521 /// <see cref="AssertionException"/> is thrown.
\r
2523 /// <param name="arg1">The first value, expected to be greater</param>
\r
2524 /// <param name="arg2">The second value, expected to be less</param>
\r
2525 /// <param name="message">The message that will be displayed on failure</param>
\r
2526 /// <param name="args">Arguments to be used in formatting the message</param>
\r
2527 static public void GreaterOrEqual(float arg1,
\r
2528 float arg2, string message, params object[] args)
\r
2530 Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
\r
2534 /// Verifies that the first value is greater than or equal to the second
\r
2535 /// value. If they are not, then an
\r
2536 /// <see cref="AssertionException"/> is thrown.
\r
2538 /// <param name="arg1">The first value, expected to be greater</param>
\r
2539 /// <param name="arg2">The second value, expected to be less</param>
\r
2540 /// <param name="message">The message that will be displayed on failure</param>
\r
2541 static public void GreaterOrEqual(float arg1, float arg2, string message)
\r
2543 Assert.GreaterOrEqual(arg1, arg2, message, null);
\r
2547 /// Verifies that the first value is greater than or equal to the second
\r
2548 /// value. If they are not, then an
\r
2549 /// <see cref="AssertionException"/> is thrown.
\r
2551 /// <param name="arg1">The first value, expected to be greater</param>
\r
2552 /// <param name="arg2">The second value, expected to be less</param>
\r
2553 static public void GreaterOrEqual(float arg1, float arg2)
\r
2555 Assert.GreaterOrEqual(arg1, arg2, string.Empty, null);
\r
2560 #region IComparables
\r
2563 /// Verifies that the first value is greater than the second
\r
2564 /// value. If they are not, then an
\r
2565 /// <see cref="AssertionException"/> is thrown.
\r
2567 /// <param name="arg1">The first value, expected to be greater</param>
\r
2568 /// <param name="arg2">The second value, expected to be less</param>
\r
2569 /// <param name="message">The message that will be displayed on failure</param>
\r
2570 /// <param name="args">Arguments to be used in formatting the message</param>
\r
2571 static public void GreaterOrEqual(IComparable arg1,
\r
2572 IComparable arg2, string message, params object[] args)
\r
2574 Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
\r
2578 /// Verifies that the first value is greater than the second
\r
2579 /// value. If they are not, then an
\r
2580 /// <see cref="AssertionException"/> is thrown.
\r
2582 /// <param name="arg1">The first value, expected to be greater</param>
\r
2583 /// <param name="arg2">The second value, expected to be less</param>
\r
2584 /// <param name="message">The message that will be displayed on failure</param>
\r
2585 static public void GreaterOrEqual(IComparable arg1, IComparable arg2, string message)
\r
2587 Assert.GreaterOrEqual(arg1, arg2, message, null);
\r
2591 /// Verifies that the first value is greater than the second
\r
2592 /// value. If they are not, then an
\r
2593 /// <see cref="AssertionException"/> is thrown.
\r
2595 /// <param name="arg1">The first value, expected to be greater</param>
\r
2596 /// <param name="arg2">The second value, expected to be less</param>
\r
2597 static public void GreaterOrEqual(IComparable arg1, IComparable arg2)
\r
2599 Assert.GreaterOrEqual(arg1, arg2, string.Empty, null);
\r
2606 #region LessOrEqual
\r
2611 /// Verifies that the first value is less than or equal to the second
\r
2612 /// value. If it is not, then an
\r
2613 /// <see cref="AssertionException"/> is thrown.
\r
2615 /// <param name="arg1">The first value, expected to be less</param>
\r
2616 /// <param name="arg2">The second value, expected to be greater</param>
\r
2617 /// <param name="message">The message that will be displayed on failure</param>
\r
2618 /// <param name="args">Arguments to be used in formatting the message</param>
\r
2619 static public void LessOrEqual(int arg1, int arg2, string message, params object[] args)
\r
2621 Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
\r
2625 /// Verifies that the first value is less than or equal to the second
\r
2626 /// value. If it is not, then an
\r
2627 /// <see cref="AssertionException"/> is thrown.
\r
2629 /// <param name="arg1">The first value, expected to be less</param>
\r
2630 /// <param name="arg2">The second value, expected to be greater</param>
\r
2631 /// <param name="message">The message that will be displayed on failure</param>
\r
2632 static public void LessOrEqual(int arg1, int arg2, string message)
\r
2634 Assert.LessOrEqual(arg1, arg2, message, null);
\r
2638 /// Verifies that the first value is less than or equal to the second
\r
2639 /// value. If it is not, then an
\r
2640 /// <see cref="AssertionException"/> is thrown.
\r
2642 /// <param name="arg1">The first value, expected to be less</param>
\r
2643 /// <param name="arg2">The second value, expected to be greater</param>
\r
2644 static public void LessOrEqual(int arg1, int arg2)
\r
2646 Assert.LessOrEqual(arg1, arg2, string.Empty, null);
\r
2654 /// Verifies that the first value is less than or equal to the second
\r
2655 /// value. If it is not, then an
\r
2656 /// <see cref="AssertionException"/> is thrown.
\r
2658 /// <param name="arg1">The first value, expected to be less</param>
\r
2659 /// <param name="arg2">The second value, expected to be greater</param>
\r
2660 /// <param name="message">The message that will be displayed on failure</param>
\r
2661 /// <param name="args">Arguments to be used in formatting the message</param>
\r
2662 [CLSCompliant(false)]
\r
2663 static public void LessOrEqual(uint arg1, uint arg2, string message, params object[] args)
\r
2665 Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
\r
2669 /// Verifies that the first value is less than or equal to the second
\r
2670 /// value. If it is not, then an
\r
2671 /// <see cref="AssertionException"/> is thrown.
\r
2673 /// <param name="arg1">The first value, expected to be less</param>
\r
2674 /// <param name="arg2">The second value, expected to be greater</param>
\r
2675 /// <param name="message">The message that will be displayed on failure</param>
\r
2676 [CLSCompliant(false)]
\r
2677 static public void LessOrEqual(uint arg1, uint arg2, string message)
\r
2679 Assert.LessOrEqual(arg1, arg2, message, null);
\r
2683 /// Verifies that the first value is less than or equal to the second
\r
2684 /// value. If it is not, then an
\r
2685 /// <see cref="AssertionException"/> is thrown.
\r
2687 /// <param name="arg1">The first value, expected to be less</param>
\r
2688 /// <param name="arg2">The second value, expected to be greater</param>
\r
2689 [CLSCompliant(false)]
\r
2690 static public void LessOrEqual(uint arg1, uint arg2)
\r
2692 Assert.LessOrEqual(arg1, arg2, string.Empty, null);
\r
2700 /// Verifies that the first value is less than or equal to the second
\r
2701 /// value. If it is not, then an
\r
2702 /// <see cref="AssertionException"/> is thrown.
\r
2704 /// <param name="arg1">The first value, expected to be less</param>
\r
2705 /// <param name="arg2">The second value, expected to be greater</param>
\r
2706 /// <param name="message">The message that will be displayed on failure</param>
\r
2707 /// <param name="args">Arguments to be used in formatting the message</param>
\r
2708 static public void LessOrEqual(long arg1, long arg2, string message, params object[] args)
\r
2710 Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
\r
2714 /// Verifies that the first value is less than or equal to the second
\r
2715 /// value. If it is not, then an
\r
2716 /// <see cref="AssertionException"/> is thrown.
\r
2718 /// <param name="arg1">The first value, expected to be less</param>
\r
2719 /// <param name="arg2">The second value, expected to be greater</param>
\r
2720 /// <param name="message">The message that will be displayed on failure</param>
\r
2721 static public void LessOrEqual(long arg1, long arg2, string message)
\r
2723 Assert.LessOrEqual(arg1, arg2, message, null);
\r
2727 /// Verifies that the first value is less than or equal to the second
\r
2728 /// value. If it is not, then an
\r
2729 /// <see cref="AssertionException"/> is thrown.
\r
2731 /// <param name="arg1">The first value, expected to be less</param>
\r
2732 /// <param name="arg2">The second value, expected to be greater</param>
\r
2733 static public void LessOrEqual(long arg1, long arg2)
\r
2735 Assert.LessOrEqual(arg1, arg2, string.Empty, null);
\r
2743 /// Verifies that the first value is less than or equal to the second
\r
2744 /// value. If it is not, then an
\r
2745 /// <see cref="AssertionException"/> is thrown.
\r
2747 /// <param name="arg1">The first value, expected to be less</param>
\r
2748 /// <param name="arg2">The second value, expected to be greater</param>
\r
2749 /// <param name="message">The message that will be displayed on failure</param>
\r
2750 /// <param name="args">Arguments to be used in formatting the message</param>
\r
2751 [CLSCompliant(false)]
\r
2752 static public void LessOrEqual(ulong arg1, ulong arg2, string message, params object[] args)
\r
2754 Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
\r
2758 /// Verifies that the first value is less than or equal to the second
\r
2759 /// value. If it is not, then an
\r
2760 /// <see cref="AssertionException"/> is thrown.
\r
2762 /// <param name="arg1">The first value, expected to be less</param>
\r
2763 /// <param name="arg2">The second value, expected to be greater</param>
\r
2764 /// <param name="message">The message that will be displayed on failure</param>
\r
2765 [CLSCompliant(false)]
\r
2766 static public void LessOrEqual(ulong arg1, ulong arg2, string message)
\r
2768 Assert.LessOrEqual(arg1, arg2, message, null);
\r
2772 /// Verifies that the first value is less than or equal to the second
\r
2773 /// value. If it is not, then an
\r
2774 /// <see cref="AssertionException"/> is thrown.
\r
2776 /// <param name="arg1">The first value, expected to be less</param>
\r
2777 /// <param name="arg2">The second value, expected to be greater</param>
\r
2778 [CLSCompliant(false)]
\r
2779 static public void LessOrEqual(ulong arg1, ulong arg2)
\r
2781 Assert.LessOrEqual(arg1, arg2, string.Empty, null);
\r
2789 /// Verifies that the first value is less than or equal to the second
\r
2790 /// value. If it is not, then an
\r
2791 /// <see cref="AssertionException"/> is thrown.
\r
2793 /// <param name="arg1">The first value, expected to be less</param>
\r
2794 /// <param name="arg2">The second value, expected to be greater</param>
\r
2795 /// <param name="message">The message that will be displayed on failure</param>
\r
2796 /// <param name="args">Arguments to be used in formatting the message</param>
\r
2797 static public void LessOrEqual(decimal arg1, decimal arg2, string message, params object[] args)
\r
2799 Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
\r
2803 /// Verifies that the first value is less than or equal to the second
\r
2804 /// value. If it is not, then an
\r
2805 /// <see cref="AssertionException"/> is thrown.
\r
2807 /// <param name="arg1">The first value, expected to be less</param>
\r
2808 /// <param name="arg2">The second value, expected to be greater</param>
\r
2809 /// <param name="message">The message that will be displayed on failure</param>
\r
2810 static public void LessOrEqual(decimal arg1, decimal arg2, string message)
\r
2812 Assert.LessOrEqual(arg1, arg2, message, null);
\r
2816 /// Verifies that the first value is less than or equal to the second
\r
2817 /// value. If it is not, then an
\r
2818 /// <see cref="AssertionException"/> is thrown.
\r
2820 /// <param name="arg1">The first value, expected to be less</param>
\r
2821 /// <param name="arg2">The second value, expected to be greater</param>
\r
2822 static public void LessOrEqual(decimal arg1, decimal arg2)
\r
2824 Assert.LessOrEqual(arg1, arg2, string.Empty, null);
\r
2832 /// Verifies that the first value is less than or equal to the second
\r
2833 /// value. If it is not, then an
\r
2834 /// <see cref="AssertionException"/> is thrown.
\r
2836 /// <param name="arg1">The first value, expected to be less</param>
\r
2837 /// <param name="arg2">The second value, expected to be greater</param>
\r
2838 /// <param name="message">The message that will be displayed on failure</param>
\r
2839 /// <param name="args">Arguments to be used in formatting the message</param>
\r
2840 static public void LessOrEqual(double arg1, double arg2, string message, params object[] args)
\r
2842 Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
\r
2846 /// Verifies that the first value is less than or equal to the second
\r
2847 /// value. If it is not, then an
\r
2848 /// <see cref="AssertionException"/> is thrown.
\r
2850 /// <param name="arg1">The first value, expected to be less</param>
\r
2851 /// <param name="arg2">The second value, expected to be greater</param>
\r
2852 /// <param name="message">The message that will be displayed on failure</param>
\r
2853 static public void LessOrEqual(double arg1, double arg2, string message)
\r
2855 Assert.LessOrEqual(arg1, arg2, message, null);
\r
2859 /// Verifies that the first value is less than or equal to the second
\r
2860 /// value. If it is not, then an
\r
2861 /// <see cref="AssertionException"/> is thrown.
\r
2863 /// <param name="arg1">The first value, expected to be less</param>
\r
2864 /// <param name="arg2">The second value, expected to be greater</param>
\r
2865 static public void LessOrEqual(double arg1, double arg2)
\r
2867 Assert.LessOrEqual(arg1, arg2, string.Empty, null);
\r
2875 /// Verifies that the first value is less than or equal to the second
\r
2876 /// value. If it is not, then an
\r
2877 /// <see cref="AssertionException"/> is thrown.
\r
2879 /// <param name="arg1">The first value, expected to be less</param>
\r
2880 /// <param name="arg2">The second value, expected to be greater</param>
\r
2881 /// <param name="message">The message that will be displayed on failure</param>
\r
2882 /// <param name="args">Arguments to be used in formatting the message</param>
\r
2883 static public void LessOrEqual(float arg1, float arg2, string message, params object[] args)
\r
2885 Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
\r
2889 /// Verifies that the first value is less than or equal to the second
\r
2890 /// value. If it is not, then an
\r
2891 /// <see cref="AssertionException"/> is thrown.
\r
2893 /// <param name="arg1">The first value, expected to be less</param>
\r
2894 /// <param name="arg2">The second value, expected to be greater</param>
\r
2895 /// <param name="message">The message that will be displayed on failure</param>
\r
2896 static public void LessOrEqual(float arg1, float arg2, string message)
\r
2898 Assert.LessOrEqual(arg1, arg2, message, null);
\r
2902 /// Verifies that the first value is less than or equal to the second
\r
2903 /// value. If it is not, then an
\r
2904 /// <see cref="AssertionException"/> is thrown.
\r
2906 /// <param name="arg1">The first value, expected to be less</param>
\r
2907 /// <param name="arg2">The second value, expected to be greater</param>
\r
2908 static public void LessOrEqual(float arg1, float arg2)
\r
2910 Assert.LessOrEqual(arg1, arg2, string.Empty, null);
\r
2915 #region IComparables
\r
2918 /// Verifies that the first value is less than or equal to the second
\r
2919 /// value. If it is not, then an
\r
2920 /// <see cref="AssertionException"/> is thrown.
\r
2922 /// <param name="arg1">The first value, expected to be less</param>
\r
2923 /// <param name="arg2">The second value, expected to be greater</param>
\r
2924 /// <param name="message">The message that will be displayed on failure</param>
\r
2925 /// <param name="args">Arguments to be used in formatting the message</param>
\r
2926 static public void LessOrEqual(IComparable arg1, IComparable arg2, string message, params object[] args)
\r
2928 Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
\r
2932 /// Verifies that the first value is less than or equal to the second
\r
2933 /// value. If it is not, then an
\r
2934 /// <see cref="AssertionException"/> is thrown.
\r
2936 /// <param name="arg1">The first value, expected to be less</param>
\r
2937 /// <param name="arg2">The second value, expected to be greater</param>
\r
2938 /// <param name="message">The message that will be displayed on failure</param>
\r
2939 static public void LessOrEqual(IComparable arg1, IComparable arg2, string message)
\r
2941 Assert.LessOrEqual(arg1, arg2, message, null);
\r
2945 /// Verifies that the first value is less than or equal to the second
\r
2946 /// value. If it is not, then an
\r
2947 /// <see cref="AssertionException"/> is thrown.
\r
2949 /// <param name="arg1">The first value, expected to be less</param>
\r
2950 /// <param name="arg2">The second value, expected to be greater</param>
\r
2951 static public void LessOrEqual(IComparable arg1, IComparable arg2)
\r
2953 Assert.LessOrEqual(arg1, arg2, string.Empty, null);
\r