Class Assert
The Assert class contains a collection of static methods that implement the most common assertions used in NUnit.
public class Assert
- Inheritance
-
Assert
- Inherited Members
Constructors
Assert()
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()
Methods
AreEqual(decimal, decimal)
Verifies that two decimals are equal. If they are not, then an AssertionException is thrown.
public static void AreEqual(decimal expected, decimal actual)
Parameters
AreEqual(decimal, decimal, string)
Verifies that two decimals are equal. If they are not, then an AssertionException is thrown.
public static void AreEqual(decimal expected, decimal actual, string message)
Parameters
expecteddecimalThe expected value
actualdecimalThe actual value
messagestringThe message to display in case of failure
AreEqual(decimal, decimal, string, params object[])
Verifies that two decimals are equal. If they are not, then an AssertionException is thrown.
public static void AreEqual(decimal expected, decimal actual, string message, params object[] args)
Parameters
expecteddecimalThe expected value
actualdecimalThe actual value
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
AreEqual(double, double, double)
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 equal then an AssertionException is thrown.
public static void AreEqual(double expected, double actual, double delta)
Parameters
expecteddoubleThe expected value
actualdoubleThe actual value
deltadoubleThe maximum acceptable difference between the the expected and the actual
AreEqual(double, double, double, string)
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 equal then an AssertionException is thrown.
public static void AreEqual(double expected, double actual, double delta, string message)
Parameters
expecteddoubleThe expected value
actualdoubleThe actual value
deltadoubleThe maximum acceptable difference between the the expected and the actual
messagestringThe message to display in case of failure
AreEqual(double, double, double, string, params object[])
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 equal then an AssertionException is thrown.
public static void AreEqual(double expected, double actual, double delta, string message, params object[] args)
Parameters
expecteddoubleThe expected value
actualdoubleThe actual value
deltadoubleThe maximum acceptable difference between the the expected and the actual
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
AreEqual(double, double?, double)
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 equal then an AssertionException is thrown.
public static void AreEqual(double expected, double? actual, double delta)
Parameters
expecteddoubleThe expected value
actualdouble?The actual value
deltadoubleThe maximum acceptable difference between the the expected and the actual
AreEqual(double, double?, double, string)
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 equal then an AssertionException is thrown.
public static void AreEqual(double expected, double? actual, double delta, string message)
Parameters
expecteddoubleThe expected value
actualdouble?The actual value
deltadoubleThe maximum acceptable difference between the the expected and the actual
messagestringThe message to display in case of failure
AreEqual(double, double?, double, string, params object[])
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 equal then an AssertionException is thrown.
public static void AreEqual(double expected, double? actual, double delta, string message, params object[] args)
Parameters
expecteddoubleThe expected value
actualdouble?The actual value
deltadoubleThe maximum acceptable difference between the the expected and the actual
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
AreEqual(int, int)
Verifies that two ints are equal. If they are not, then an AssertionException is thrown.
public static void AreEqual(int expected, int actual)
Parameters
AreEqual(int, int, string)
Verifies that two ints are equal. If they are not, then an AssertionException is thrown.
public static void AreEqual(int expected, int actual, string message)
Parameters
expectedintThe expected value
actualintThe actual value
messagestringThe message to display in case of failure
AreEqual(int, int, string, params object[])
Verifies that two ints are equal. If they are not, then an AssertionException is thrown.
public static void AreEqual(int expected, int actual, string message, params object[] args)
Parameters
expectedintThe expected value
actualintThe actual value
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
AreEqual(long, long)
Verifies that two longs are equal. If they are not, then an AssertionException is thrown.
public static void AreEqual(long expected, long actual)
Parameters
AreEqual(long, long, string)
Verifies that two longs are equal. If they are not, then an AssertionException is thrown.
public static void AreEqual(long expected, long actual, string message)
Parameters
expectedlongThe expected value
actuallongThe actual value
messagestringThe message to display in case of failure
AreEqual(long, long, string, params object[])
Verifies that two longs are equal. If they are not, then an AssertionException is thrown.
public static void AreEqual(long expected, long actual, string message, params object[] args)
Parameters
expectedlongThe expected value
actuallongThe actual value
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
AreEqual(object, object)
Verifies that two objects are equal. Two objects are considered equal if both are null, or if both have the same value. NUnit has special semantics for some object types. If they are not equal an AssertionException is thrown.
public static void AreEqual(object expected, object actual)
Parameters
AreEqual(object, object, string)
Verifies that two objects are equal. Two objects are considered equal if both are null, or if both have the same value. NUnit has special semantics for some object types. If they are not equal an AssertionException is thrown.
public static void AreEqual(object expected, object actual, string message)
Parameters
expectedobjectThe value that is expected
actualobjectThe actual value
messagestringThe message to display in case of failure
AreEqual(object, object, string, params object[])
Verifies that two objects are equal. Two objects are considered equal if both are null, or if both have the same value. NUnit has special semantics for some object types. If they are not equal an AssertionException is thrown.
public static void AreEqual(object expected, object actual, string message, params object[] args)
Parameters
expectedobjectThe value that is expected
actualobjectThe actual value
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
AreEqual(uint, uint)
Verifies that two unsigned ints are equal. If they are not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void AreEqual(uint expected, uint actual)
Parameters
AreEqual(uint, uint, string)
Verifies that two unsigned ints are equal. If they are not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void AreEqual(uint expected, uint actual, string message)
Parameters
expecteduintThe expected value
actualuintThe actual value
messagestringThe message to display in case of failure
AreEqual(uint, uint, string, params object[])
Verifies that two unsigned ints are equal. If they are not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void AreEqual(uint expected, uint actual, string message, params object[] args)
Parameters
expecteduintThe expected value
actualuintThe actual value
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
AreEqual(ulong, ulong)
Verifies that two unsigned longs are equal. If they are not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void AreEqual(ulong expected, ulong actual)
Parameters
AreEqual(ulong, ulong, string)
Verifies that two unsigned longs are equal. If they are not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void AreEqual(ulong expected, ulong actual, string message)
Parameters
expectedulongThe expected value
actualulongThe actual value
messagestringThe message to display in case of failure
AreEqual(ulong, ulong, string, params object[])
Verifies that two unsigned longs are equal. If they are not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void AreEqual(ulong expected, ulong actual, string message, params object[] args)
Parameters
expectedulongThe expected value
actualulongThe actual value
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
AreNotEqual(decimal, decimal)
Verifies that two decimals are not equal. If they are equal, then an AssertionException is thrown.
public static void AreNotEqual(decimal expected, decimal actual)
Parameters
AreNotEqual(decimal, decimal, string)
Verifies that two decimals are not equal. If they are equal, then an AssertionException is thrown.
public static void AreNotEqual(decimal expected, decimal actual, string message)
Parameters
expecteddecimalThe expected value
actualdecimalThe actual value
messagestringThe message to display in case of failure
AreNotEqual(decimal, decimal, string, params object[])
Verifies that two decimals are not equal. If they are equal, then an AssertionException is thrown.
public static void AreNotEqual(decimal expected, decimal actual, string message, params object[] args)
Parameters
expecteddecimalThe expected value
actualdecimalThe actual value
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
AreNotEqual(double, double)
Verifies that two doubles are not equal. If they are equal, then an AssertionException is thrown.
public static void AreNotEqual(double expected, double actual)
Parameters
AreNotEqual(double, double, string)
Verifies that two doubles are not equal. If they are equal, then an AssertionException is thrown.
public static void AreNotEqual(double expected, double actual, string message)
Parameters
expecteddoubleThe expected value
actualdoubleThe actual value
messagestringThe message to display in case of failure
AreNotEqual(double, double, string, params object[])
Verifies that two doubles are not equal. If they are equal, then an AssertionException is thrown.
public static void AreNotEqual(double expected, double actual, string message, params object[] args)
Parameters
expecteddoubleThe expected value
actualdoubleThe actual value
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
AreNotEqual(int, int)
Verifies that two ints are not equal. If they are equal, then an AssertionException is thrown.
public static void AreNotEqual(int expected, int actual)
Parameters
AreNotEqual(int, int, string)
Verifies that two ints are not equal. If they are equal, then an AssertionException is thrown.
public static void AreNotEqual(int expected, int actual, string message)
Parameters
expectedintThe expected value
actualintThe actual value
messagestringThe message to display in case of failure
AreNotEqual(int, int, string, params object[])
Verifies that two ints are not equal. If they are equal, then an AssertionException is thrown.
public static void AreNotEqual(int expected, int actual, string message, params object[] args)
Parameters
expectedintThe expected value
actualintThe actual value
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
AreNotEqual(long, long)
Verifies that two longs are not equal. If they are equal, then an AssertionException is thrown.
public static void AreNotEqual(long expected, long actual)
Parameters
AreNotEqual(long, long, string)
Verifies that two longs are not equal. If they are equal, then an AssertionException is thrown.
public static void AreNotEqual(long expected, long actual, string message)
Parameters
expectedlongThe expected value
actuallongThe actual value
messagestringThe message to display in case of failure
AreNotEqual(long, long, string, params object[])
Verifies that two longs are not equal. If they are equal, then an AssertionException is thrown.
public static void AreNotEqual(long expected, long actual, string message, params object[] args)
Parameters
expectedlongThe expected value
actuallongThe actual value
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
AreNotEqual(object, object)
Verifies that two objects are not equal. Two objects are considered equal if both are null, or if both have the same value. NUnit has special semantics for some object types. If they are equal an AssertionException is thrown.
public static void AreNotEqual(object expected, object actual)
Parameters
AreNotEqual(object, object, string)
Verifies that two objects are not equal. Two objects are considered equal if both are null, or if both have the same value. NUnit has special semantics for some object types. If they are equal an AssertionException is thrown.
public static void AreNotEqual(object expected, object actual, string message)
Parameters
expectedobjectThe value that is expected
actualobjectThe actual value
messagestringThe message to display in case of failure
AreNotEqual(object, object, string, params object[])
Verifies that two objects are not equal. Two objects are considered equal if both are null, or if both have the same value. NUnit has special semantics for some object types. If they are equal an AssertionException is thrown.
public static void AreNotEqual(object expected, object actual, string message, params object[] args)
Parameters
expectedobjectThe value that is expected
actualobjectThe actual value
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
AreNotEqual(float, float)
Verifies that two floats are not equal. If they are equal, then an AssertionException is thrown.
public static void AreNotEqual(float expected, float actual)
Parameters
AreNotEqual(float, float, string)
Verifies that two floats are not equal. If they are equal, then an AssertionException is thrown.
public static void AreNotEqual(float expected, float actual, string message)
Parameters
expectedfloatThe expected value
actualfloatThe actual value
messagestringThe message to display in case of failure
AreNotEqual(float, float, string, params object[])
Verifies that two floats are not equal. If they are equal, then an AssertionException is thrown.
public static void AreNotEqual(float expected, float actual, string message, params object[] args)
Parameters
expectedfloatThe expected value
actualfloatThe actual value
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
AreNotEqual(uint, uint)
Verifies that two unsigned ints are not equal. If they are equal, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void AreNotEqual(uint expected, uint actual)
Parameters
AreNotEqual(uint, uint, string)
Verifies that two unsigned ints are not equal. If they are equal, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void AreNotEqual(uint expected, uint actual, string message)
Parameters
expecteduintThe expected value
actualuintThe actual value
messagestringThe message to display in case of failure
AreNotEqual(uint, uint, string, params object[])
Verifies that two unsigned ints are not equal. If they are equal, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void AreNotEqual(uint expected, uint actual, string message, params object[] args)
Parameters
expecteduintThe expected value
actualuintThe actual value
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
AreNotEqual(ulong, ulong)
Verifies that two unsigned longs are not equal. If they are equal, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void AreNotEqual(ulong expected, ulong actual)
Parameters
AreNotEqual(ulong, ulong, string)
Verifies that two unsigned longs are not equal. If they are equal, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void AreNotEqual(ulong expected, ulong actual, string message)
Parameters
expectedulongThe expected value
actualulongThe actual value
messagestringThe message to display in case of failure
AreNotEqual(ulong, ulong, string, params object[])
Verifies that two unsigned longs are not equal. If they are equal, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void AreNotEqual(ulong expected, ulong actual, string message, params object[] args)
Parameters
expectedulongThe expected value
actualulongThe actual value
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
AreNotSame(object, object)
Asserts that two objects do not refer to the same object. If they are the same an AssertionException is thrown.
public static void AreNotSame(object expected, object actual)
Parameters
AreNotSame(object, object, string)
Asserts that two objects do not refer to the same object. If they are the same an AssertionException is thrown.
public static void AreNotSame(object expected, object actual, string message)
Parameters
expectedobjectThe expected object
actualobjectThe actual object
messagestringThe message to display in case of failure
AreNotSame(object, object, string, params object[])
Asserts that two objects do not refer to the same object. If they are the same an AssertionException is thrown.
public static void AreNotSame(object expected, object actual, string message, params object[] args)
Parameters
expectedobjectThe expected object
actualobjectThe actual object
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
AreSame(object, object)
Asserts that two objects refer to the same object. If they are not the same an AssertionException is thrown.
public static void AreSame(object expected, object actual)
Parameters
AreSame(object, object, string)
Asserts that two objects refer to the same object. If they are not the same an AssertionException is thrown.
public static void AreSame(object expected, object actual, string message)
Parameters
expectedobjectThe expected object
actualobjectThe actual object
messagestringThe message to display in case of failure
AreSame(object, object, string, params object[])
Asserts that two objects refer to the same object. If they are not the same an AssertionException is thrown.
public static void AreSame(object expected, object actual, string message, params object[] args)
Parameters
expectedobjectThe expected object
actualobjectThe actual object
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
AssertDoublesAreEqual(double, double, double, string, object[])
Helper for Assert.AreEqual(double expected, double actual, ...) allowing code generation to work consistently.
protected static void AssertDoublesAreEqual(double expected, double actual, double delta, string message, object[] args)
Parameters
expecteddoubleThe expected value
actualdoubleThe actual value
deltadoubleThe maximum acceptable difference between the the expected and the actual
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
ByVal(object, IResolveConstraint)
Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an assertion exception on failure. Used as a synonym for That in rare cases where a private setter causes a Visual Basic compilation error.
public static void ByVal(object actual, IResolveConstraint expression)
Parameters
actualobjectThe actual value to test
expressionIResolveConstraintA Constraint to be applied
ByVal(object, IResolveConstraint, string)
Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an assertion exception on failure. Used as a synonym for That in rare cases where a private setter causes a Visual Basic compilation error.
public static void ByVal(object actual, IResolveConstraint expression, string message)
Parameters
actualobjectThe actual value to test
expressionIResolveConstraintA Constraint to be applied
messagestringThe message that will be displayed on failure
ByVal(object, IResolveConstraint, string, params object[])
Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an assertion exception on failure. Used as a synonym for That in rare cases where a private setter causes a Visual Basic compilation error.
public static void ByVal(object actual, IResolveConstraint expression, string message, params object[] args)
Parameters
actualobjectThe actual value to test
expressionIResolveConstraintA Constraint expression to be applied
messagestringThe message that will be displayed on failure
argsobject[]Arguments to be used in formatting the message
Remarks
This method is provided for use by VB developers needing to test the value of properties with private setters.
Catch(TestDelegate)
Verifies that a delegate throws an exception when called and returns it.
public static Exception Catch(TestDelegate code)
Parameters
codeTestDelegateA TestDelegate
Returns
Catch(TestDelegate, string)
Verifies that a delegate throws an exception when called and returns it.
public static Exception Catch(TestDelegate code, string message)
Parameters
codeTestDelegateA TestDelegate
messagestringThe message that will be displayed on failure
Returns
Catch(TestDelegate, string, params object[])
Verifies that a delegate throws an exception when called and returns it.
public static Exception Catch(TestDelegate code, string message, params object[] args)
Parameters
codeTestDelegateA TestDelegate
messagestringThe message that will be displayed on failure
argsobject[]Arguments to be used in formatting the message
Returns
Catch(Type, TestDelegate)
Verifies that a delegate throws an exception of a certain Type or one derived from it when called and returns it.
public static Exception Catch(Type expectedExceptionType, TestDelegate code)
Parameters
expectedExceptionTypeTypeThe expected Exception Type
codeTestDelegateA TestDelegate
Returns
Catch(Type, TestDelegate, string)
Verifies that a delegate throws an exception of a certain Type or one derived from it when called and returns it.
public static Exception Catch(Type expectedExceptionType, TestDelegate code, string message)
Parameters
expectedExceptionTypeTypeThe expected Exception Type
codeTestDelegateA TestDelegate
messagestringThe message that will be displayed on failure
Returns
Catch(Type, TestDelegate, string, params object[])
Verifies that a delegate throws an exception of a certain Type or one derived from it when called and returns it.
public static Exception Catch(Type expectedExceptionType, TestDelegate code, string message, params object[] args)
Parameters
expectedExceptionTypeTypeThe expected Exception Type
codeTestDelegateA TestDelegate
messagestringThe message that will be displayed on failure
argsobject[]Arguments to be used in formatting the message
Returns
Catch<TActual>(TestDelegate)
Verifies that a delegate throws an exception of a certain Type or one derived from it when called and returns it.
public static TActual Catch<TActual>(TestDelegate code) where TActual : Exception
Parameters
codeTestDelegateA TestDelegate
Returns
- TActual
Type Parameters
TActual
Catch<TActual>(TestDelegate, string)
Verifies that a delegate throws an exception of a certain Type or one derived from it when called and returns it.
public static TActual Catch<TActual>(TestDelegate code, string message) where TActual : Exception
Parameters
codeTestDelegateA TestDelegate
messagestringThe message that will be displayed on failure
Returns
- TActual
Type Parameters
TActual
Catch<TActual>(TestDelegate, string, params object[])
Verifies that a delegate throws an exception of a certain Type or one derived from it when called and returns it.
public static TActual Catch<TActual>(TestDelegate code, string message, params object[] args) where TActual : Exception
Parameters
codeTestDelegateA TestDelegate
messagestringThe message that will be displayed on failure
argsobject[]Arguments to be used in formatting the message
Returns
- TActual
Type Parameters
TActual
Contains(object, ICollection)
Asserts that an object is contained in a list.
public static void Contains(object expected, ICollection actual)
Parameters
expectedobjectThe expected object
actualICollectionThe list to be examined
Contains(object, ICollection, string)
Asserts that an object is contained in a list.
public static void Contains(object expected, ICollection actual, string message)
Parameters
expectedobjectThe expected object
actualICollectionThe list to be examined
messagestringThe message to display in case of failure
Contains(object, ICollection, string, params object[])
Asserts that an object is contained in a list.
public static void Contains(object expected, ICollection actual, string message, params object[] args)
Parameters
expectedobjectThe expected object
actualICollectionThe list to be examined
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
DoesNotThrow(TestDelegate)
Verifies that a delegate does not throw an exception.
public static void DoesNotThrow(TestDelegate code)
Parameters
codeTestDelegateA TestDelegate
DoesNotThrow(TestDelegate, string)
Verifies that a delegate does not throw an exception.
public static void DoesNotThrow(TestDelegate code, string message)
Parameters
codeTestDelegateA TestDelegate
messagestringThe message that will be displayed on failure
DoesNotThrow(TestDelegate, string, params object[])
Verifies that a delegate does not throw an exception
public static void DoesNotThrow(TestDelegate code, string message, params object[] args)
Parameters
codeTestDelegateA TestDelegate
messagestringThe message that will be displayed on failure
argsobject[]Arguments to be used in formatting the message
Fail()
Throws an AssertionException. This is used by the other Assert functions.
public static void Fail()
Fail(string)
Throws an AssertionException with the message that is passed in. This is used by the other Assert functions.
public static void Fail(string message)
Parameters
messagestringThe message to initialize the AssertionException with.
Fail(string, params object[])
Throws an AssertionException with the message and arguments that are passed in. This is used by the other Assert functions.
public static void Fail(string message, params object[] args)
Parameters
messagestringThe message to initialize the AssertionException with.
argsobject[]Arguments to be used in formatting the message
False(bool)
Asserts that a condition is false. If the condition is true the method throws an AssertionException.
public static void False(bool condition)
Parameters
conditionboolThe evaluated condition
False(bool, string)
Asserts that a condition is false. If the condition is true the method throws an AssertionException.
public static void False(bool condition, string message)
Parameters
False(bool, string, params object[])
Asserts that a condition is false. If the condition is true the method throws an AssertionException.
public static void False(bool condition, string message, params object[] args)
Parameters
conditionboolThe evaluated condition
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
Greater(decimal, decimal)
Verifies that the first value is greater than the second value. If it is not, then an AssertionException is thrown.
public static void Greater(decimal arg1, decimal arg2)
Parameters
arg1decimalThe first value, expected to be greater
arg2decimalThe second value, expected to be less
Greater(decimal, decimal, string)
Verifies that the first value is greater than the second value. If it is not, then an AssertionException is thrown.
public static void Greater(decimal arg1, decimal arg2, string message)
Parameters
arg1decimalThe first value, expected to be greater
arg2decimalThe second value, expected to be less
messagestringThe message to display in case of failure
Greater(decimal, decimal, string, params object[])
Verifies that the first value is greater than the second value. If it is not, then an AssertionException is thrown.
public static void Greater(decimal arg1, decimal arg2, string message, params object[] args)
Parameters
arg1decimalThe first value, expected to be greater
arg2decimalThe second value, expected to be less
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
Greater(double, double)
Verifies that the first value is greater than the second value. If it is not, then an AssertionException is thrown.
public static void Greater(double arg1, double arg2)
Parameters
arg1doubleThe first value, expected to be greater
arg2doubleThe second value, expected to be less
Greater(double, double, string)
Verifies that the first value is greater than the second value. If it is not, then an AssertionException is thrown.
public static void Greater(double arg1, double arg2, string message)
Parameters
arg1doubleThe first value, expected to be greater
arg2doubleThe second value, expected to be less
messagestringThe message to display in case of failure
Greater(double, double, string, params object[])
Verifies that the first value is greater than the second value. If it is not, then an AssertionException is thrown.
public static void Greater(double arg1, double arg2, string message, params object[] args)
Parameters
arg1doubleThe first value, expected to be greater
arg2doubleThe second value, expected to be less
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
Greater(IComparable, IComparable)
Verifies that the first value is greater than the second value. If it is not, then an AssertionException is thrown.
public static void Greater(IComparable arg1, IComparable arg2)
Parameters
arg1IComparableThe first value, expected to be greater
arg2IComparableThe second value, expected to be less
Greater(IComparable, IComparable, string)
Verifies that the first value is greater than the second value. If it is not, then an AssertionException is thrown.
public static void Greater(IComparable arg1, IComparable arg2, string message)
Parameters
arg1IComparableThe first value, expected to be greater
arg2IComparableThe second value, expected to be less
messagestringThe message to display in case of failure
Greater(IComparable, IComparable, string, params object[])
Verifies that the first value is greater than the second value. If it is not, then an AssertionException is thrown.
public static void Greater(IComparable arg1, IComparable arg2, string message, params object[] args)
Parameters
arg1IComparableThe first value, expected to be greater
arg2IComparableThe second value, expected to be less
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
Greater(int, int)
Verifies that the first int is greater than the second int. If it is not, then an AssertionException is thrown.
public static void Greater(int arg1, int arg2)
Parameters
Greater(int, int, string)
Verifies that the first int is greater than the second int. If it is not, then an AssertionException is thrown.
public static void Greater(int arg1, int arg2, string message)
Parameters
arg1intThe first value, expected to be greater
arg2intThe second value, expected to be less
messagestringThe message to display in case of failure
Greater(int, int, string, params object[])
Verifies that the first int is greater than the second int. If it is not, then an AssertionException is thrown.
public static void Greater(int arg1, int arg2, string message, params object[] args)
Parameters
arg1intThe first value, expected to be greater
arg2intThe second value, expected to be less
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
Greater(long, long)
Verifies that the first value is greater than the second value. If it is not, then an AssertionException is thrown.
public static void Greater(long arg1, long arg2)
Parameters
Greater(long, long, string)
Verifies that the first value is greater than the second value. If it is not, then an AssertionException is thrown.
public static void Greater(long arg1, long arg2, string message)
Parameters
arg1longThe first value, expected to be greater
arg2longThe second value, expected to be less
messagestringThe message to display in case of failure
Greater(long, long, string, params object[])
Verifies that the first value is greater than the second value. If it is not, then an AssertionException is thrown.
public static void Greater(long arg1, long arg2, string message, params object[] args)
Parameters
arg1longThe first value, expected to be greater
arg2longThe second value, expected to be less
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
Greater(float, float)
Verifies that the first value is greater than the second value. If it is not, then an AssertionException is thrown.
public static void Greater(float arg1, float arg2)
Parameters
Greater(float, float, string)
Verifies that the first value is greater than the second value. If it is not, then an AssertionException is thrown.
public static void Greater(float arg1, float arg2, string message)
Parameters
arg1floatThe first value, expected to be greater
arg2floatThe second value, expected to be less
messagestringThe message to display in case of failure
Greater(float, float, string, params object[])
Verifies that the first value is greater than the second value. If it is not, then an AssertionException is thrown.
public static void Greater(float arg1, float arg2, string message, params object[] args)
Parameters
arg1floatThe first value, expected to be greater
arg2floatThe second value, expected to be less
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
Greater(uint, uint)
Verifies that the first value is greater than the second value. If it is not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void Greater(uint arg1, uint arg2)
Parameters
Greater(uint, uint, string)
Verifies that the first value is greater than the second value. If it is not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void Greater(uint arg1, uint arg2, string message)
Parameters
arg1uintThe first value, expected to be greater
arg2uintThe second value, expected to be less
messagestringThe message to display in case of failure
Greater(uint, uint, string, params object[])
Verifies that the first value is greater than the second value. If it is not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void Greater(uint arg1, uint arg2, string message, params object[] args)
Parameters
arg1uintThe first value, expected to be greater
arg2uintThe second value, expected to be less
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
Greater(ulong, ulong)
Verifies that the first value is greater than the second value. If it is not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void Greater(ulong arg1, ulong arg2)
Parameters
Greater(ulong, ulong, string)
Verifies that the first value is greater than the second value. If it is not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void Greater(ulong arg1, ulong arg2, string message)
Parameters
arg1ulongThe first value, expected to be greater
arg2ulongThe second value, expected to be less
messagestringThe message to display in case of failure
Greater(ulong, ulong, string, params object[])
Verifies that the first value is greater than the second value. If it is not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void Greater(ulong arg1, ulong arg2, string message, params object[] args)
Parameters
arg1ulongThe first value, expected to be greater
arg2ulongThe second value, expected to be less
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
GreaterOrEqual(decimal, decimal)
Verifies that the first value is greater than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void GreaterOrEqual(decimal arg1, decimal arg2)
Parameters
arg1decimalThe first value, expected to be greater
arg2decimalThe second value, expected to be less
GreaterOrEqual(decimal, decimal, string)
Verifies that the first value is greater than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void GreaterOrEqual(decimal arg1, decimal arg2, string message)
Parameters
arg1decimalThe first value, expected to be greater
arg2decimalThe second value, expected to be less
messagestringThe message to display in case of failure
GreaterOrEqual(decimal, decimal, string, params object[])
Verifies that the first value is greater than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void GreaterOrEqual(decimal arg1, decimal arg2, string message, params object[] args)
Parameters
arg1decimalThe first value, expected to be greater
arg2decimalThe second value, expected to be less
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
GreaterOrEqual(double, double)
Verifies that the first value is greater than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void GreaterOrEqual(double arg1, double arg2)
Parameters
arg1doubleThe first value, expected to be greater
arg2doubleThe second value, expected to be less
GreaterOrEqual(double, double, string)
Verifies that the first value is greater than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void GreaterOrEqual(double arg1, double arg2, string message)
Parameters
arg1doubleThe first value, expected to be greater
arg2doubleThe second value, expected to be less
messagestringThe message to display in case of failure
GreaterOrEqual(double, double, string, params object[])
Verifies that the first value is greater than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void GreaterOrEqual(double arg1, double arg2, string message, params object[] args)
Parameters
arg1doubleThe first value, expected to be greater
arg2doubleThe second value, expected to be less
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
GreaterOrEqual(IComparable, IComparable)
Verifies that the first value is greater than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void GreaterOrEqual(IComparable arg1, IComparable arg2)
Parameters
arg1IComparableThe first value, expected to be greater
arg2IComparableThe second value, expected to be less
GreaterOrEqual(IComparable, IComparable, string)
Verifies that the first value is greater than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void GreaterOrEqual(IComparable arg1, IComparable arg2, string message)
Parameters
arg1IComparableThe first value, expected to be greater
arg2IComparableThe second value, expected to be less
messagestringThe message to display in case of failure
GreaterOrEqual(IComparable, IComparable, string, params object[])
Verifies that the first value is greater than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void GreaterOrEqual(IComparable arg1, IComparable arg2, string message, params object[] args)
Parameters
arg1IComparableThe first value, expected to be greater
arg2IComparableThe second value, expected to be less
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
GreaterOrEqual(int, int)
Verifies that the first value is greater than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void GreaterOrEqual(int arg1, int arg2)
Parameters
GreaterOrEqual(int, int, string)
Verifies that the first value is greater than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void GreaterOrEqual(int arg1, int arg2, string message)
Parameters
arg1intThe first value, expected to be greater
arg2intThe second value, expected to be less
messagestringThe message to display in case of failure
GreaterOrEqual(int, int, string, params object[])
Verifies that the first value is greater than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void GreaterOrEqual(int arg1, int arg2, string message, params object[] args)
Parameters
arg1intThe first value, expected to be greater
arg2intThe second value, expected to be less
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
GreaterOrEqual(long, long)
Verifies that the first value is greater than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void GreaterOrEqual(long arg1, long arg2)
Parameters
GreaterOrEqual(long, long, string)
Verifies that the first value is greater than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void GreaterOrEqual(long arg1, long arg2, string message)
Parameters
arg1longThe first value, expected to be greater
arg2longThe second value, expected to be less
messagestringThe message to display in case of failure
GreaterOrEqual(long, long, string, params object[])
Verifies that the first value is greater than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void GreaterOrEqual(long arg1, long arg2, string message, params object[] args)
Parameters
arg1longThe first value, expected to be greater
arg2longThe second value, expected to be less
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
GreaterOrEqual(float, float)
Verifies that the first value is greater than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void GreaterOrEqual(float arg1, float arg2)
Parameters
GreaterOrEqual(float, float, string)
Verifies that the first value is greater than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void GreaterOrEqual(float arg1, float arg2, string message)
Parameters
arg1floatThe first value, expected to be greater
arg2floatThe second value, expected to be less
messagestringThe message to display in case of failure
GreaterOrEqual(float, float, string, params object[])
Verifies that the first value is greater than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void GreaterOrEqual(float arg1, float arg2, string message, params object[] args)
Parameters
arg1floatThe first value, expected to be greater
arg2floatThe second value, expected to be less
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
GreaterOrEqual(uint, uint)
Verifies that the first value is greater than or equal to the second value. If it is not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void GreaterOrEqual(uint arg1, uint arg2)
Parameters
GreaterOrEqual(uint, uint, string)
Verifies that the first value is greater than or equal to the second value. If it is not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void GreaterOrEqual(uint arg1, uint arg2, string message)
Parameters
arg1uintThe first value, expected to be greater
arg2uintThe second value, expected to be less
messagestringThe message to display in case of failure
GreaterOrEqual(uint, uint, string, params object[])
Verifies that the first value is greater than or equal to the second value. If it is not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void GreaterOrEqual(uint arg1, uint arg2, string message, params object[] args)
Parameters
arg1uintThe first value, expected to be greater
arg2uintThe second value, expected to be less
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
GreaterOrEqual(ulong, ulong)
Verifies that the first value is greater than or equal to the second value. If it is not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void GreaterOrEqual(ulong arg1, ulong arg2)
Parameters
GreaterOrEqual(ulong, ulong, string)
Verifies that the first value is greater than or equal to the second value. If it is not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void GreaterOrEqual(ulong arg1, ulong arg2, string message)
Parameters
arg1ulongThe first value, expected to be greater
arg2ulongThe second value, expected to be less
messagestringThe message to display in case of failure
GreaterOrEqual(ulong, ulong, string, params object[])
Verifies that the first value is greater than or equal to the second value. If it is not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void GreaterOrEqual(ulong arg1, ulong arg2, string message, params object[] args)
Parameters
arg1ulongThe first value, expected to be greater
arg2ulongThe second value, expected to be less
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
Ignore()
Throws an IgnoreException. This causes the test to be reported as ignored.
public static void Ignore()
Ignore(string)
Throws an IgnoreException with the message that is passed in. This causes the test to be reported as ignored.
public static void Ignore(string message)
Parameters
messagestringThe message to initialize the AssertionException with.
Ignore(string, params object[])
Throws an IgnoreException with the message and arguments that are passed in. This causes the test to be reported as ignored.
public static void Ignore(string message, params object[] args)
Parameters
messagestringThe message to initialize the AssertionException with.
argsobject[]Arguments to be used in formatting the message
Inconclusive()
Throws an InconclusiveException. This causes the test to be reported as Inconclusive.
public static void Inconclusive()
Inconclusive(string)
Throws an InconclusiveException with the message that is passed in. This causes the test to be reported as inconclusive.
public static void Inconclusive(string message)
Parameters
messagestringThe message to initialize the InconclusiveException with.
Inconclusive(string, params object[])
Throws an InconclusiveException with the message and arguments that are passed in. This causes the test to be reported as inconclusive.
public static void Inconclusive(string message, params object[] args)
Parameters
messagestringThe message to initialize the InconclusiveException with.
argsobject[]Arguments to be used in formatting the message
IsAssignableFrom(Type, object)
Asserts that an object may be assigned a value of a given Type.
public static void IsAssignableFrom(Type expected, object actual)
Parameters
IsAssignableFrom(Type, object, string)
Asserts that an object may be assigned a value of a given Type.
public static void IsAssignableFrom(Type expected, object actual, string message)
Parameters
expectedTypeThe expected Type.
actualobjectThe object under examination
messagestringThe message to display in case of failure
IsAssignableFrom(Type, object, string, params object[])
Asserts that an object may be assigned a value of a given Type.
public static void IsAssignableFrom(Type expected, object actual, string message, params object[] args)
Parameters
expectedTypeThe expected Type.
actualobjectThe object under examination
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
IsAssignableFrom<TExpected>(object)
Asserts that an object may be assigned a value of a given Type.
public static void IsAssignableFrom<TExpected>(object actual)
Parameters
actualobjectThe object under examination
Type Parameters
TExpectedThe expected Type.
IsAssignableFrom<TExpected>(object, string)
Asserts that an object may be assigned a value of a given Type.
public static void IsAssignableFrom<TExpected>(object actual, string message)
Parameters
Type Parameters
TExpectedThe expected Type.
IsAssignableFrom<TExpected>(object, string, params object[])
Asserts that an object may be assigned a value of a given Type.
public static void IsAssignableFrom<TExpected>(object actual, string message, params object[] args)
Parameters
actualobjectThe object under examination
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
Type Parameters
TExpectedThe expected Type.
IsEmpty(IEnumerable)
Assert that an array, list or other collection is empty
public static void IsEmpty(IEnumerable collection)
Parameters
collectionIEnumerableAn array, list or other collection implementing ICollection
IsEmpty(IEnumerable, string)
Assert that an array, list or other collection is empty
public static void IsEmpty(IEnumerable collection, string message)
Parameters
collectionIEnumerableAn array, list or other collection implementing ICollection
messagestringThe message to display in case of failure
IsEmpty(IEnumerable, string, params object[])
Assert that an array, list or other collection is empty
public static void IsEmpty(IEnumerable collection, string message, params object[] args)
Parameters
collectionIEnumerableAn array, list or other collection implementing ICollection
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
IsEmpty(string)
Assert that a string is empty - that is equal to string.Empty
public static void IsEmpty(string aString)
Parameters
aStringstringThe string to be tested
IsEmpty(string, string)
Assert that a string is empty - that is equal to string.Empty
public static void IsEmpty(string aString, string message)
Parameters
IsEmpty(string, string, params object[])
Assert that a string is empty - that is equal to string.Empty
public static void IsEmpty(string aString, string message, params object[] args)
Parameters
aStringstringThe string to be tested
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
IsFalse(bool)
Asserts that a condition is false. If the condition is true the method throws an AssertionException.
public static void IsFalse(bool condition)
Parameters
conditionboolThe evaluated condition
IsFalse(bool, string)
Asserts that a condition is false. If the condition is true the method throws an AssertionException.
public static void IsFalse(bool condition, string message)
Parameters
IsFalse(bool, string, params object[])
Asserts that a condition is false. If the condition is true the method throws an AssertionException.
public static void IsFalse(bool condition, string message, params object[] args)
Parameters
conditionboolThe evaluated condition
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
IsInstanceOf(Type, object)
Asserts that an object is an instance of a given type.
public static void IsInstanceOf(Type expected, object actual)
Parameters
IsInstanceOf(Type, object, string)
Asserts that an object is an instance of a given type.
public static void IsInstanceOf(Type expected, object actual, string message)
Parameters
expectedTypeThe expected Type
actualobjectThe object being examined
messagestringThe message to display in case of failure
IsInstanceOf(Type, object, string, params object[])
Asserts that an object is an instance of a given type.
public static void IsInstanceOf(Type expected, object actual, string message, params object[] args)
Parameters
expectedTypeThe expected Type
actualobjectThe object being examined
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
IsInstanceOf<TExpected>(object)
Asserts that an object is an instance of a given type.
public static void IsInstanceOf<TExpected>(object actual)
Parameters
actualobjectThe object being examined
Type Parameters
TExpectedThe expected Type
IsInstanceOf<TExpected>(object, string)
Asserts that an object is an instance of a given type.
public static void IsInstanceOf<TExpected>(object actual, string message)
Parameters
Type Parameters
TExpectedThe expected Type
IsInstanceOf<TExpected>(object, string, params object[])
Asserts that an object is an instance of a given type.
public static void IsInstanceOf<TExpected>(object actual, string message, params object[] args)
Parameters
actualobjectThe object being examined
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
Type Parameters
TExpectedThe expected Type
IsNaN(double)
Verifies that the double that is passed in is an
NaN value.
If the object is not NaN then an AssertionException
is thrown.
public static void IsNaN(double aDouble)
Parameters
aDoubledoubleThe value that is to be tested
IsNaN(double, string)
Verifies that the double that is passed in is an
NaN value.
If the object is not NaN then an AssertionException
is thrown.
public static void IsNaN(double aDouble, string message)
Parameters
aDoubledoubleThe value that is to be tested
messagestringThe message to display in case of failure
IsNaN(double, string, params object[])
Verifies that the double that is passed in is an
NaN value.
If the object is not NaN then an AssertionException
is thrown.
public static void IsNaN(double aDouble, string message, params object[] args)
Parameters
aDoubledoubleThe value that is to be tested
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
IsNaN(double?)
Verifies that the double that is passed in is an
NaN value.
If the object is not NaN then an AssertionException
is thrown.
public static void IsNaN(double? aDouble)
Parameters
aDoubledouble?The value that is to be tested
IsNaN(double?, string)
Verifies that the double that is passed in is an
NaN value.
If the object is not NaN then an AssertionException
is thrown.
public static void IsNaN(double? aDouble, string message)
Parameters
aDoubledouble?The value that is to be tested
messagestringThe message to display in case of failure
IsNaN(double?, string, params object[])
Verifies that the double that is passed in is an
NaN value.
If the object is not NaN then an AssertionException
is thrown.
public static void IsNaN(double? aDouble, string message, params object[] args)
Parameters
aDoubledouble?The value that is to be tested
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
IsNotAssignableFrom(Type, object)
Asserts that an object may not be assigned a value of a given Type.
public static void IsNotAssignableFrom(Type expected, object actual)
Parameters
IsNotAssignableFrom(Type, object, string)
Asserts that an object may not be assigned a value of a given Type.
public static void IsNotAssignableFrom(Type expected, object actual, string message)
Parameters
expectedTypeThe expected Type.
actualobjectThe object under examination
messagestringThe message to display in case of failure
IsNotAssignableFrom(Type, object, string, params object[])
Asserts that an object may not be assigned a value of a given Type.
public static void IsNotAssignableFrom(Type expected, object actual, string message, params object[] args)
Parameters
expectedTypeThe expected Type.
actualobjectThe object under examination
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
IsNotAssignableFrom<TExpected>(object)
Asserts that an object may not be assigned a value of a given Type.
public static void IsNotAssignableFrom<TExpected>(object actual)
Parameters
actualobjectThe object under examination
Type Parameters
TExpectedThe expected Type.
IsNotAssignableFrom<TExpected>(object, string)
Asserts that an object may not be assigned a value of a given Type.
public static void IsNotAssignableFrom<TExpected>(object actual, string message)
Parameters
Type Parameters
TExpectedThe expected Type.
IsNotAssignableFrom<TExpected>(object, string, params object[])
Asserts that an object may not be assigned a value of a given Type.
public static void IsNotAssignableFrom<TExpected>(object actual, string message, params object[] args)
Parameters
actualobjectThe object under examination
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
Type Parameters
TExpectedThe expected Type.
IsNotEmpty(IEnumerable)
Assert that an array, list or other collection is not empty
public static void IsNotEmpty(IEnumerable collection)
Parameters
collectionIEnumerableAn array, list or other collection implementing ICollection
IsNotEmpty(IEnumerable, string)
Assert that an array, list or other collection is not empty
public static void IsNotEmpty(IEnumerable collection, string message)
Parameters
collectionIEnumerableAn array, list or other collection implementing ICollection
messagestringThe message to display in case of failure
IsNotEmpty(IEnumerable, string, params object[])
Assert that an array, list or other collection is not empty
public static void IsNotEmpty(IEnumerable collection, string message, params object[] args)
Parameters
collectionIEnumerableAn array, list or other collection implementing ICollection
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
IsNotEmpty(string)
Assert that a string is not empty - that is not equal to string.Empty
public static void IsNotEmpty(string aString)
Parameters
aStringstringThe string to be tested
IsNotEmpty(string, string)
Assert that a string is not empty - that is not equal to string.Empty
public static void IsNotEmpty(string aString, string message)
Parameters
IsNotEmpty(string, string, params object[])
Assert that a string is not empty - that is not equal to string.Empty
public static void IsNotEmpty(string aString, string message, params object[] args)
Parameters
aStringstringThe string to be tested
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
IsNotInstanceOf(Type, object)
Asserts that an object is not an instance of a given type.
public static void IsNotInstanceOf(Type expected, object actual)
Parameters
IsNotInstanceOf(Type, object, string)
Asserts that an object is not an instance of a given type.
public static void IsNotInstanceOf(Type expected, object actual, string message)
Parameters
expectedTypeThe expected Type
actualobjectThe object being examined
messagestringThe message to display in case of failure
IsNotInstanceOf(Type, object, string, params object[])
Asserts that an object is not an instance of a given type.
public static void IsNotInstanceOf(Type expected, object actual, string message, params object[] args)
Parameters
expectedTypeThe expected Type
actualobjectThe object being examined
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
IsNotInstanceOf<TExpected>(object)
Asserts that an object is not an instance of a given type.
public static void IsNotInstanceOf<TExpected>(object actual)
Parameters
actualobjectThe object being examined
Type Parameters
TExpectedThe expected Type
IsNotInstanceOf<TExpected>(object, string)
Asserts that an object is not an instance of a given type.
public static void IsNotInstanceOf<TExpected>(object actual, string message)
Parameters
Type Parameters
TExpectedThe expected Type
IsNotInstanceOf<TExpected>(object, string, params object[])
Asserts that an object is not an instance of a given type.
public static void IsNotInstanceOf<TExpected>(object actual, string message, params object[] args)
Parameters
actualobjectThe object being examined
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
Type Parameters
TExpectedThe expected Type
IsNotNull(object)
Verifies that the object that is passed in is not equal to
null
If the object is null then an AssertionException
is thrown.
public static void IsNotNull(object anObject)
Parameters
anObjectobjectThe object that is to be tested
IsNotNull(object, string)
Verifies that the object that is passed in is not equal to
null
If the object is null then an AssertionException
is thrown.
public static void IsNotNull(object anObject, string message)
Parameters
anObjectobjectThe object that is to be tested
messagestringThe message to display in case of failure
IsNotNull(object, string, params object[])
Verifies that the object that is passed in is not equal to
null
If the object is null then an AssertionException
is thrown.
public static void IsNotNull(object anObject, string message, params object[] args)
Parameters
anObjectobjectThe object that is to be tested
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
IsNull(object)
Verifies that the object that is passed in is equal to
null
If the object is not null then an AssertionException
is thrown.
public static void IsNull(object anObject)
Parameters
anObjectobjectThe object that is to be tested
IsNull(object, string)
Verifies that the object that is passed in is equal to
null
If the object is not null then an AssertionException
is thrown.
public static void IsNull(object anObject, string message)
Parameters
anObjectobjectThe object that is to be tested
messagestringThe message to display in case of failure
IsNull(object, string, params object[])
Verifies that the object that is passed in is equal to
null
If the object is not null then an AssertionException
is thrown.
public static void IsNull(object anObject, string message, params object[] args)
Parameters
anObjectobjectThe object that is to be tested
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
IsTrue(bool)
Asserts that a condition is true. If the condition is false the method throws an AssertionException.
public static void IsTrue(bool condition)
Parameters
conditionboolThe evaluated condition
IsTrue(bool, string)
Asserts that a condition is true. If the condition is false the method throws an AssertionException.
public static void IsTrue(bool condition, string message)
Parameters
IsTrue(bool, string, params object[])
Asserts that a condition is true. If the condition is false the method throws an AssertionException.
public static void IsTrue(bool condition, string message, params object[] args)
Parameters
conditionboolThe evaluated condition
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
Less(decimal, decimal)
Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.
public static void Less(decimal arg1, decimal arg2)
Parameters
arg1decimalThe first value, expected to be less
arg2decimalThe second value, expected to be greater
Less(decimal, decimal, string)
Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.
public static void Less(decimal arg1, decimal arg2, string message)
Parameters
arg1decimalThe first value, expected to be less
arg2decimalThe second value, expected to be greater
messagestringThe message to display in case of failure
Less(decimal, decimal, string, params object[])
Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.
public static void Less(decimal arg1, decimal arg2, string message, params object[] args)
Parameters
arg1decimalThe first value, expected to be less
arg2decimalThe second value, expected to be greater
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
Less(double, double)
Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.
public static void Less(double arg1, double arg2)
Parameters
arg1doubleThe first value, expected to be less
arg2doubleThe second value, expected to be greater
Less(double, double, string)
Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.
public static void Less(double arg1, double arg2, string message)
Parameters
arg1doubleThe first value, expected to be less
arg2doubleThe second value, expected to be greater
messagestringThe message to display in case of failure
Less(double, double, string, params object[])
Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.
public static void Less(double arg1, double arg2, string message, params object[] args)
Parameters
arg1doubleThe first value, expected to be less
arg2doubleThe second value, expected to be greater
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
Less(IComparable, IComparable)
Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.
public static void Less(IComparable arg1, IComparable arg2)
Parameters
arg1IComparableThe first value, expected to be less
arg2IComparableThe second value, expected to be greater
Less(IComparable, IComparable, string)
Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.
public static void Less(IComparable arg1, IComparable arg2, string message)
Parameters
arg1IComparableThe first value, expected to be less
arg2IComparableThe second value, expected to be greater
messagestringThe message to display in case of failure
Less(IComparable, IComparable, string, params object[])
Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.
public static void Less(IComparable arg1, IComparable arg2, string message, params object[] args)
Parameters
arg1IComparableThe first value, expected to be less
arg2IComparableThe second value, expected to be greater
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
Less(int, int)
Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.
public static void Less(int arg1, int arg2)
Parameters
Less(int, int, string)
Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.
public static void Less(int arg1, int arg2, string message)
Parameters
arg1intThe first value, expected to be less
arg2intThe second value, expected to be greater
messagestringThe message to display in case of failure
Less(int, int, string, params object[])
Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.
public static void Less(int arg1, int arg2, string message, params object[] args)
Parameters
arg1intThe first value, expected to be less
arg2intThe second value, expected to be greater
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
Less(long, long)
Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.
public static void Less(long arg1, long arg2)
Parameters
Less(long, long, string)
Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.
public static void Less(long arg1, long arg2, string message)
Parameters
arg1longThe first value, expected to be less
arg2longThe second value, expected to be greater
messagestringThe message to display in case of failure
Less(long, long, string, params object[])
Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.
public static void Less(long arg1, long arg2, string message, params object[] args)
Parameters
arg1longThe first value, expected to be less
arg2longThe second value, expected to be greater
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
Less(float, float)
Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.
public static void Less(float arg1, float arg2)
Parameters
Less(float, float, string)
Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.
public static void Less(float arg1, float arg2, string message)
Parameters
arg1floatThe first value, expected to be less
arg2floatThe second value, expected to be greater
messagestringThe message to display in case of failure
Less(float, float, string, params object[])
Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.
public static void Less(float arg1, float arg2, string message, params object[] args)
Parameters
arg1floatThe first value, expected to be less
arg2floatThe second value, expected to be greater
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
Less(uint, uint)
Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void Less(uint arg1, uint arg2)
Parameters
Less(uint, uint, string)
Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void Less(uint arg1, uint arg2, string message)
Parameters
arg1uintThe first value, expected to be less
arg2uintThe second value, expected to be greater
messagestringThe message to display in case of failure
Less(uint, uint, string, params object[])
Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void Less(uint arg1, uint arg2, string message, params object[] args)
Parameters
arg1uintThe first value, expected to be less
arg2uintThe second value, expected to be greater
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
Less(ulong, ulong)
Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void Less(ulong arg1, ulong arg2)
Parameters
Less(ulong, ulong, string)
Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void Less(ulong arg1, ulong arg2, string message)
Parameters
arg1ulongThe first value, expected to be less
arg2ulongThe second value, expected to be greater
messagestringThe message to display in case of failure
Less(ulong, ulong, string, params object[])
Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void Less(ulong arg1, ulong arg2, string message, params object[] args)
Parameters
arg1ulongThe first value, expected to be less
arg2ulongThe second value, expected to be greater
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
LessOrEqual(decimal, decimal)
Verifies that the first value is less than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void LessOrEqual(decimal arg1, decimal arg2)
Parameters
arg1decimalThe first value, expected to be less
arg2decimalThe second value, expected to be greater
LessOrEqual(decimal, decimal, string)
Verifies that the first value is less than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void LessOrEqual(decimal arg1, decimal arg2, string message)
Parameters
arg1decimalThe first value, expected to be less
arg2decimalThe second value, expected to be greater
messagestringThe message to display in case of failure
LessOrEqual(decimal, decimal, string, params object[])
Verifies that the first value is less than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void LessOrEqual(decimal arg1, decimal arg2, string message, params object[] args)
Parameters
arg1decimalThe first value, expected to be less
arg2decimalThe second value, expected to be greater
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
LessOrEqual(double, double)
Verifies that the first value is less than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void LessOrEqual(double arg1, double arg2)
Parameters
arg1doubleThe first value, expected to be less
arg2doubleThe second value, expected to be greater
LessOrEqual(double, double, string)
Verifies that the first value is less than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void LessOrEqual(double arg1, double arg2, string message)
Parameters
arg1doubleThe first value, expected to be less
arg2doubleThe second value, expected to be greater
messagestringThe message to display in case of failure
LessOrEqual(double, double, string, params object[])
Verifies that the first value is less than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void LessOrEqual(double arg1, double arg2, string message, params object[] args)
Parameters
arg1doubleThe first value, expected to be less
arg2doubleThe second value, expected to be greater
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
LessOrEqual(IComparable, IComparable)
Verifies that the first value is less than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void LessOrEqual(IComparable arg1, IComparable arg2)
Parameters
arg1IComparableThe first value, expected to be less
arg2IComparableThe second value, expected to be greater
LessOrEqual(IComparable, IComparable, string)
Verifies that the first value is less than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void LessOrEqual(IComparable arg1, IComparable arg2, string message)
Parameters
arg1IComparableThe first value, expected to be less
arg2IComparableThe second value, expected to be greater
messagestringThe message to display in case of failure
LessOrEqual(IComparable, IComparable, string, params object[])
Verifies that the first value is less than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void LessOrEqual(IComparable arg1, IComparable arg2, string message, params object[] args)
Parameters
arg1IComparableThe first value, expected to be less
arg2IComparableThe second value, expected to be greater
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
LessOrEqual(int, int)
Verifies that the first value is less than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void LessOrEqual(int arg1, int arg2)
Parameters
LessOrEqual(int, int, string)
Verifies that the first value is less than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void LessOrEqual(int arg1, int arg2, string message)
Parameters
arg1intThe first value, expected to be less
arg2intThe second value, expected to be greater
messagestringThe message to display in case of failure
LessOrEqual(int, int, string, params object[])
Verifies that the first value is less than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void LessOrEqual(int arg1, int arg2, string message, params object[] args)
Parameters
arg1intThe first value, expected to be less
arg2intThe second value, expected to be greater
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
LessOrEqual(long, long)
Verifies that the first value is less than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void LessOrEqual(long arg1, long arg2)
Parameters
LessOrEqual(long, long, string)
Verifies that the first value is less than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void LessOrEqual(long arg1, long arg2, string message)
Parameters
arg1longThe first value, expected to be less
arg2longThe second value, expected to be greater
messagestringThe message to display in case of failure
LessOrEqual(long, long, string, params object[])
Verifies that the first value is less than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void LessOrEqual(long arg1, long arg2, string message, params object[] args)
Parameters
arg1longThe first value, expected to be less
arg2longThe second value, expected to be greater
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
LessOrEqual(float, float)
Verifies that the first value is less than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void LessOrEqual(float arg1, float arg2)
Parameters
LessOrEqual(float, float, string)
Verifies that the first value is less than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void LessOrEqual(float arg1, float arg2, string message)
Parameters
arg1floatThe first value, expected to be less
arg2floatThe second value, expected to be greater
messagestringThe message to display in case of failure
LessOrEqual(float, float, string, params object[])
Verifies that the first value is less than or equal to the second value. If it is not, then an AssertionException is thrown.
public static void LessOrEqual(float arg1, float arg2, string message, params object[] args)
Parameters
arg1floatThe first value, expected to be less
arg2floatThe second value, expected to be greater
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
LessOrEqual(uint, uint)
Verifies that the first value is less than or equal to the second value. If it is not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void LessOrEqual(uint arg1, uint arg2)
Parameters
LessOrEqual(uint, uint, string)
Verifies that the first value is less than or equal to the second value. If it is not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void LessOrEqual(uint arg1, uint arg2, string message)
Parameters
arg1uintThe first value, expected to be less
arg2uintThe second value, expected to be greater
messagestringThe message to display in case of failure
LessOrEqual(uint, uint, string, params object[])
Verifies that the first value is less than or equal to the second value. If it is not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void LessOrEqual(uint arg1, uint arg2, string message, params object[] args)
Parameters
arg1uintThe first value, expected to be less
arg2uintThe second value, expected to be greater
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
LessOrEqual(ulong, ulong)
Verifies that the first value is less than or equal to the second value. If it is not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void LessOrEqual(ulong arg1, ulong arg2)
Parameters
LessOrEqual(ulong, ulong, string)
Verifies that the first value is less than or equal to the second value. If it is not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void LessOrEqual(ulong arg1, ulong arg2, string message)
Parameters
arg1ulongThe first value, expected to be less
arg2ulongThe second value, expected to be greater
messagestringThe message to display in case of failure
LessOrEqual(ulong, ulong, string, params object[])
Verifies that the first value is less than or equal to the second value. If it is not, then an AssertionException is thrown.
[CLSCompliant(false)]
public static void LessOrEqual(ulong arg1, ulong arg2, string message, params object[] args)
Parameters
arg1ulongThe first value, expected to be less
arg2ulongThe second value, expected to be greater
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
NotNull(object)
Verifies that the object that is passed in is not equal to
null
If the object is null then an AssertionException
is thrown.
public static void NotNull(object anObject)
Parameters
anObjectobjectThe object that is to be tested
NotNull(object, string)
Verifies that the object that is passed in is not equal to
null
If the object is null then an AssertionException
is thrown.
public static void NotNull(object anObject, string message)
Parameters
anObjectobjectThe object that is to be tested
messagestringThe message to display in case of failure
NotNull(object, string, params object[])
Verifies that the object that is passed in is not equal to
null
If the object is null then an AssertionException
is thrown.
public static void NotNull(object anObject, string message, params object[] args)
Parameters
anObjectobjectThe object that is to be tested
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
Null(object)
Verifies that the object that is passed in is equal to
null
If the object is not null then an AssertionException
is thrown.
public static void Null(object anObject)
Parameters
anObjectobjectThe object that is to be tested
Null(object, string)
Verifies that the object that is passed in is equal to
null
If the object is not null then an AssertionException
is thrown.
public static void Null(object anObject, string message)
Parameters
anObjectobjectThe object that is to be tested
messagestringThe message to display in case of failure
Null(object, string, params object[])
Verifies that the object that is passed in is equal to
null
If the object is not null then an AssertionException
is thrown.
public static void Null(object anObject, string message, params object[] args)
Parameters
anObjectobjectThe object that is to be tested
messagestringThe message to display in case of failure
argsobject[]Array of objects to be used in formatting the message
Pass()
Throws a SuccessException with the message and arguments that are passed in. This allows a test to be cut short, with a result of success returned to NUnit.
public static void Pass()
Pass(string)
Throws a SuccessException with the message and arguments that are passed in. This allows a test to be cut short, with a result of success returned to NUnit.
public static void Pass(string message)
Parameters
messagestringThe message to initialize the AssertionException with.
Pass(string, params object[])
Throws a SuccessException with the message and arguments that are passed in. This allows a test to be cut short, with a result of success returned to NUnit.
public static void Pass(string message, params object[] args)
Parameters
messagestringThe message to initialize the AssertionException with.
argsobject[]Arguments to be used in formatting the message
ReferenceEquals(object, object)
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 void ReferenceEquals(object a, object b)
Parameters
That(TestDelegate, IResolveConstraint)
Asserts that the code represented by a delegate throws an exception that satisfies the constraint provided.
public static void That(TestDelegate code, IResolveConstraint constraint)
Parameters
codeTestDelegateA TestDelegate to be executed
constraintIResolveConstraintA ThrowsConstraint used in the test
That(bool)
Asserts that a condition is true. If the condition is false the method throws an AssertionException.
public static void That(bool condition)
Parameters
conditionboolThe evaluated condition
That(bool, string)
Asserts that a condition is true. If the condition is false the method throws an AssertionException.
public static void That(bool condition, string message)
Parameters
conditionboolThe evaluated condition
messagestringThe message to display if the condition is false
That(bool, string, params object[])
Asserts that a condition is true. If the condition is false the method throws an AssertionException.
public static void That(bool condition, string message, params object[] args)
Parameters
conditionboolThe evaluated condition
messagestringThe message to display if the condition is false
argsobject[]Arguments to be used in formatting the message
That(Func<bool>)
Asserts that a condition is true. If the condition is false the method throws an AssertionException.
public static void That(Func<bool> condition)
Parameters
That(Func<bool>, string)
Asserts that a condition is true. If the condition is false the method throws an AssertionException.
public static void That(Func<bool> condition, string message)
Parameters
conditionFunc<bool>A lambda that returns a Boolean
messagestringThe message to display if the condition is false
That(Func<bool>, string, params object[])
Asserts that a condition is true. If the condition is false the method throws an AssertionException.
public static void That(Func<bool> condition, string message, params object[] args)
Parameters
conditionFunc<bool>A lambda that returns a Boolean
messagestringThe message to display if the condition is false
argsobject[]Arguments to be used in formatting the message
That<TActual>(ActualValueDelegate<TActual>, IResolveConstraint)
Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.
public static void That<TActual>(ActualValueDelegate<TActual> del, IResolveConstraint expr)
Parameters
delActualValueDelegate<TActual>An ActualValueDelegate returning the value to be tested
exprIResolveConstraintA Constraint expression to be applied
Type Parameters
TActual
That<TActual>(ActualValueDelegate<TActual>, IResolveConstraint, string)
Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.
public static void That<TActual>(ActualValueDelegate<TActual> del, IResolveConstraint expr, string message)
Parameters
delActualValueDelegate<TActual>An ActualValueDelegate returning the value to be tested
exprIResolveConstraintA Constraint expression to be applied
messagestringThe message that will be displayed on failure
Type Parameters
TActual
That<TActual>(ActualValueDelegate<TActual>, IResolveConstraint, string, params object[])
Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.
public static void That<TActual>(ActualValueDelegate<TActual> del, IResolveConstraint expr, string message, params object[] args)
Parameters
delActualValueDelegate<TActual>An ActualValueDelegate returning the value to be tested
exprIResolveConstraintA Constraint expression to be applied
messagestringThe message that will be displayed on failure
argsobject[]Arguments to be used in formatting the message
Type Parameters
TActual
That<TActual>(TActual, IResolveConstraint)
Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.
public static void That<TActual>(TActual actual, IResolveConstraint expression)
Parameters
actualTActualThe actual value to test
expressionIResolveConstraintA Constraint to be applied
Type Parameters
TActual
That<TActual>(TActual, IResolveConstraint, string)
Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.
public static void That<TActual>(TActual actual, IResolveConstraint expression, string message)
Parameters
actualTActualThe actual value to test
expressionIResolveConstraintA Constraint to be applied
messagestringThe message that will be displayed on failure
Type Parameters
TActual
That<TActual>(TActual, IResolveConstraint, string, params object[])
Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.
public static void That<TActual>(TActual actual, IResolveConstraint expression, string message, params object[] args)
Parameters
actualTActualThe actual value to test
expressionIResolveConstraintA Constraint expression to be applied
messagestringThe message that will be displayed on failure
argsobject[]Arguments to be used in formatting the message
Type Parameters
TActual
That<TActual>(ref TActual, IResolveConstraint)
Apply a constraint to a referenced value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.
public static void That<TActual>(ref TActual actual, IResolveConstraint expression)
Parameters
actualTActualThe actual value to test
expressionIResolveConstraintA Constraint to be applied
Type Parameters
TActual
That<TActual>(ref TActual, IResolveConstraint, string)
Apply a constraint to a referenced value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.
public static void That<TActual>(ref TActual actual, IResolveConstraint expression, string message)
Parameters
actualTActualThe actual value to test
expressionIResolveConstraintA Constraint to be applied
messagestringThe message that will be displayed on failure
Type Parameters
TActual
That<TActual>(ref TActual, IResolveConstraint, string, params object[])
Apply a constraint to a referenced value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.
public static void That<TActual>(ref TActual actual, IResolveConstraint expression, string message, params object[] args)
Parameters
actualTActualThe actual value to test
expressionIResolveConstraintA Constraint to be applied
messagestringThe message that will be displayed on failure
argsobject[]Arguments to be used in formatting the message
Type Parameters
TActual
Throws(IResolveConstraint, TestDelegate)
Verifies that a delegate throws a particular exception when called.
public static Exception Throws(IResolveConstraint expression, TestDelegate code)
Parameters
expressionIResolveConstraintA constraint to be satisfied by the exception
codeTestDelegateA TestSnippet delegate
Returns
Throws(IResolveConstraint, TestDelegate, string)
Verifies that a delegate throws a particular exception when called.
public static Exception Throws(IResolveConstraint expression, TestDelegate code, string message)
Parameters
expressionIResolveConstraintA constraint to be satisfied by the exception
codeTestDelegateA TestSnippet delegate
messagestringThe message that will be displayed on failure
Returns
Throws(IResolveConstraint, TestDelegate, string, params object[])
Verifies that a delegate throws a particular exception when called.
public static Exception Throws(IResolveConstraint expression, TestDelegate code, string message, params object[] args)
Parameters
expressionIResolveConstraintA constraint to be satisfied by the exception
codeTestDelegateA TestSnippet delegate
messagestringThe message that will be displayed on failure
argsobject[]Arguments to be used in formatting the message
Returns
Throws(Type, TestDelegate)
Verifies that a delegate throws a particular exception when called.
public static Exception Throws(Type expectedExceptionType, TestDelegate code)
Parameters
expectedExceptionTypeTypeThe exception Type expected
codeTestDelegateA TestDelegate
Returns
Throws(Type, TestDelegate, string)
Verifies that a delegate throws a particular exception when called.
public static Exception Throws(Type expectedExceptionType, TestDelegate code, string message)
Parameters
expectedExceptionTypeTypeThe exception Type expected
codeTestDelegateA TestDelegate
messagestringThe message that will be displayed on failure
Returns
Throws(Type, TestDelegate, string, params object[])
Verifies that a delegate throws a particular exception when called.
public static Exception Throws(Type expectedExceptionType, TestDelegate code, string message, params object[] args)
Parameters
expectedExceptionTypeTypeThe exception Type expected
codeTestDelegateA TestDelegate
messagestringThe message that will be displayed on failure
argsobject[]Arguments to be used in formatting the message
Returns
Throws<TActual>(TestDelegate)
Verifies that a delegate throws a particular exception when called.
public static TActual Throws<TActual>(TestDelegate code) where TActual : Exception
Parameters
codeTestDelegateA TestDelegate
Returns
- TActual
Type Parameters
TActualType of the expected exception
Throws<TActual>(TestDelegate, string)
Verifies that a delegate throws a particular exception when called.
public static TActual Throws<TActual>(TestDelegate code, string message) where TActual : Exception
Parameters
codeTestDelegateA TestDelegate
messagestringThe message that will be displayed on failure
Returns
- TActual
Type Parameters
TActualType of the expected exception
Throws<TActual>(TestDelegate, string, params object[])
Verifies that a delegate throws a particular exception when called.
public static TActual Throws<TActual>(TestDelegate code, string message, params object[] args) where TActual : Exception
Parameters
codeTestDelegateA TestDelegate
messagestringThe message that will be displayed on failure
argsobject[]Arguments to be used in formatting the message
Returns
- TActual
Type Parameters
TActualType of the expected exception
True(bool)
Asserts that a condition is true. If the condition is false the method throws an AssertionException.
public static void True(bool condition)
Parameters
conditionboolThe evaluated condition
True(bool, string)
Asserts that a condition is true. If the condition is false the method throws an AssertionException.
public static void True(bool condition, string message)
Parameters
True(bool, string, params object[])
Asserts that a condition is true. If the condition is false the method throws an AssertionException.
public static void True(bool condition, string message, params object[] args)