iOS Guides | Samples

NUnit.Framework.Assert Class

The Assert class contains a collection of static methods that implement the most common assertions used in NUnit.

See Also: Assert

Syntax

public class Assert

Requirements

Namespace: NUnit.Framework
Assembly: NUnitLite (in NUnitLite.dll)
Assembly Versions: 0.6.0.0, 1.0.0.0

The members of NUnit.Framework.Assert are listed below.

See Also: Object

Protected Constructors

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.

Public Methods

static
AreEqual(Decimal, Decimal)
static
AreEqual(Int32, Int32)
static
AreEqual(Int64, Int64)
static
AreEqual(Object, Object)
static
AreEqual(UInt32, UInt32)
static
AreEqual(UInt64, UInt64)
static
AreEqual(Decimal, Decimal, String)
static
AreEqual(Double, Double, Double)
static
AreEqual(Double, Nullable<double>, Double)
static
AreEqual(Int32, Int32, String)
static
AreEqual(Int64, Int64, String)
static
AreEqual(Object, Object, String)
static
AreEqual(UInt32, UInt32, String)
static
AreEqual(UInt64, UInt64, String)
static
AreEqual(Decimal, Decimal, String, params Object[])
static
AreEqual(Double, Double, Double, String)
static
AreEqual(Double, Nullable<double>, Double, String)
static
AreEqual(Int32, Int32, String, params Object[])
static
AreEqual(Int64, Int64, String, params Object[])
static
AreEqual(Object, Object, String, params Object[])
static
AreEqual(UInt32, UInt32, String, params Object[])
static
AreEqual(UInt64, UInt64, String, params Object[])
static
AreEqual(Double, Double, Double, String, params Object[])
static
AreEqual(Double, Nullable<double>, Double, String, params Object[])
static
AreNotEqual(Decimal, Decimal)
static
AreNotEqual(Double, Double)
static
AreNotEqual(Int32, Int32)
static
AreNotEqual(Int64, Int64)
static
AreNotEqual(Object, Object)
static
AreNotEqual(Single, Single)
static
AreNotEqual(UInt32, UInt32)
static
AreNotEqual(UInt64, UInt64)
static
AreNotEqual(Decimal, Decimal, String)
static
AreNotEqual(Double, Double, String)
static
AreNotEqual(Int32, Int32, String)
static
AreNotEqual(Int64, Int64, String)
static
AreNotEqual(Object, Object, String)
static
AreNotEqual(Single, Single, String)
static
AreNotEqual(UInt32, UInt32, String)
static
AreNotEqual(UInt64, UInt64, String)
static
AreNotEqual(Decimal, Decimal, String, params Object[])
static
AreNotEqual(Double, Double, String, params Object[])
static
AreNotEqual(Int32, Int32, String, params Object[])
static
AreNotEqual(Int64, Int64, String, params Object[])
static
AreNotEqual(Object, Object, String, params Object[])
static
AreNotEqual(Single, Single, String, params Object[])
static
AreNotEqual(UInt32, UInt32, String, params Object[])
static
AreNotEqual(UInt64, UInt64, String, params Object[])
static
AreNotSame(Object, Object)
static
AreNotSame(Object, Object, String)
static
AreNotSame(Object, Object, String, params Object[])
static
AreSame(Object, Object)
static
AreSame(Object, Object, String)
static
AreSame(Object, Object, String, params Object[])
static
ByVal(Object, IResolveConstraint)
static
ByVal(Object, IResolveConstraint, String)
static
ByVal(Object, IResolveConstraint, String, params Object[])
static
Catch(TestDelegate) : Exception
static
Catch(TestDelegate, String) : Exception
static
Catch(Type, TestDelegate) : Exception
static
Catch(TestDelegate, String, params Object[]) : Exception
static
Catch(Type, TestDelegate, String) : Exception
static
Catch(Type, TestDelegate, String, params Object[]) : Exception
static
Catch<T>(TestDelegate) : T
static
Catch<T>(TestDelegate, String) : T
static
Catch<T>(TestDelegate, String, params Object[]) : T
static
DoesNotThrow(TestDelegate)
static
DoesNotThrow(TestDelegate, String)
static
DoesNotThrow(TestDelegate, String, params Object[])
static
Equals(Object, Object) : Boolean
The Equals method throws an AssertionException. This is done to make sure there is no mistake by calling this function.
static
Fail()
static
Fail(String)
static
Fail(String, params Object[])
Throw an assertion exception with a message and optional arguments
static
False(Boolean)
Asserts that a condition is false. If the condition is true the method throws an AssertionException.
static
False(Boolean, String)
Asserts that a condition is false. If the condition is true the method throws an AssertionException.
static
False(Boolean, String, params Object[])
Asserts that a condition is false. If the condition is true the method throws an AssertionException.
static
Ignore()
Throws an IgnoreException. This causes the test to be reported as ignored.
static
Ignore(String)
Throws an IgnoreException with the message that is passed in. This causes the test to be reported as ignored.
static
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.
static
Inconclusive()
Throws an InconclusiveException. This causes the test to be reported as Inconclusive.
static
Inconclusive(String)
Throws an InconclusiveException with the message that is passed in. This causes the test to be reported as inconclusive.
static
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.
static
IsFalse(Boolean)
static
IsFalse(Boolean, String)
static
IsFalse(Boolean, String, params Object[])
static
IsInstanceOfType(Type, Object)
static
IsInstanceOfType(Object, String, params Object[])
static
IsInstanceOfType(Type, Object, String)
static
IsInstanceOfType(Type, Object, String, params Object[])
static
IsNotNull(Object)
static
IsNotNull(Object, String)
static
IsNotNull(Object, String, params Object[])
static
IsNull(Object)
static
IsNull(Object, String)
static
IsNull(Object, String, params Object[])
static
IsTrue(Boolean)
static
IsTrue(Boolean, String)
static
IsTrue(Boolean, String, params Object[])
static
NotNull(Object)
Verifies that the object that is passed in is not equal to

