// **************************************************************** // This is free software licensed under the NUnit license. You // may obtain a copy of the license as well as information regarding // copyright ownership at http://nunit.org/?p=license&r=2.4. // **************************************************************** using System; using System.Collections; using System.ComponentModel; using NUnit.Framework.Constraints; using NUnit.Framework.SyntaxHelpers; namespace NUnit.Framework { /// /// The Assert class contains a collection of static methods that /// implement the most common assertions used in NUnit. /// public class Assert { #region Assert Counting private static int counter = 0; /// /// Gets the number of assertions executed so far and /// resets the counter to zero. /// public static int Counter { get { int cnt = counter; counter = 0; return cnt; } } private static void IncrementAssertCount() { ++counter; } #endregion #region Constructor /// /// We don't actually want any instances of this object, but some people /// like to inherit from it to add other static methods. Hence, the /// protected constructor disallows any instances of this object. /// protected Assert() {} #endregion #region Equals and ReferenceEquals /// /// The Equals method throws an AssertionException. This is done /// to make sure there is no mistake by calling this function. /// /// /// [EditorBrowsable(EditorBrowsableState.Never)] public static new bool Equals(object a, object b) { throw new AssertionException("Assert.Equals should not be used for Assertions"); } /// /// override the default ReferenceEquals to throw an AssertionException. This /// implementation makes sure there is no mistake in calling this function /// as part of Assert. /// /// /// public static new void ReferenceEquals(object a, object b) { throw new AssertionException("Assert.ReferenceEquals should not be used for Assertions"); } #endregion #region IsTrue /// /// Asserts that a condition is true. If the condition is false the method throws /// an . /// /// The evaluated condition /// The message to display if the condition is false /// Arguments to be used in formatting the message static public void IsTrue(bool condition, string message, params object[] args) { Assert.That(condition, Is.True, message, args); } /// /// Asserts that a condition is true. If the condition is false the method throws /// an . /// /// The evaluated condition /// The message to display if the condition is false static public void IsTrue(bool condition, string message) { Assert.IsTrue(condition, message, null); } /// /// Asserts that a condition is true. If the condition is false the method throws /// an . /// /// The evaluated condition static public void IsTrue(bool condition) { Assert.IsTrue(condition, null, null); } #endregion #region IsFalse /// /// Asserts that a condition is false. If the condition is true the method throws /// an . /// /// The evaluated condition /// The message to display if the condition is true /// Arguments to be used in formatting the message static public void IsFalse(bool condition, string message, params object[] args) { Assert.That(condition, Is.False, message, args); } /// /// Asserts that a condition is false. If the condition is true the method throws /// an . /// /// The evaluated condition /// The message to display if the condition is true static public void IsFalse(bool condition, string message) { Assert.IsFalse( condition, message, null ); } /// /// Asserts that a condition is false. If the condition is true the method throws /// an . /// /// The evaluated condition static public void IsFalse(bool condition) { Assert.IsFalse(condition, string.Empty, null); } #endregion #region IsNotNull /// /// Verifies that the object that is passed in is not equal to null /// If the object is null then an /// is thrown. /// /// The object that is to be tested /// The message to be displayed when the object is null /// Arguments to be used in formatting the message static public void IsNotNull(Object anObject, string message, params object[] args) { Assert.That(anObject, Is.Not.Null, message, args); } /// /// Verifies that the object that is passed in is not equal to null /// If the object is null then an /// is thrown. /// /// The object that is to be tested /// The message to be displayed when the object is null static public void IsNotNull(Object anObject, string message) { Assert.IsNotNull(anObject, message, null); } /// /// Verifies that the object that is passed in is not equal to null /// If the object is null then an /// is thrown. /// /// The object that is to be tested static public void IsNotNull(Object anObject) { Assert.IsNotNull(anObject, string.Empty, null); } #endregion #region IsNull /// /// Verifies that the object that is passed in is equal to null /// If the object is not null then an /// is thrown. /// /// The object that is to be tested /// The message to be displayed when the object is not null /// Arguments to be used in formatting the message static public void IsNull(Object anObject, string message, params object[] args) { Assert.That( anObject, Is.Null, message, args ); } /// /// Verifies that the object that is passed in is equal to null /// If the object is not null then an /// is thrown. /// /// The object that is to be tested /// The message to be displayed when the object is not null static public void IsNull(Object anObject, string message) { Assert.IsNull(anObject, message, null); } /// /// Verifies that the object that is passed in is equal to null /// If the object is not null null then an /// is thrown. /// /// The object that is to be tested static public void IsNull(Object anObject) { Assert.IsNull(anObject, string.Empty, null); } #endregion #region IsNaN /// /// Verifies that the double is passed is an NaN value. /// If the object is not NaN then an /// is thrown. /// /// The value that is to be tested /// The message to be displayed when the object is not null /// Arguments to be used in formatting the message static public void IsNaN(double aDouble, string message, params object[] args) { Assert.That(aDouble, Is.NaN, message, args); } /// /// Verifies that the double is passed is an NaN value. /// If the object is not NaN then an /// is thrown. /// /// The object that is to be tested /// The message to be displayed when the object is not null static public void IsNaN(double aDouble, string message) { Assert.IsNaN(aDouble, message, null); } /// /// Verifies that the double is passed is an NaN value. /// If the object is not NaN then an /// is thrown. /// /// The object that is to be tested static public void IsNaN(double aDouble) { Assert.IsNaN(aDouble, string.Empty, null); } #endregion #region IsEmpty /// /// Assert that a string is empty - that is equal to string.Empty /// /// The string to be tested /// The message to be displayed on failure /// Arguments to be used in formatting the message public static void IsEmpty( string aString, string message, params object[] args ) { Assert.That(aString, new EmptyStringConstraint(), message, args); } /// /// Assert that a string is empty - that is equal to string.Emtpy /// /// The string to be tested /// The message to be displayed on failure public static void IsEmpty( string aString, string message ) { IsEmpty( aString, message, null ); } /// /// Assert that a string is empty - that is equal to string.Emtpy /// /// The string to be tested public static void IsEmpty( string aString ) { IsEmpty( aString, string.Empty, null ); } /// /// Assert that an array, list or other collection is empty /// /// An array, list or other collection implementing ICollection /// The message to be displayed on failure /// Arguments to be used in formatting the message public static void IsEmpty( ICollection collection, string message, params object[] args ) { Assert.That(collection, new EmptyCollectionConstraint(), message, args); } /// /// Assert that an array, list or other collection is empty /// /// An array, list or other collection implementing ICollection /// The message to be displayed on failure public static void IsEmpty( ICollection collection, string message ) { IsEmpty( collection, message, null ); } /// /// Assert that an array,list or other collection is empty /// /// An array, list or other collection implementing ICollection public static void IsEmpty( ICollection collection ) { IsEmpty( collection, string.Empty, null ); } #endregion #region IsNotEmpty /// /// Assert that a string is not empty - that is not equal to string.Empty /// /// The string to be tested /// The message to be displayed on failure /// Arguments to be used in formatting the message public static void IsNotEmpty( string aString, string message, params object[] args ) { Assert.That(aString, Is.Not.Empty, message, args); } /// /// Assert that a string is empty - that is equal to string.Emtpy /// /// The string to be tested /// The message to be displayed on failure public static void IsNotEmpty( string aString, string message ) { IsNotEmpty( aString, message, null ); } /// /// Assert that a string is empty - that is equal to string.Emtpy /// /// The string to be tested public static void IsNotEmpty( string aString ) { IsNotEmpty( aString, string.Empty, null ); } /// /// Assert that an array, list or other collection is empty /// /// An array, list or other collection implementing ICollection /// The message to be displayed on failure /// Arguments to be used in formatting the message public static void IsNotEmpty( ICollection collection, string message, params object[] args ) { Assert.That(collection, Is.Not.Empty, message, args); } /// /// Assert that an array, list or other collection is empty /// /// An array, list or other collection implementing ICollection /// The message to be displayed on failure public static void IsNotEmpty( ICollection collection, string message ) { IsNotEmpty( collection, message, null ); } /// /// Assert that an array,list or other collection is empty /// /// An array, list or other collection implementing ICollection public static void IsNotEmpty( ICollection collection ) { IsNotEmpty( collection, string.Empty, null ); } #endregion #region IsAssignableFrom /// /// Asserts that an object may be assigned a value of a given Type. /// /// The expected Type. /// The object under examination static public void IsAssignableFrom( System.Type expected, object actual ) { IsAssignableFrom(expected, actual, ""); } /// /// Asserts that an object may be assigned a value of a given Type. /// /// The expected Type. /// The object under examination /// The messge to display in case of failure static public void IsAssignableFrom( System.Type expected, object actual, string message ) { IsAssignableFrom(expected, actual, message, null); } /// /// Asserts that an object may be assigned a value of a given Type. /// /// The expected Type. /// The object under examination /// The message to display in case of failure /// Array of objects to be used in formatting the message static public void IsAssignableFrom( System.Type expected, object actual, string message, params object[] args ) { Assert.That(actual, Is.AssignableFrom(expected), message, args); } #endregion #region IsNotAssignableFrom /// /// Asserts that an object may not be assigned a value of a given Type. /// /// The expected Type. /// The object under examination static public void IsNotAssignableFrom( System.Type expected, object actual ) { IsNotAssignableFrom(expected, actual, ""); } /// /// Asserts that an object may not be assigned a value of a given Type. /// /// The expected Type. /// The object under examination /// The messge to display in case of failure static public void IsNotAssignableFrom( System.Type expected, object actual, string message ) { IsNotAssignableFrom(expected, actual, message, null); } /// /// Asserts that an object may not be assigned a value of a given Type. /// /// The expected Type. /// The object under examination /// The message to display in case of failure /// Array of objects to be used in formatting the message static public void IsNotAssignableFrom( System.Type expected, object actual, string message, params object[] args ) { Assert.That(actual, Is.Not.AssignableFrom(expected), message, args); } #endregion #region IsInstanceOfType /// /// Asserts that an object is an instance of a given type. /// /// The expected Type /// The object being examined public static void IsInstanceOfType( System.Type expected, object actual ) { IsInstanceOfType( expected, actual, string.Empty, null ); } /// /// Asserts that an object is an instance of a given type. /// /// The expected Type /// The object being examined /// A message to display in case of failure public static void IsInstanceOfType( System.Type expected, object actual, string message ) { IsInstanceOfType( expected, actual, message, null ); } /// /// Asserts that an object is an instance of a given type. /// /// The expected Type /// The object being examined /// A message to display in case of failure /// An array of objects to be used in formatting the message public static void IsInstanceOfType( System.Type expected, object actual, string message, params object[] args ) { Assert.That(actual, Is.InstanceOfType(expected), message, args); } #endregion #region IsNotInstanceOfType /// /// Asserts that an object is not an instance of a given type. /// /// The expected Type /// The object being examined public static void IsNotInstanceOfType( System.Type expected, object actual ) { IsNotInstanceOfType( expected, actual, string.Empty, null ); } /// /// Asserts that an object is not an instance of a given type. /// /// The expected Type /// The object being examined /// A message to display in case of failure public static void IsNotInstanceOfType( System.Type expected, object actual, string message ) { IsNotInstanceOfType( expected, actual, message, null ); } /// /// Asserts that an object is not an instance of a given type. /// /// The expected Type /// The object being examined /// A message to display in case of failure /// An array of objects to be used in formatting the message public static void IsNotInstanceOfType( System.Type expected, object actual, string message, params object[] args ) { Assert.That(actual, Is.Not.InstanceOfType(expected), message, args); } #endregion #region AreEqual #region Ints /// /// Verifies that two ints are equal. If they are not, then an /// is thrown. /// /// The expected value /// The actual value /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void AreEqual(int expected, int actual, string message, params object[] args) { Assert.That(actual, Is.EqualTo(expected), message, args); } /// /// Verifies that two ints are equal. If they are not, then an /// is thrown. /// /// The expected value /// The actual value /// The message that will be displayed on failure static public void AreEqual(int expected, int actual, string message) { Assert.AreEqual(expected, actual, message, null); } /// /// Verifies that two ints are equal. If they are not, then an /// is thrown. /// /// The expected value /// The actual value static public void AreEqual(int expected, int actual) { Assert.AreEqual(expected, actual, string.Empty, null); } #endregion #region Longs /// /// Verifies that two longs are equal. If they are not, then an /// is thrown. /// /// The expected value /// The actual value /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void AreEqual(long expected, long actual, string message, params object[] args) { Assert.That(actual, Is.EqualTo(expected), message, args); } /// /// Verifies that two longs are equal. If they are not, then an /// is thrown. /// /// The expected value /// The actual value /// The message that will be displayed on failure static public void AreEqual(long expected, long actual, string message) { Assert.AreEqual(expected, actual, message, null); } /// /// Verifies that two longs are equal. If they are not, then an /// is thrown. /// /// The expected value /// The actual value static public void AreEqual(long expected, long actual) { Assert.AreEqual(expected, actual, string.Empty, null); } #endregion #region UInts /// /// Verifies that two uints are equal. If they are not, then an /// is thrown. /// /// The expected value /// The actual value /// The message that will be displayed on failure /// Arguments to be used in formatting the message [CLSCompliant(false)] static public void AreEqual(uint expected, uint actual, string message, params object[] args) { Assert.That(actual, Is.EqualTo(expected), message, args); } /// /// Verifies that two uints are equal. If they are not, then an /// is thrown. /// /// The expected value /// The actual value /// The message that will be displayed on failure [CLSCompliant(false)] static public void AreEqual(uint expected, uint actual, string message) { Assert.AreEqual(expected, actual, message, null); } /// /// Verifies that two uints are equal. If they are not, then an /// is thrown. /// /// The expected value /// The actual value [CLSCompliant(false)] static public void AreEqual(uint expected, uint actual) { Assert.AreEqual(expected, actual, string.Empty, null); } #endregion #region Ulongs /// /// Verifies that two ulongs are equal. If they are not, then an /// is thrown. /// /// The expected value /// The actual value /// The message that will be displayed on failure /// Arguments to be used in formatting the message [CLSCompliant(false)] static public void AreEqual(ulong expected, ulong actual, string message, params object[] args) { Assert.That(actual, Is.EqualTo(expected), message, args); } /// /// Verifies that two ulongs are equal. If they are not, then an /// is thrown. /// /// The expected value /// The actual value /// The message that will be displayed on failure [CLSCompliant(false)] static public void AreEqual(ulong expected, ulong actual, string message) { Assert.AreEqual(expected, actual, message, null); } /// /// Verifies that two ulongs are equal. If they are not, then an /// is thrown. /// /// The expected value /// The actual value [CLSCompliant(false)] static public void AreEqual(ulong expected, ulong actual) { Assert.AreEqual(expected, actual, string.Empty, null); } #endregion #region Decimals /// /// Verifies that two decimals are equal. If they are not, then an /// is thrown. /// /// The expected value /// The actual value /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void AreEqual(decimal expected, decimal actual, string message, params object[] args) { Assert.That(actual, Is.EqualTo(expected), message, args); } /// /// Verifies that two decimal are equal. If they are not, then an /// is thrown. /// /// The expected value /// The actual value /// The message that will be displayed on failure static public void AreEqual(decimal expected, decimal actual, string message) { Assert.AreEqual( expected, actual, message, null ); } /// /// Verifies that two decimals are equal. If they are not, then an /// is thrown. /// /// The expected value /// The actual value static public void AreEqual(decimal expected, decimal actual ) { Assert.AreEqual( expected, actual, string.Empty, null ); } #endregion #region Doubles /// /// Verifies that two doubles are equal considering a delta. If the /// expected value is infinity then the delta value is ignored. If /// they are not equals then an is /// thrown. /// /// The expected value /// The actual value /// The maximum acceptable difference between the /// the expected and the actual /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void AreEqual(double expected, double actual, double delta, string message, params object[] args) { Constraint constraint = new EqualConstraint( expected ); if ( double.IsNaN(expected) || double.IsInfinity(expected) ) Assert.That(actual, Is.EqualTo( expected ), message, args); else Assert.That(actual, Is.EqualTo(expected).Within(delta), message, args); } /// /// Verifies that two doubles are equal considering a delta. If the /// expected value is infinity then the delta value is ignored. If /// they are not equals then an is /// thrown. /// /// The expected value /// The actual value /// The maximum acceptable difference between the /// the expected and the actual /// The message that will be displayed on failure static public void AreEqual(double expected, double actual, double delta, string message) { Assert.AreEqual( expected, actual, delta, message, null ); } /// /// Verifies that two doubles are equal considering a delta. If the /// expected value is infinity then the delta value is ignored. If /// they are not equals then an is /// thrown. /// /// The expected value /// The actual value /// The maximum acceptable difference between the /// the expected and the actual static public void AreEqual(double expected, double actual, double delta) { Assert.AreEqual(expected, actual, delta, string.Empty, null); } #endregion #region Floats /// /// Verifies that two floats are equal considering a delta. If the /// expected value is infinity then the delta value is ignored. If /// they are not equals then an is /// thrown. /// /// The expected value /// The actual value /// The maximum acceptable difference between the /// the expected and the actual /// The message displayed upon failure /// Arguments to be used in formatting the message static public void AreEqual(float expected, float actual, float delta, string message, params object[] args) { if (float.IsNaN(expected) || float.IsInfinity(expected)) Assert.That(actual, Is.EqualTo( expected), message, args ); else Assert.That(actual, Is.EqualTo(expected).Within(delta), message, args); } /// /// Verifies that two floats are equal considering a delta. If the /// expected value is infinity then the delta value is ignored. If /// they are not equals then an is /// thrown. /// /// The expected value /// The actual value /// The maximum acceptable difference between the /// the expected and the actual /// The message displayed upon failure static public void AreEqual(float expected, float actual, float delta, string message) { Assert.AreEqual(expected, actual, delta, message, null); } /// /// Verifies that two floats are equal considering a delta. If the /// expected value is infinity then the delta value is ignored. If /// they are not equals then an is /// thrown. /// /// The expected value /// The actual value /// The maximum acceptable difference between the /// the expected and the actual static public void AreEqual(float expected, float actual, float delta) { Assert.AreEqual(expected, actual, delta, string.Empty, null); } #endregion #region Objects /// /// Verifies that two objects are equal. Two objects are considered /// equal if both are null, or if both have the same value. All /// non-numeric types are compared by using the Equals method. /// Arrays are compared by comparing each element using the same rules. /// If they are not equal an is thrown. /// /// The value that is expected /// The actual value /// The message to display if objects are not equal /// Arguments to be used in formatting the message static public void AreEqual(Object expected, Object actual, string message, params object[] args) { Assert.That(actual, Is.EqualTo(expected), message, args); } /// /// Verifies that two objects are equal. Two objects are considered /// equal if both are null, or if both have the same value. All /// non-numeric types are compared by using the Equals method. /// If they are not equal an is thrown. /// /// The value that is expected /// The actual value /// The message to display if objects are not equal static public void AreEqual(Object expected, Object actual, string message) { Assert.AreEqual(expected, actual, message, null); } /// /// Verifies that two objects are equal. Two objects are considered /// equal if both are null, or if both have the same value. All /// non-numeric types are compared by using the Equals method. /// If they are not equal an is thrown. /// /// The value that is expected /// The actual value static public void AreEqual(Object expected, Object actual) { Assert.AreEqual(expected, actual, string.Empty, null); } #endregion #endregion #region AreNotEqual #region Objects /// /// Asserts that two objects are not equal. If they are equal /// an is thrown. /// /// The expected object /// The actual object /// The message to be displayed when the two objects are the same object. /// Arguments to be used in formatting the message static public void AreNotEqual( Object expected, Object actual, string message, params object[] args) { Assert.That(actual, Is.Not.EqualTo(expected), message, args); } /// /// Asserts that two objects are not equal. If they are equal /// an is thrown. /// /// The expected object /// The actual object /// The message to be displayed when the objects are the same static public void AreNotEqual(Object expected, Object actual, string message) { Assert.AreNotEqual(expected, actual, message, null); } /// /// Asserts that two objects are not equal. If they are equal /// an is thrown. /// /// The expected object /// The actual object static public void AreNotEqual(Object expected, Object actual) { Assert.AreNotEqual(expected, actual, string.Empty, null); } #endregion #region Ints /// /// Asserts that two ints are not equal. If they are equal /// an is thrown. /// /// The expected object /// The actual object /// The message to be displayed when the two objects are the same object. /// Arguments to be used in formatting the message static public void AreNotEqual(int expected, int actual, string message, params object[] args) { Assert.That(actual, Is.Not.EqualTo(expected), message, args); } /// /// Asserts that two ints are not equal. If they are equal /// an is thrown. /// /// The expected object /// The actual object /// The message to be displayed when the objects are the same static public void AreNotEqual(int expected, int actual, string message) { Assert.AreNotEqual(expected, actual, message, null); } /// /// Asserts that two ints are not equal. If they are equal /// an is thrown. /// /// The expected object /// The actual object static public void AreNotEqual(int expected, int actual) { Assert.AreNotEqual(expected, actual, string.Empty, null); } #endregion #region Longs /// /// Asserts that two longss are not equal. If they are equal /// an is thrown. /// /// The expected object /// The actual object /// The message to be displayed when the two objects are the same object. /// Arguments to be used in formatting the message static public void AreNotEqual(long expected, long actual, string message, params object[] args) { Assert.That(actual, Is.Not.EqualTo(expected), message, args); } /// /// Asserts that two longs are not equal. If they are equal /// an is thrown. /// /// The expected object /// The actual object /// The message to be displayed when the objects are the same static public void AreNotEqual(long expected, long actual, string message) { Assert.AreNotEqual(expected, actual, message, null); } /// /// Asserts that two longs are not equal. If they are equal /// an is thrown. /// /// The expected object /// The actual object static public void AreNotEqual(long expected, long actual) { Assert.AreNotEqual(expected, actual, string.Empty, null); } #endregion #region UInts /// /// Asserts that two uints are not equal. If they are equal /// an is thrown. /// /// The expected object /// The actual object /// The message to be displayed when the two objects are the same object. /// Arguments to be used in formatting the message [CLSCompliant(false)] static public void AreNotEqual(uint expected, uint actual, string message, params object[] args) { Assert.That(actual, Is.Not.EqualTo(expected), message, args); } /// /// Asserts that two uints are not equal. If they are equal /// an is thrown. /// /// The expected object /// The actual object /// The message to be displayed when the objects are the same [CLSCompliant(false)] static public void AreNotEqual(uint expected, uint actual, string message) { Assert.AreNotEqual(expected, actual, message, null); } /// /// Asserts that two uints are not equal. If they are equal /// an is thrown. /// /// The expected object /// The actual object [CLSCompliant(false)] static public void AreNotEqual(uint expected, uint actual) { Assert.AreNotEqual(expected, actual, string.Empty, null); } #endregion #region Ulongs /// /// Asserts that two ulongs are not equal. If they are equal /// an is thrown. /// /// The expected object /// The actual object /// The message to be displayed when the two objects are the same object. /// Arguments to be used in formatting the message [CLSCompliant(false)] static public void AreNotEqual(ulong expected, ulong actual, string message, params object[] args) { Assert.That(actual, Is.Not.EqualTo(expected), message, args); } /// /// Asserts that two ulongs are not equal. If they are equal /// an is thrown. /// /// The expected object /// The actual object /// The message to be displayed when the objects are the same [CLSCompliant(false)] static public void AreNotEqual(ulong expected, ulong actual, string message) { Assert.AreNotEqual(expected, actual, message, null); } /// /// Asserts that two ulong are not equal. If they are equal /// an is thrown. /// /// The expected object /// The actual object [CLSCompliant(false)] static public void AreNotEqual(ulong expected, ulong actual) { Assert.AreNotEqual(expected, actual, string.Empty, null); } #endregion #region Decimals /// /// Asserts that two decimals are not equal. If they are equal /// an is thrown. /// /// The expected object /// The actual object /// The message to be displayed when the two objects are the same object. /// Arguments to be used in formatting the message static public void AreNotEqual( decimal expected, decimal actual, string message, params object[] args) { Assert.That(actual, Is.Not.EqualTo(expected), message, args); } /// /// Asserts that two decimals are not equal. If they are equal /// an is thrown. /// /// The expected object /// The actual object /// The message to be displayed when the objects are the same static public void AreNotEqual(decimal expected, decimal actual, string message) { Assert.AreNotEqual(expected, actual, message, null); } /// /// Asserts that two decimals are not equal. If they are equal /// an is thrown. /// /// The expected object /// The actual object static public void AreNotEqual(decimal expected, decimal actual) { Assert.AreNotEqual(expected, actual, string.Empty, null); } #endregion #region Floats /// /// Asserts that two floats are not equal. If they are equal /// an is thrown. /// /// The expected object /// The actual object /// The message to be displayed when the two objects are the same object. /// Arguments to be used in formatting the message static public void AreNotEqual( float expected, float actual, string message, params object[] args) { Assert.That(actual, Is.Not.EqualTo(expected), message, args); } /// /// Asserts that two floats are not equal. If they are equal /// an is thrown. /// /// The expected object /// The actual object /// The message to be displayed when the objects are the same static public void AreNotEqual(float expected, float actual, string message) { Assert.AreNotEqual(expected, actual, message, null); } /// /// Asserts that two floats are not equal. If they are equal /// an is thrown. /// /// The expected object /// The actual object static public void AreNotEqual(float expected, float actual) { Assert.AreNotEqual(expected, actual, string.Empty, null); } #endregion #region Doubles /// /// Asserts that two doubles are not equal. If they are equal /// an is thrown. /// /// The expected object /// The actual object /// The message to be displayed when the two objects are the same object. /// Arguments to be used in formatting the message static public void AreNotEqual( double expected, double actual, string message, params object[] args) { Assert.That(actual, Is.Not.EqualTo(expected), message, args); } /// /// Asserts that two doubles are not equal. If they are equal /// an is thrown. /// /// The expected object /// The actual object /// The message to be displayed when the objects are the same static public void AreNotEqual(double expected, double actual, string message) { Assert.AreNotEqual(expected, actual, message, null); } /// /// Asserts that two doubles are not equal. If they are equal /// an is thrown. /// /// The expected object /// The actual object static public void AreNotEqual(double expected, double actual) { Assert.AreNotEqual(expected, actual, string.Empty, null); } #endregion #endregion #region AreSame /// /// Asserts that two objects refer to the same object. If they /// are not the same an is thrown. /// /// The expected object /// The actual object /// The message to be displayed when the two objects are not the same object. /// Arguments to be used in formatting the message static public void AreSame(Object expected, Object actual, string message, params object[] args) { Assert.That(actual, Is.SameAs(expected), message, args); } /// /// Asserts that two objects refer to the same object. If they /// are not the same an is thrown. /// /// The expected object /// The actual object /// The message to be displayed when the object is null static public void AreSame(Object expected, Object actual, string message) { Assert.AreSame(expected, actual, message, null); } /// /// Asserts that two objects refer to the same object. If they /// are not the same an is thrown. /// /// The expected object /// The actual object static public void AreSame(Object expected, Object actual) { Assert.AreSame(expected, actual, string.Empty, null); } #endregion #region AreNotSame /// /// Asserts that two objects do not refer to the same object. If they /// are the same an is thrown. /// /// The expected object /// The actual object /// The message to be displayed when the two objects are the same object. /// Arguments to be used in formatting the message static public void AreNotSame(Object expected, Object actual, string message, params object[] args) { Assert.That(actual, Is.Not.SameAs(expected), message, args); } /// /// Asserts that two objects do not refer to the same object. If they /// are the same an is thrown. /// /// The expected object /// The actual object /// The message to be displayed when the objects are the same static public void AreNotSame(Object expected, Object actual, string message) { Assert.AreNotSame(expected, actual, message, null); } /// /// Asserts that two objects do not refer to the same object. If they /// are the same an is thrown. /// /// The expected object /// The actual object static public void AreNotSame(Object expected, Object actual) { Assert.AreNotSame(expected, actual, string.Empty, null); } #endregion #region Greater #region Ints /// /// Verifies that the first value is greater than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void Greater(int arg1, int arg2, string message, params object[] args) { Assert.That(arg1, Is.GreaterThan(arg2), message, args); } /// /// Verifies that the first value is greater than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure static public void Greater(int arg1, int arg2, string message) { Assert.Greater( arg1, arg2, message, null ); } /// /// Verifies that the first value is greater than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less static public void Greater(int arg1, int arg2 ) { Assert.Greater( arg1, arg2, string.Empty, null ); } #endregion #region UInts /// /// Verifies that the first value is greater than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure /// Arguments to be used in formatting the message [CLSCompliant(false)] static public void Greater(uint arg1, uint arg2, string message, params object[] args) { Assert.That(arg1, Is.GreaterThan(arg2), message, args); } /// /// Verifies that the first value is greater than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure [CLSCompliant(false)] static public void Greater(uint arg1, uint arg2, string message) { Assert.Greater( arg1, arg2, message, null ); } /// /// Verifies that the first value is greater than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less [CLSCompliant(false)] static public void Greater(uint arg1, uint arg2 ) { Assert.Greater( arg1, arg2, string.Empty, null ); } #endregion #region Longs /// /// Verifies that the first value is greater than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void Greater(long arg1, long arg2, string message, params object[] args) { Assert.That(arg1, Is.GreaterThan(arg2), message, args); } /// /// Verifies that the first value is greater than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure static public void Greater(long arg1, long arg2, string message) { Assert.Greater( arg1, arg2, message, null ); } /// /// Verifies that the first value is greater than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less static public void Greater(long arg1, long arg2 ) { Assert.Greater( arg1, arg2, string.Empty, null ); } #endregion #region ULongs /// /// Verifies that the first value is greater than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure /// Arguments to be used in formatting the message [CLSCompliant(false)] static public void Greater(ulong arg1, ulong arg2, string message, params object[] args) { Assert.That(arg1, Is.GreaterThan(arg2), message, args); } /// /// Verifies that the first value is greater than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure [CLSCompliant(false)] static public void Greater(ulong arg1, ulong arg2, string message) { Assert.Greater( arg1, arg2, message, null ); } /// /// Verifies that the first value is greater than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less [CLSCompliant(false)] static public void Greater(ulong arg1, ulong arg2 ) { Assert.Greater( arg1, arg2, string.Empty, null ); } #endregion #region Decimals /// /// Verifies that the first value is greater than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void Greater(decimal arg1, decimal arg2, string message, params object[] args) { Assert.That(arg1, Is.GreaterThan(arg2), message, args); } /// /// Verifies that the first value is greater than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure static public void Greater(decimal arg1, decimal arg2, string message) { Assert.Greater( arg1, arg2, message, null ); } /// /// Verifies that the first value is greater than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less static public void Greater(decimal arg1, decimal arg2 ) { Assert.Greater( arg1, arg2, string.Empty, null ); } #endregion #region Doubles /// /// Verifies that the first value is greater than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void Greater(double arg1, double arg2, string message, params object[] args) { Assert.That(arg1, Is.GreaterThan(arg2), message, args); } /// /// Verifies that the first value is greater than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure static public void Greater(double arg1, double arg2, string message) { Assert.Greater( arg1, arg2, message, null ); } /// /// Verifies that the first value is greater than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less static public void Greater(double arg1, double arg2) { Assert.Greater(arg1, arg2, string.Empty, null); } #endregion #region Floats /// /// Verifies that the first value is greater than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void Greater(float arg1, float arg2, string message, params object[] args) { Assert.That(arg1, Is.GreaterThan(arg2), message, args); } /// /// Verifies that the first value is greater than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure static public void Greater(float arg1, float arg2, string message) { Assert.Greater(arg1, arg2, message, null); } /// /// Verifies that the first value is greater than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less static public void Greater(float arg1, float arg2) { Assert.Greater(arg1, arg2, string.Empty, null); } #endregion #region IComparables /// /// Verifies that the first value is greater than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void Greater(IComparable arg1, IComparable arg2, string message, params object[] args) { Assert.That(arg1, Is.GreaterThan(arg2), message, args); } /// /// Verifies that the first value is greater than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure static public void Greater(IComparable arg1, IComparable arg2, string message) { Assert.Greater(arg1, arg2, message, null); } /// /// Verifies that the first value is greater than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less static public void Greater(IComparable arg1, IComparable arg2) { Assert.Greater(arg1, arg2, string.Empty, null); } #endregion #endregion #region Less #region Ints /// /// Verifies that the first value is less than the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void Less(int arg1, int arg2, string message, params object[] args) { Assert.That(arg1, Is.LessThan(arg2), message, args); } /// /// Verifies that the first value is less than the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure static public void Less(int arg1, int arg2, string message) { Assert.Less(arg1, arg2, message, null); } /// /// Verifies that the first value is less than the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater static public void Less(int arg1, int arg2) { Assert.Less( arg1, arg2, string.Empty, null); } #endregion #region UInts /// /// Verifies that the first value is less than the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure /// Arguments to be used in formatting the message [CLSCompliant(false)] static public void Less(uint arg1, uint arg2, string message, params object[] args) { Assert.That(arg1, Is.LessThan(arg2), message, args); } /// /// Verifies that the first value is less than the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure [CLSCompliant(false)] static public void Less(uint arg1, uint arg2, string message) { Assert.Less(arg1, arg2, message, null); } /// /// Verifies that the first value is less than the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater [CLSCompliant(false)] static public void Less(uint arg1, uint arg2) { Assert.Less( arg1, arg2, string.Empty, null); } #endregion #region Longs /// /// Verifies that the first value is less than the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void Less(long arg1, long arg2, string message, params object[] args) { Assert.That(arg1, Is.LessThan(arg2), message, args); } /// /// Verifies that the first value is less than the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure static public void Less(long arg1, long arg2, string message) { Assert.Less(arg1, arg2, message, null); } /// /// Verifies that the first value is less than the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater static public void Less(long arg1, long arg2) { Assert.Less( arg1, arg2, string.Empty, null); } #endregion #region ULongs /// /// Verifies that the first value is less than the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure /// Arguments to be used in formatting the message [CLSCompliant(false)] static public void Less(ulong arg1, ulong arg2, string message, params object[] args) { Assert.That(arg1, Is.LessThan(arg2), message, args); } /// /// Verifies that the first value is less than the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure [CLSCompliant(false)] static public void Less(ulong arg1, ulong arg2, string message) { Assert.Less(arg1, arg2, message, null); } /// /// Verifies that the first value is less than the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater [CLSCompliant(false)] static public void Less(ulong arg1, ulong arg2) { Assert.Less( arg1, arg2, string.Empty, null); } #endregion #region Decimals /// /// Verifies that the first value is less than the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void Less(decimal arg1, decimal arg2, string message, params object[] args) { Assert.That(arg1, Is.LessThan(arg2), message, args); } /// /// Verifies that the first value is less than the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure static public void Less(decimal arg1, decimal arg2, string message) { Assert.Less(arg1, arg2, message, null); } /// /// Verifies that the first value is less than the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater static public void Less(decimal arg1, decimal arg2) { Assert.Less(arg1, arg2, string.Empty, null); } #endregion #region Doubles /// /// Verifies that the first value is less than the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void Less(double arg1, double arg2, string message, params object[] args) { Assert.That(arg1, Is.LessThan(arg2), message, args); } /// /// Verifies that the first value is less than the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure static public void Less(double arg1, double arg2, string message) { Assert.Less(arg1, arg2, message, null); } /// /// Verifies that the first value is less than the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater static public void Less(double arg1, double arg2) { Assert.Less(arg1, arg2, string.Empty, null); } #endregion #region Floats /// /// Verifies that the first value is less than the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void Less(float arg1, float arg2, string message, params object[] args) { Assert.That(arg1, Is.LessThan(arg2), message, args); } /// /// Verifies that the first value is less than the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure static public void Less(float arg1, float arg2, string message) { Assert.Less(arg1, arg2, message, null); } /// /// Verifies that the first value is less than the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater static public void Less(float arg1, float arg2) { Assert.Less(arg1, arg2, string.Empty, null); } #endregion #region IComparables /// /// Verifies that the first value is less than the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void Less(IComparable arg1, IComparable arg2, string message, params object[] args) { Assert.That(arg1, Is.LessThan(arg2), message, args); } /// /// Verifies that the first value is less than the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure static public void Less(IComparable arg1, IComparable arg2, string message) { Assert.Less(arg1, arg2, message, null); } /// /// Verifies that the first value is less than the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater static public void Less(IComparable arg1, IComparable arg2) { Assert.Less(arg1, arg2, string.Empty, null); } #endregion #endregion #region Collection Containment /// /// Asserts that an object is contained in a list. /// /// The expected object /// The list to be examined /// The message to display in case of failure /// Arguments used in formatting the message static public void Contains( object expected, ICollection actual, string message, params object[] args ) { Assert.That(actual, new CollectionContainsConstraint(expected), message, args); } /// /// Asserts that an object is contained in a list. /// /// The expected object /// The list to be examined /// The message to display in case of failure static public void Contains( object expected, ICollection actual, string message ) { Contains( expected, actual, message, null ); } /// /// Asserts that an object is contained in a list. /// /// The expected object /// The list to be examined static public void Contains( object expected, ICollection actual ) { Contains( expected, actual, string.Empty, null ); } #endregion #region Fail /// /// Throws an with the message and arguments /// that are passed in. This is used by the other Assert functions. /// /// The message to initialize the with. /// Arguments to be used in formatting the message static public void Fail(string message, params object[] args ) { if (message == null) message = string.Empty; else if ( args != null && args.Length > 0 ) message = string.Format( message, args ); throw new AssertionException(message); } /// /// Throws an with the message that is /// passed in. This is used by the other Assert functions. /// /// The message to initialize the with. static public void Fail(string message) { Assert.Fail(message, null); } /// /// Throws an . /// This is used by the other Assert functions. /// static public void Fail() { Assert.Fail(string.Empty, null); } #endregion #region Ignore /// /// Throws an with the message and arguments /// that are passed in. This causes the test to be reported as ignored. /// /// The message to initialize the with. /// Arguments to be used in formatting the message static public void Ignore( string message, params object[] args ) { if (message == null) message = string.Empty; else if ( args != null && args.Length > 0 ) message = string.Format( message, args ); throw new IgnoreException(message); } /// /// Throws an with the message that is /// passed in. This causes the test to be reported as ignored. /// /// The message to initialize the with. static public void Ignore( string message ) { Assert.Ignore( message, null ); } /// /// Throws an . /// This causes the test to be reported as ignored. /// static public void Ignore() { Assert.Ignore( string.Empty, null ); } #endregion #region DoAssert /// /// NOTE: The use of asserters for extending NUnit has /// now been replaced by the use of constraints. This /// method is marked obsolete. /// /// Test the condition asserted by an asserter and throw /// an assertion exception using provided message on failure. /// /// An object that implements IAsserter [Obsolete("Use Constraints rather than Asserters for new work")] static public void DoAssert( IAsserter asserter ) { Assert.IncrementAssertCount(); if ( !asserter.Test() ) throw new AssertionException( asserter.Message ); } #endregion #region That /// /// Apply a constraint to an actual value, succeeding if the constraint /// is satisfied and throwing an assertion exception on failure. /// /// A Constraint to be applied /// The actual value to test static public void That( object actual, Constraint constraint ) { Assert.That( actual, constraint, null, null ); } /// /// Apply a constraint to an actual value, succeedingt if the constraint /// is satisfied and throwing an assertion exception on failure. /// /// A Constraint to be applied /// The actual value to test /// The message that will be displayed on failure static public void That( object actual, Constraint constraint, string message ) { Assert.That( actual, constraint, message, null ); } /// /// Apply a constraint to an actual value, succeedingt if the constraint /// is satisfied and throwing an assertion exception on failure. /// /// A Constraint to be applied /// The actual value to test /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void That( object actual, Constraint constraint, string message, params object[] args ) { Assert.IncrementAssertCount(); if ( !constraint.Matches( actual ) ) { MessageWriter writer = new TextMessageWriter( message, args ); constraint.WriteMessageTo( writer ); throw new AssertionException( writer.ToString() ); } } /// /// Asserts that a condition is true. If the condition is false the method throws /// an . /// /// The evaluated condition /// The message to display if the condition is false /// Arguments to be used in formatting the message static public void That(bool condition, string message, params object[] args) { Assert.That(condition, Is.True, message, args); } /// /// Asserts that a condition is true. If the condition is false the method throws /// an . /// /// The evaluated condition /// The message to display if the condition is false static public void That(bool condition, string message) { Assert.That(condition, Is.True, message, null); } /// /// Asserts that a condition is true. If the condition is false the method throws /// an . /// /// The evaluated condition static public void That(bool condition) { Assert.That(condition, Is.True, null, null); } #endregion #region GreaterOrEqual #region Ints /// /// Verifies that the first value is greater than or equal to the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void GreaterOrEqual(int arg1, int arg2, string message, params object[] args) { Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args); } /// /// Verifies that the first value is greater than or equal to the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure static public void GreaterOrEqual(int arg1, int arg2, string message) { Assert.GreaterOrEqual(arg1, arg2, message, null); } /// /// Verifies that the first value is greater than or equal to the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less static public void GreaterOrEqual(int arg1, int arg2) { Assert.GreaterOrEqual(arg1, arg2, string.Empty, null); } #endregion #region UInts /// /// Verifies that the first value is greater than or equal to the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure /// Arguments to be used in formatting the message [CLSCompliant(false)] static public void GreaterOrEqual(uint arg1, uint arg2, string message, params object[] args) { Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args); } /// /// Verifies that the first value is greater than or equal to the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure [CLSCompliant(false)] static public void GreaterOrEqual(uint arg1, uint arg2, string message) { Assert.GreaterOrEqual(arg1, arg2, message, null); } /// /// Verifies that the first value is greater or equal to than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less [CLSCompliant(false)] static public void GreaterOrEqual(uint arg1, uint arg2) { Assert.GreaterOrEqual(arg1, arg2, string.Empty, null); } #endregion #region Longs /// /// Verifies that the first value is greater than or equal to the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void GreaterOrEqual(long arg1, long arg2, string message, params object[] args) { Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args); } /// /// Verifies that the first value is greater than or equal to the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure static public void GreaterOrEqual(long arg1, long arg2, string message) { Assert.GreaterOrEqual(arg1, arg2, message, null); } /// /// Verifies that the first value is greater or equal to than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less static public void GreaterOrEqual(long arg1, long arg2) { Assert.GreaterOrEqual(arg1, arg2, string.Empty, null); } #endregion #region ULongs /// /// Verifies that the first value is greater than or equal to the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure /// Arguments to be used in formatting the message [CLSCompliant(false)] static public void GreaterOrEqual(ulong arg1, ulong arg2, string message, params object[] args) { Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args); } /// /// Verifies that the first value is greater than or equal to the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure [CLSCompliant(false)] static public void GreaterOrEqual(ulong arg1, ulong arg2, string message) { Assert.GreaterOrEqual(arg1, arg2, message, null); } /// /// Verifies that the first value is greater or equal to than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less [CLSCompliant(false)] static public void GreaterOrEqual(ulong arg1, ulong arg2) { Assert.GreaterOrEqual(arg1, arg2, string.Empty, null); } #endregion #region Decimals /// /// Verifies that the first value is greater than or equal to the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void GreaterOrEqual(decimal arg1, decimal arg2, string message, params object[] args) { Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args); } /// /// Verifies that the first value is greater than or equal to the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure static public void GreaterOrEqual(decimal arg1, decimal arg2, string message) { Assert.GreaterOrEqual(arg1, arg2, message, null); } /// /// Verifies that the first value is greater than or equal to the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less static public void GreaterOrEqual(decimal arg1, decimal arg2) { Assert.GreaterOrEqual(arg1, arg2, string.Empty, null); } #endregion #region Doubles /// /// Verifies that the first value is greater than or equal to the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void GreaterOrEqual(double arg1, double arg2, string message, params object[] args) { Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args); } /// /// Verifies that the first value is greater than or equal to the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure static public void GreaterOrEqual(double arg1, double arg2, string message) { Assert.GreaterOrEqual(arg1, arg2, message, null); } /// /// Verifies that the first value is greater than or equal to the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less static public void GreaterOrEqual(double arg1, double arg2) { Assert.GreaterOrEqual(arg1, arg2, string.Empty, null); } #endregion #region Floats /// /// Verifies that the first value is greater than or equal to the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void GreaterOrEqual(float arg1, float arg2, string message, params object[] args) { Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args); } /// /// Verifies that the first value is greater than or equal to the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure static public void GreaterOrEqual(float arg1, float arg2, string message) { Assert.GreaterOrEqual(arg1, arg2, message, null); } /// /// Verifies that the first value is greater than or equal to the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less static public void GreaterOrEqual(float arg1, float arg2) { Assert.GreaterOrEqual(arg1, arg2, string.Empty, null); } #endregion #region IComparables /// /// Verifies that the first value is greater than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void GreaterOrEqual(IComparable arg1, IComparable arg2, string message, params object[] args) { Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args); } /// /// Verifies that the first value is greater than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less /// The message that will be displayed on failure static public void GreaterOrEqual(IComparable arg1, IComparable arg2, string message) { Assert.GreaterOrEqual(arg1, arg2, message, null); } /// /// Verifies that the first value is greater than the second /// value. If they are not, then an /// is thrown. /// /// The first value, expected to be greater /// The second value, expected to be less static public void GreaterOrEqual(IComparable arg1, IComparable arg2) { Assert.GreaterOrEqual(arg1, arg2, string.Empty, null); } #endregion #endregion #region LessOrEqual #region Ints /// /// Verifies that the first value is less than or equal to the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void LessOrEqual(int arg1, int arg2, string message, params object[] args) { Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args); } /// /// Verifies that the first value is less than or equal to the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure static public void LessOrEqual(int arg1, int arg2, string message) { Assert.LessOrEqual(arg1, arg2, message, null); } /// /// Verifies that the first value is less than or equal to the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater static public void LessOrEqual(int arg1, int arg2) { Assert.LessOrEqual(arg1, arg2, string.Empty, null); } #endregion #region UInts /// /// Verifies that the first value is less than or equal to the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure /// Arguments to be used in formatting the message [CLSCompliant(false)] static public void LessOrEqual(uint arg1, uint arg2, string message, params object[] args) { Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args); } /// /// Verifies that the first value is less than or equal to the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure [CLSCompliant(false)] static public void LessOrEqual(uint arg1, uint arg2, string message) { Assert.LessOrEqual(arg1, arg2, message, null); } /// /// Verifies that the first value is less than or equal to the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater [CLSCompliant(false)] static public void LessOrEqual(uint arg1, uint arg2) { Assert.LessOrEqual(arg1, arg2, string.Empty, null); } #endregion #region Longs /// /// Verifies that the first value is less than or equal to the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void LessOrEqual(long arg1, long arg2, string message, params object[] args) { Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args); } /// /// Verifies that the first value is less than or equal to the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure static public void LessOrEqual(long arg1, long arg2, string message) { Assert.LessOrEqual(arg1, arg2, message, null); } /// /// Verifies that the first value is less than or equal to the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater static public void LessOrEqual(long arg1, long arg2) { Assert.LessOrEqual(arg1, arg2, string.Empty, null); } #endregion #region ULongs /// /// Verifies that the first value is less than or equal to the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure /// Arguments to be used in formatting the message [CLSCompliant(false)] static public void LessOrEqual(ulong arg1, ulong arg2, string message, params object[] args) { Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args); } /// /// Verifies that the first value is less than or equal to the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure [CLSCompliant(false)] static public void LessOrEqual(ulong arg1, ulong arg2, string message) { Assert.LessOrEqual(arg1, arg2, message, null); } /// /// Verifies that the first value is less than or equal to the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater [CLSCompliant(false)] static public void LessOrEqual(ulong arg1, ulong arg2) { Assert.LessOrEqual(arg1, arg2, string.Empty, null); } #endregion #region Decimals /// /// Verifies that the first value is less than or equal to the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void LessOrEqual(decimal arg1, decimal arg2, string message, params object[] args) { Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args); } /// /// Verifies that the first value is less than or equal to the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure static public void LessOrEqual(decimal arg1, decimal arg2, string message) { Assert.LessOrEqual(arg1, arg2, message, null); } /// /// Verifies that the first value is less than or equal to the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater static public void LessOrEqual(decimal arg1, decimal arg2) { Assert.LessOrEqual(arg1, arg2, string.Empty, null); } #endregion #region Doubles /// /// Verifies that the first value is less than or equal to the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void LessOrEqual(double arg1, double arg2, string message, params object[] args) { Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args); } /// /// Verifies that the first value is less than or equal to the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure static public void LessOrEqual(double arg1, double arg2, string message) { Assert.LessOrEqual(arg1, arg2, message, null); } /// /// Verifies that the first value is less than or equal to the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater static public void LessOrEqual(double arg1, double arg2) { Assert.LessOrEqual(arg1, arg2, string.Empty, null); } #endregion #region Floats /// /// Verifies that the first value is less than or equal to the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void LessOrEqual(float arg1, float arg2, string message, params object[] args) { Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args); } /// /// Verifies that the first value is less than or equal to the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure static public void LessOrEqual(float arg1, float arg2, string message) { Assert.LessOrEqual(arg1, arg2, message, null); } /// /// Verifies that the first value is less than or equal to the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater static public void LessOrEqual(float arg1, float arg2) { Assert.LessOrEqual(arg1, arg2, string.Empty, null); } #endregion #region IComparables /// /// Verifies that the first value is less than or equal to the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure /// Arguments to be used in formatting the message static public void LessOrEqual(IComparable arg1, IComparable arg2, string message, params object[] args) { Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args); } /// /// Verifies that the first value is less than or equal to the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater /// The message that will be displayed on failure static public void LessOrEqual(IComparable arg1, IComparable arg2, string message) { Assert.LessOrEqual(arg1, arg2, message, null); } /// /// Verifies that the first value is less than or equal to the second /// value. If it is not, then an /// is thrown. /// /// The first value, expected to be less /// The second value, expected to be greater static public void LessOrEqual(IComparable arg1, IComparable arg2) { Assert.LessOrEqual(arg1, arg2, string.Empty, null); } #endregion #endregion } }