Example

null
If the object is

Example

null
then an AssertionException is thrown.
static
NotNull(Object, String)
Verifies that the object that is passed in is not equal to

Example

null
If the object is

Example

null
then an AssertionException is thrown.
static
NotNull(Object, String, params Object[])
Verifies that the object that is passed in is not equal to

Example

null
If the object is

Example

null
then an AssertionException is thrown.
static
Null(Object)
Verifies that the object that is passed in is equal to

Example

null
If the object is not null

Example

null
then an AssertionException is thrown.
static
Null(Object, String)
Verifies that the object that is passed in is equal to

Example

null
If the object is not

Example

null
then an AssertionException is thrown.
static
Null(Object, String, params Object[])
Verifies that the object that is passed in is equal to

Example

null
If the object is not

Example

null
then an AssertionException is thrown.
static
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.
static
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.
static
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.
static
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.
static
That(Boolean)
Asserts that a condition is true. If the condition is false the method throws an AssertionException.
static
That(TestDelegate, IResolveConstraint)
static
That(Boolean, String)
Asserts that a condition is true. If the condition is false the method throws an AssertionException.
static
That(Object, IResolveConstraint)
Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.
static
That(Boolean, String, params Object[])
Asserts that a condition is true. If the condition is false the method throws an AssertionException.
static
That(Object, IResolveConstraint, String)
Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.
static
That(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.
static
That<T>(NUnit.Framework.Constraints.ActualValueDelegate<T>, IResolveConstraint)
static
That<T>(ref T, IResolveConstraint)
static
That<T>(NUnit.Framework.Constraints.ActualValueDelegate<T>, IResolveConstraint, String)
static
That<T>(ref T, IResolveConstraint, String)
static
That<T>(NUnit.Framework.Constraints.ActualValueDelegate<T>, IResolveConstraint, String, params Object[])
static
That<T>(ref T, IResolveConstraint, String, params Object[])
static
Throws(IResolveConstraint, TestDelegate) : Exception
static
Throws(Type, TestDelegate) : Exception
static
Throws(IResolveConstraint, TestDelegate, String) : Exception
static
Throws(Type, TestDelegate, String) : Exception
static
Throws(IResolveConstraint, TestDelegate, String, params Object[]) : Exception
static
Throws(Type, TestDelegate, String, params Object[]) : Exception
static
Throws<T>(TestDelegate) : T
static
Throws<T>(TestDelegate, String) : T
static
Throws<T>(TestDelegate, String, params Object[]) : T
static
True(Boolean)
Asserts that a condition is true. If the condition is false the method throws an AssertionException.
static
True(Boolean, String)
Asserts that a condition is true. If the condition is false the method throws an AssertionException.
static
True(Boolean, String, params Object[])
Asserts that a condition is true. If the condition is false the method throws an AssertionException.

Protected Methods