Search Results for

    Show / Hide Table of Contents

    Class ClassicAssert

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

    Inheritance
    object
    AssertBase
    Assert
    ClassicAssert
    Inherited Members
    Assert.Charlie()
    Assert.Pass(string)
    Assert.Pass()
    Assert.Fail(string)
    Assert.Fail()
    Assert.Warn(string)
    Assert.Ignore(string)
    Assert.Ignore()
    Assert.Inconclusive(string)
    Assert.Inconclusive()
    Assert.Multiple(TestDelegate)
    Assert.Multiple(AsyncTestDelegate)
    Assert.MultipleAsync(AsyncTestDelegate)
    Assert.EnterMultipleScope()
    Assert.ThrowsAsync(IResolveConstraint, AsyncTestDelegate, string, params object[])
    Assert.ThrowsAsync(IResolveConstraint, AsyncTestDelegate)
    Assert.ThrowsAsync(Type, AsyncTestDelegate, string, params object[])
    Assert.ThrowsAsync(Type, AsyncTestDelegate)
    Assert.ThrowsAsync<TActual>(AsyncTestDelegate, string, params object[])
    Assert.ThrowsAsync<TActual>(AsyncTestDelegate)
    Assert.CatchAsync(AsyncTestDelegate, string, params object[])
    Assert.CatchAsync(AsyncTestDelegate)
    Assert.CatchAsync(Type, AsyncTestDelegate, string, params object[])
    Assert.CatchAsync(Type, AsyncTestDelegate)
    Assert.CatchAsync<TActual>(AsyncTestDelegate, string, params object[])
    Assert.CatchAsync<TActual>(AsyncTestDelegate)
    Assert.DoesNotThrowAsync(AsyncTestDelegate, string, params object[])
    Assert.DoesNotThrowAsync(AsyncTestDelegate)
    Assert.Throws(IResolveConstraint, TestDelegate, string, params object[])
    Assert.Throws(IResolveConstraint, TestDelegate)
    Assert.Throws(Type, TestDelegate, string, params object[])
    Assert.Throws(Type, TestDelegate)
    Assert.Throws<TActual>(TestDelegate, string, params object[])
    Assert.Throws<TActual>(TestDelegate)
    Assert.Catch(TestDelegate, string, params object[])
    Assert.Catch(TestDelegate)
    Assert.Catch(Type, TestDelegate, string, params object[])
    Assert.Catch(Type, TestDelegate)
    Assert.Catch<TActual>(TestDelegate, string, params object[])
    Assert.Catch<TActual>(TestDelegate)
    Assert.DoesNotThrow(TestDelegate, string, params object[])
    Assert.DoesNotThrow(TestDelegate)
    Assert.That(bool, NUnitString, string)
    Assert.That(bool, FormattableString, string)
    Assert.That(bool, Func<string>, string)
    Assert.That(Func<bool>, NUnitString, string)
    Assert.That(Func<bool>, FormattableString, string)
    Assert.That(Func<bool>, Func<string>, string)
    Assert.That<TActual>(ActualValueDelegate<TActual>, IResolveConstraint, NUnitString, string, string)
    Assert.That<TActual>(ActualValueDelegate<TActual>, IResolveConstraint, FormattableString, string, string)
    Assert.That<TActual>(ActualValueDelegate<TActual>, IResolveConstraint, Func<string>, string, string)
    Assert.That(TestDelegate, IResolveConstraint, NUnitString, string, string)
    Assert.That(TestDelegate, IResolveConstraint, FormattableString, string, string)
    Assert.That(TestDelegate, IResolveConstraint, Func<string>, string, string)
    Assert.That<TActual>(TActual, IResolveConstraint, NUnitString, string, string)
    Assert.That<TActual>(TActual, IResolveConstraint, FormattableString, string, string)
    Assert.That<TActual>(TActual, IResolveConstraint, Func<string>, string, string)
    Assert.ByVal(object, IResolveConstraint, string, string, string)
    Assert.ThatAsync(AsyncTestDelegate, IResolveConstraint, NUnitString, string, string)
    Assert.ThatAsync(AsyncTestDelegate, IResolveConstraint, FormattableString, string, string)
    Assert.ThatAsync<T>(Func<Task<T>>, IResolveConstraint, NUnitString, string, string)
    Assert.ThatAsync<T>(Func<Task<T>>, IResolveConstraint, FormattableString, string, string)
    AssertBase.ConvertMessageWithArgs(string, object[])
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: NUnit.Framework.Legacy
    Assembly: nunit.framework.legacy.dll
    Syntax
    public abstract class ClassicAssert : Assert

    Constructors

    View Source

    ClassicAssert()

    Declaration
    protected ClassicAssert()

    Methods

    View Source

    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. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void AreEqual(double expected, double actual, double delta)
    Parameters
    Type Name Description
    double expected

    The expected value

    double actual

    The actual value

    double delta

    The maximum acceptable difference between the the expected and the actual

    View Source

    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. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void AreEqual(double expected, double actual, double delta, string message, params object?[]? args)
    Parameters
    Type Name Description
    double expected

    The expected value

    double actual

    The actual value

    double delta

    The maximum acceptable difference between the the expected and the actual

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    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. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void AreEqual(object? expected, object? actual)
    Parameters
    Type Name Description
    object expected

    The value that is expected

    object actual

    The actual value

    View Source

    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. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void AreEqual(object? expected, object? actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    object expected

    The value that is expected

    object actual

    The actual value

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    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. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void AreNotEqual(object? expected, object? actual)
    Parameters
    Type Name Description
    object expected

    The value that is expected

    object actual

    The actual value

    View Source

    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. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void AreNotEqual(object? expected, object? actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    object expected

    The value that is expected

    object actual

    The actual value

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    AreNotSame(object?, object?)

    Asserts that two objects do not refer to the same object. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void AreNotSame(object? expected, object? actual)
    Parameters
    Type Name Description
    object expected

    The expected object

    object actual

    The actual object

    View Source

    AreNotSame(object?, object?, string, params object?[]?)

    Asserts that two objects do not refer to the same object. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void AreNotSame(object? expected, object? actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    object expected

    The expected object

    object actual

    The actual object

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    AreSame(object?, object?)

    Asserts that two objects refer to the same object. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void AreSame(object? expected, object? actual)
    Parameters
    Type Name Description
    object expected

    The expected object

    object actual

    The actual object

    View Source

    AreSame(object?, object?, string, params object?[]?)

    Asserts that two objects refer to the same object. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void AreSame(object? expected, object? actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    object expected

    The expected object

    object actual

    The actual object

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    AssertDoublesAreEqual(double, double, double, string, object?[]?)

    Helper for Assert.AreEqual(double expected, double actual, ...) allowing code generation to work consistently.

    Declaration
    protected static void AssertDoublesAreEqual(double expected, double actual, double delta, string message, object?[]? args)
    Parameters
    Type Name Description
    double expected

    The expected value

    double actual

    The actual value

    double delta

    The maximum acceptable difference between the the expected and the actual

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Contains(object?, ICollection?)

    Asserts that an object is contained in a collection. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Contains(object? expected, ICollection? actual)
    Parameters
    Type Name Description
    object expected

    The expected object

    ICollection actual

    The collection to be examined

    View Source

    Contains(object?, ICollection?, string, params object?[]?)

    Asserts that an object is contained in a collection. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Contains(object? expected, ICollection? actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    object expected

    The expected object

    ICollection actual

    The collection to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    False(bool)

    Asserts that a condition is false. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void False(bool condition)
    Parameters
    Type Name Description
    bool condition

    The evaluated condition

    View Source

    False(bool, string, params object?[]?)

    Asserts that a condition is false. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void False(bool condition, string message, params object?[]? args)
    Parameters
    Type Name Description
    bool condition

    The evaluated condition

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    False(bool?)

    Asserts that a condition is false. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void False(bool? condition)
    Parameters
    Type Name Description
    bool? condition

    The evaluated condition

    View Source

    False(bool?, string, params object?[]?)

    Asserts that a condition is false. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void False(bool? condition, string message, params object?[]? args)
    Parameters
    Type Name Description
    bool? condition

    The evaluated condition

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Greater(decimal, decimal)

    Verifies that the first value is greater than the second value. If it is not, then an AssertionException is thrown.

    Declaration
    public static void Greater(decimal arg1, decimal arg2)
    Parameters
    Type Name Description
    decimal arg1

    The first value, expected to be greater

    decimal arg2

    The second value, expected to be less

    View Source

    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.

    Declaration
    public static void Greater(decimal arg1, decimal arg2, string message, params object[] args)
    Parameters
    Type Name Description
    decimal arg1

    The first value, expected to be greater

    decimal arg2

    The second value, expected to be less

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Greater(double, double)

    Verifies that the first value is greater than the second value. If it is not, then an AssertionException is thrown.

    Declaration
    public static void Greater(double arg1, double arg2)
    Parameters
    Type Name Description
    double arg1

    The first value, expected to be greater

    double arg2

    The second value, expected to be less

    View Source

    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.

    Declaration
    public static void Greater(double arg1, double arg2, string message, params object[] args)
    Parameters
    Type Name Description
    double arg1

    The first value, expected to be greater

    double arg2

    The second value, expected to be less

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Greater(IComparable, IComparable)

    Verifies that the first value is greater than the second value. If it is not, then an AssertionException is thrown.

    Declaration
    public static void Greater(IComparable arg1, IComparable arg2)
    Parameters
    Type Name Description
    IComparable arg1

    The first value, expected to be greater

    IComparable arg2

    The second value, expected to be less

    View Source

    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.

    Declaration
    public static void Greater(IComparable arg1, IComparable arg2, string message, params object[] args)
    Parameters
    Type Name Description
    IComparable arg1

    The first value, expected to be greater

    IComparable arg2

    The second value, expected to be less

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Greater(int, int)

    Verifies that the first int is greater than the second int. If it is not, then an AssertionException is thrown.

    Declaration
    public static void Greater(int arg1, int arg2)
    Parameters
    Type Name Description
    int arg1

    The first value, expected to be greater

    int arg2

    The second value, expected to be less

    View Source

    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.

    Declaration
    public static void Greater(int arg1, int arg2, string message, params object[] args)
    Parameters
    Type Name Description
    int arg1

    The first value, expected to be greater

    int arg2

    The second value, expected to be less

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Greater(long, long)

    Verifies that the first value is greater than the second value. If it is not, then an AssertionException is thrown.

    Declaration
    public static void Greater(long arg1, long arg2)
    Parameters
    Type Name Description
    long arg1

    The first value, expected to be greater

    long arg2

    The second value, expected to be less

    View Source

    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.

    Declaration
    public static void Greater(long arg1, long arg2, string message, params object[] args)
    Parameters
    Type Name Description
    long arg1

    The first value, expected to be greater

    long arg2

    The second value, expected to be less

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Greater(float, float)

    Verifies that the first value is greater than the second value. If it is not, then an AssertionException is thrown.

    Declaration
    public static void Greater(float arg1, float arg2)
    Parameters
    Type Name Description
    float arg1

    The first value, expected to be greater

    float arg2

    The second value, expected to be less

    View Source

    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.

    Declaration
    public static void Greater(float arg1, float arg2, string message, params object[] args)
    Parameters
    Type Name Description
    float arg1

    The first value, expected to be greater

    float arg2

    The second value, expected to be less

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Greater(uint, uint)

    Verifies that the first value is greater than the second value. If it is not, then an AssertionException is thrown.

    Declaration
    [CLSCompliant(false)]
    public static void Greater(uint arg1, uint arg2)
    Parameters
    Type Name Description
    uint arg1

    The first value, expected to be greater

    uint arg2

    The second value, expected to be less

    View Source

    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.

    Declaration
    [CLSCompliant(false)]
    public static void Greater(uint arg1, uint arg2, string message, params object[] args)
    Parameters
    Type Name Description
    uint arg1

    The first value, expected to be greater

    uint arg2

    The second value, expected to be less

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Greater(ulong, ulong)

    Verifies that the first value is greater than the second value. If it is not, then an AssertionException is thrown.

    Declaration
    [CLSCompliant(false)]
    public static void Greater(ulong arg1, ulong arg2)
    Parameters
    Type Name Description
    ulong arg1

    The first value, expected to be greater

    ulong arg2

    The second value, expected to be less

    View Source

    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.

    Declaration
    [CLSCompliant(false)]
    public static void Greater(ulong arg1, ulong arg2, string message, params object[] args)
    Parameters
    Type Name Description
    ulong arg1

    The first value, expected to be greater

    ulong arg2

    The second value, expected to be less

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    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.

    Declaration
    public static void GreaterOrEqual(decimal arg1, decimal arg2)
    Parameters
    Type Name Description
    decimal arg1

    The first value, expected to be greater

    decimal arg2

    The second value, expected to be less

    View Source

    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.

    Declaration
    public static void GreaterOrEqual(decimal arg1, decimal arg2, string message, params object[] args)
    Parameters
    Type Name Description
    decimal arg1

    The first value, expected to be greater

    decimal arg2

    The second value, expected to be less

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    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.

    Declaration
    public static void GreaterOrEqual(double arg1, double arg2)
    Parameters
    Type Name Description
    double arg1

    The first value, expected to be greater

    double arg2

    The second value, expected to be less

    View Source

    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.

    Declaration
    public static void GreaterOrEqual(double arg1, double arg2, string message, params object[] args)
    Parameters
    Type Name Description
    double arg1

    The first value, expected to be greater

    double arg2

    The second value, expected to be less

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    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.

    Declaration
    public static void GreaterOrEqual(IComparable arg1, IComparable arg2)
    Parameters
    Type Name Description
    IComparable arg1

    The first value, expected to be greater

    IComparable arg2

    The second value, expected to be less

    View Source

    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.

    Declaration
    public static void GreaterOrEqual(IComparable arg1, IComparable arg2, string message, params object[] args)
    Parameters
    Type Name Description
    IComparable arg1

    The first value, expected to be greater

    IComparable arg2

    The second value, expected to be less

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    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.

    Declaration
    public static void GreaterOrEqual(int arg1, int arg2)
    Parameters
    Type Name Description
    int arg1

    The first value, expected to be greater

    int arg2

    The second value, expected to be less

    View Source

    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.

    Declaration
    public static void GreaterOrEqual(int arg1, int arg2, string message, params object[] args)
    Parameters
    Type Name Description
    int arg1

    The first value, expected to be greater

    int arg2

    The second value, expected to be less

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    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.

    Declaration
    public static void GreaterOrEqual(long arg1, long arg2)
    Parameters
    Type Name Description
    long arg1

    The first value, expected to be greater

    long arg2

    The second value, expected to be less

    View Source

    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.

    Declaration
    public static void GreaterOrEqual(long arg1, long arg2, string message, params object[] args)
    Parameters
    Type Name Description
    long arg1

    The first value, expected to be greater

    long arg2

    The second value, expected to be less

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    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.

    Declaration
    public static void GreaterOrEqual(float arg1, float arg2)
    Parameters
    Type Name Description
    float arg1

    The first value, expected to be greater

    float arg2

    The second value, expected to be less

    View Source

    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.

    Declaration
    public static void GreaterOrEqual(float arg1, float arg2, string message, params object[] args)
    Parameters
    Type Name Description
    float arg1

    The first value, expected to be greater

    float arg2

    The second value, expected to be less

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    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.

    Declaration
    [CLSCompliant(false)]
    public static void GreaterOrEqual(uint arg1, uint arg2)
    Parameters
    Type Name Description
    uint arg1

    The first value, expected to be greater

    uint arg2

    The second value, expected to be less

    View Source

    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.

    Declaration
    [CLSCompliant(false)]
    public static void GreaterOrEqual(uint arg1, uint arg2, string message, params object[] args)
    Parameters
    Type Name Description
    uint arg1

    The first value, expected to be greater

    uint arg2

    The second value, expected to be less

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    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.

    Declaration
    [CLSCompliant(false)]
    public static void GreaterOrEqual(ulong arg1, ulong arg2)
    Parameters
    Type Name Description
    ulong arg1

    The first value, expected to be greater

    ulong arg2

    The second value, expected to be less

    View Source

    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.

    Declaration
    [CLSCompliant(false)]
    public static void GreaterOrEqual(ulong arg1, ulong arg2, string message, params object[] args)
    Parameters
    Type Name Description
    ulong arg1

    The first value, expected to be greater

    ulong arg2

    The second value, expected to be less

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    IsAssignableFrom(Type, object?)

    Asserts that an object may be assigned a value of a given Type. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsAssignableFrom(Type expected, object? actual)
    Parameters
    Type Name Description
    Type expected

    The expected Type.

    object actual

    The object under examination

    View Source

    IsAssignableFrom(Type, object?, string, params object?[]?)

    Asserts that an object may be assigned a value of a given Type. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsAssignableFrom(Type expected, object? actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    Type expected

    The expected Type.

    object actual

    The object under examination

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    IsAssignableFrom<TExpected>(object?)

    Asserts that an object may be assigned a value of a given Type. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsAssignableFrom<TExpected>(object? actual)
    Parameters
    Type Name Description
    object actual

    The object under examination

    Type Parameters
    Name Description
    TExpected

    The expected Type.

    View Source

    IsAssignableFrom<TExpected>(object?, string, params object?[]?)

    Asserts that an object may be assigned a value of a given Type. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsAssignableFrom<TExpected>(object? actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    object actual

    The object under examination

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    Type Parameters
    Name Description
    TExpected

    The expected Type.

    View Source

    IsEmpty(IEnumerable)

    Assert that an array, list or other collection is empty. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsEmpty(IEnumerable collection)
    Parameters
    Type Name Description
    IEnumerable collection

    An array, list or other collection implementing ICollection

    View Source

    IsEmpty(IEnumerable, string, params object?[]?)

    Assert that an array, list or other collection is empty. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsEmpty(IEnumerable collection, string message, params object?[]? args)
    Parameters
    Type Name Description
    IEnumerable collection

    An array, list or other collection implementing ICollection

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    IsEmpty(string?)

    Assert that a string is empty. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsEmpty(string? aString)
    Parameters
    Type Name Description
    string aString

    The string to be tested

    View Source

    IsEmpty(string?, string, params object?[]?)

    Assert that a string is empty. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsEmpty(string? aString, string message, params object?[]? args)
    Parameters
    Type Name Description
    string aString

    The string to be tested

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    IsFalse(bool)

    Asserts that a condition is false. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsFalse(bool condition)
    Parameters
    Type Name Description
    bool condition

    The evaluated condition

    View Source

    IsFalse(bool, string, params object?[]?)

    Asserts that a condition is false. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsFalse(bool condition, string message, params object?[]? args)
    Parameters
    Type Name Description
    bool condition

    The evaluated condition

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    IsFalse(bool?)

    Asserts that a condition is false. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsFalse(bool? condition)
    Parameters
    Type Name Description
    bool? condition

    The evaluated condition

    View Source

    IsFalse(bool?, string, params object?[]?)

    Asserts that a condition is false. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsFalse(bool? condition, string message, params object?[]? args)
    Parameters
    Type Name Description
    bool? condition

    The evaluated condition

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    IsInstanceOf(Type, object?)

    Asserts that an object is an instance of a given type. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsInstanceOf(Type expected, object? actual)
    Parameters
    Type Name Description
    Type expected

    The expected Type

    object actual

    The object being examined

    View Source

    IsInstanceOf(Type, object?, string, params object?[]?)

    Asserts that an object is an instance of a given type. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsInstanceOf(Type expected, object? actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    Type expected

    The expected Type

    object actual

    The object being examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    IsInstanceOf<TExpected>(object?)

    Asserts that an object is an instance of a given type. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsInstanceOf<TExpected>(object? actual)
    Parameters
    Type Name Description
    object actual

    The object being examined

    Type Parameters
    Name Description
    TExpected

    The expected Type

    View Source

    IsInstanceOf<TExpected>(object?, string, params object?[]?)

    Asserts that an object is an instance of a given type. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsInstanceOf<TExpected>(object? actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    object actual

    The object being examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    Type Parameters
    Name Description
    TExpected

    The expected Type

    View Source

    IsNaN(double)

    Verifies that the double that is passed in is an NaN value. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsNaN(double aDouble)
    Parameters
    Type Name Description
    double aDouble

    The value that is to be tested

    View Source

    IsNaN(double, string, params object?[]?)

    Verifies that the double that is passed in is an NaN. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsNaN(double aDouble, string message, params object?[]? args)
    Parameters
    Type Name Description
    double aDouble

    The value that is to be tested

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    IsNaN(double?)

    Verifies that the double that is passed in is an NaN value. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsNaN(double? aDouble)
    Parameters
    Type Name Description
    double? aDouble

    The value that is to be tested

    View Source

    IsNaN(double?, string, params object?[]?)

    Verifies that the double that is passed in is an NaN value. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsNaN(double? aDouble, string message, params object?[]? args)
    Parameters
    Type Name Description
    double? aDouble

    The value that is to be tested

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    IsNotAssignableFrom(Type, object?)

    Asserts that an object may not be assigned a value of a given Type. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsNotAssignableFrom(Type expected, object? actual)
    Parameters
    Type Name Description
    Type expected

    The expected Type.

    object actual

    The object under examination

    View Source

    IsNotAssignableFrom(Type, object?, string, params object?[]?)

    Asserts that an object may not be assigned a value of a given Type. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsNotAssignableFrom(Type expected, object? actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    Type expected

    The expected Type.

    object actual

    The object under examination

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    IsNotAssignableFrom<TExpected>(object?)

    Asserts that an object may not be assigned a value of a given Type. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsNotAssignableFrom<TExpected>(object? actual)
    Parameters
    Type Name Description
    object actual

    The object under examination

    Type Parameters
    Name Description
    TExpected

    The expected Type.

    View Source

    IsNotAssignableFrom<TExpected>(object?, string, params object?[]?)

    Asserts that an object may not be assigned a value of a given Type. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsNotAssignableFrom<TExpected>(object? actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    object actual

    The object under examination

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    Type Parameters
    Name Description
    TExpected

    The expected Type.

    View Source

    IsNotEmpty(IEnumerable)

    Assert that an array, list or other collection is not empty. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsNotEmpty(IEnumerable collection)
    Parameters
    Type Name Description
    IEnumerable collection

    An array, list or other collection implementing ICollection

    View Source

    IsNotEmpty(IEnumerable, string, params object?[]?)

    Assert that an array, list or other collection is not empty. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsNotEmpty(IEnumerable collection, string message, params object?[]? args)
    Parameters
    Type Name Description
    IEnumerable collection

    An array, list or other collection implementing ICollection

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    IsNotEmpty(string?)

    Assert that a string is not empty. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsNotEmpty(string? aString)
    Parameters
    Type Name Description
    string aString

    The string to be tested

    View Source

    IsNotEmpty(string?, string, params object?[]?)

    Assert that a string is not empty. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsNotEmpty(string? aString, string message, params object?[]? args)
    Parameters
    Type Name Description
    string aString

    The string to be tested

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    IsNotInstanceOf(Type, object?)

    Asserts that an object is not an instance of a given type. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsNotInstanceOf(Type expected, object? actual)
    Parameters
    Type Name Description
    Type expected

    The expected Type

    object actual

    The object being examined

    View Source

    IsNotInstanceOf(Type, object?, string, params object?[]?)

    Asserts that an object is not an instance of a given type. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsNotInstanceOf(Type expected, object? actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    Type expected

    The expected Type

    object actual

    The object being examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    IsNotInstanceOf<TExpected>(object?)

    Asserts that an object is not an instance of a given type. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsNotInstanceOf<TExpected>(object? actual)
    Parameters
    Type Name Description
    object actual

    The object being examined

    Type Parameters
    Name Description
    TExpected

    The expected Type

    View Source

    IsNotInstanceOf<TExpected>(object?, string, params object?[]?)

    Asserts that an object is not an instance of a given type. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsNotInstanceOf<TExpected>(object? actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    object actual

    The object being examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    Type Parameters
    Name Description
    TExpected

    The expected Type

    View Source

    IsNotNull(object?)

    Verifies that the object that is passed in is not equal to null. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsNotNull(object? anObject)
    Parameters
    Type Name Description
    object anObject

    The object that is to be tested

    View Source

    IsNotNull(object?, string, params object?[]?)

    Verifies that the object that is passed in is not equal to null. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsNotNull(object? anObject, string message, params object?[]? args)
    Parameters
    Type Name Description
    object anObject

    The object that is to be tested

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    IsNull(object?)

    Verifies that the object that is passed in is equal to null. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsNull(object? anObject)
    Parameters
    Type Name Description
    object anObject

    The object that is to be tested

    View Source

    IsNull(object?, string, params object?[]?)

    Verifies that the object that is passed in is equal to null. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsNull(object? anObject, string message, params object?[]? args)
    Parameters
    Type Name Description
    object anObject

    The object that is to be tested

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    IsTrue(bool)

    Asserts that a condition is true. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsTrue(bool condition)
    Parameters
    Type Name Description
    bool condition

    The evaluated condition

    View Source

    IsTrue(bool, string, params object?[]?)

    Asserts that a condition is true. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsTrue(bool condition, string message, params object?[]? args)
    Parameters
    Type Name Description
    bool condition

    The evaluated condition

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    IsTrue(bool?)

    Asserts that a condition is true. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsTrue(bool? condition)
    Parameters
    Type Name Description
    bool? condition

    The evaluated condition

    View Source

    IsTrue(bool?, string, params object?[]?)

    Asserts that a condition is true. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void IsTrue(bool? condition, string message, params object?[]? args)
    Parameters
    Type Name Description
    bool? condition

    The evaluated condition

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Less(decimal, decimal)

    Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.

    Declaration
    public static void Less(decimal arg1, decimal arg2)
    Parameters
    Type Name Description
    decimal arg1

    The first value, expected to be less

    decimal arg2

    The second value, expected to be greater

    View Source

    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.

    Declaration
    public static void Less(decimal arg1, decimal arg2, string message, params object[] args)
    Parameters
    Type Name Description
    decimal arg1

    The first value, expected to be less

    decimal arg2

    The second value, expected to be greater

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Less(double, double)

    Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.

    Declaration
    public static void Less(double arg1, double arg2)
    Parameters
    Type Name Description
    double arg1

    The first value, expected to be less

    double arg2

    The second value, expected to be greater

    View Source

    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.

    Declaration
    public static void Less(double arg1, double arg2, string message, params object[] args)
    Parameters
    Type Name Description
    double arg1

    The first value, expected to be less

    double arg2

    The second value, expected to be greater

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Less(IComparable, IComparable)

    Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.

    Declaration
    public static void Less(IComparable arg1, IComparable arg2)
    Parameters
    Type Name Description
    IComparable arg1

    The first value, expected to be less

    IComparable arg2

    The second value, expected to be greater

    View Source

    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.

    Declaration
    public static void Less(IComparable arg1, IComparable arg2, string message, params object[] args)
    Parameters
    Type Name Description
    IComparable arg1

    The first value, expected to be less

    IComparable arg2

    The second value, expected to be greater

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Less(int, int)

    Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.

    Declaration
    public static void Less(int arg1, int arg2)
    Parameters
    Type Name Description
    int arg1

    The first value, expected to be less

    int arg2

    The second value, expected to be greater

    View Source

    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.

    Declaration
    public static void Less(int arg1, int arg2, string message, params object[] args)
    Parameters
    Type Name Description
    int arg1

    The first value, expected to be less

    int arg2

    The second value, expected to be greater

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Less(long, long)

    Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.

    Declaration
    public static void Less(long arg1, long arg2)
    Parameters
    Type Name Description
    long arg1

    The first value, expected to be less

    long arg2

    The second value, expected to be greater

    View Source

    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.

    Declaration
    public static void Less(long arg1, long arg2, string message, params object[] args)
    Parameters
    Type Name Description
    long arg1

    The first value, expected to be less

    long arg2

    The second value, expected to be greater

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Less(float, float)

    Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.

    Declaration
    public static void Less(float arg1, float arg2)
    Parameters
    Type Name Description
    float arg1

    The first value, expected to be less

    float arg2

    The second value, expected to be greater

    View Source

    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.

    Declaration
    public static void Less(float arg1, float arg2, string message, params object[] args)
    Parameters
    Type Name Description
    float arg1

    The first value, expected to be less

    float arg2

    The second value, expected to be greater

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Less(uint, uint)

    Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.

    Declaration
    [CLSCompliant(false)]
    public static void Less(uint arg1, uint arg2)
    Parameters
    Type Name Description
    uint arg1

    The first value, expected to be less

    uint arg2

    The second value, expected to be greater

    View Source

    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.

    Declaration
    [CLSCompliant(false)]
    public static void Less(uint arg1, uint arg2, string message, params object[] args)
    Parameters
    Type Name Description
    uint arg1

    The first value, expected to be less

    uint arg2

    The second value, expected to be greater

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Less(ulong, ulong)

    Verifies that the first value is less than the second value. If it is not, then an AssertionException is thrown.

    Declaration
    [CLSCompliant(false)]
    public static void Less(ulong arg1, ulong arg2)
    Parameters
    Type Name Description
    ulong arg1

    The first value, expected to be less

    ulong arg2

    The second value, expected to be greater

    View Source

    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.

    Declaration
    [CLSCompliant(false)]
    public static void Less(ulong arg1, ulong arg2, string message, params object[] args)
    Parameters
    Type Name Description
    ulong arg1

    The first value, expected to be less

    ulong arg2

    The second value, expected to be greater

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    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.

    Declaration
    public static void LessOrEqual(decimal arg1, decimal arg2)
    Parameters
    Type Name Description
    decimal arg1

    The first value, expected to be less

    decimal arg2

    The second value, expected to be greater

    View Source

    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.

    Declaration
    public static void LessOrEqual(decimal arg1, decimal arg2, string message, params object[] args)
    Parameters
    Type Name Description
    decimal arg1

    The first value, expected to be less

    decimal arg2

    The second value, expected to be greater

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    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.

    Declaration
    public static void LessOrEqual(double arg1, double arg2)
    Parameters
    Type Name Description
    double arg1

    The first value, expected to be less

    double arg2

    The second value, expected to be greater

    View Source

    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.

    Declaration
    public static void LessOrEqual(double arg1, double arg2, string message, params object[] args)
    Parameters
    Type Name Description
    double arg1

    The first value, expected to be less

    double arg2

    The second value, expected to be greater

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    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.

    Declaration
    public static void LessOrEqual(IComparable arg1, IComparable arg2)
    Parameters
    Type Name Description
    IComparable arg1

    The first value, expected to be less

    IComparable arg2

    The second value, expected to be greater

    View Source

    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.

    Declaration
    public static void LessOrEqual(IComparable arg1, IComparable arg2, string message, params object[] args)
    Parameters
    Type Name Description
    IComparable arg1

    The first value, expected to be less

    IComparable arg2

    The second value, expected to be greater

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    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.

    Declaration
    public static void LessOrEqual(int arg1, int arg2)
    Parameters
    Type Name Description
    int arg1

    The first value, expected to be less

    int arg2

    The second value, expected to be greater

    View Source

    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.

    Declaration
    public static void LessOrEqual(int arg1, int arg2, string message, params object[] args)
    Parameters
    Type Name Description
    int arg1

    The first value, expected to be less

    int arg2

    The second value, expected to be greater

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    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.

    Declaration
    public static void LessOrEqual(long arg1, long arg2)
    Parameters
    Type Name Description
    long arg1

    The first value, expected to be less

    long arg2

    The second value, expected to be greater

    View Source

    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.

    Declaration
    public static void LessOrEqual(long arg1, long arg2, string message, params object[] args)
    Parameters
    Type Name Description
    long arg1

    The first value, expected to be less

    long arg2

    The second value, expected to be greater

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    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.

    Declaration
    public static void LessOrEqual(float arg1, float arg2)
    Parameters
    Type Name Description
    float arg1

    The first value, expected to be less

    float arg2

    The second value, expected to be greater

    View Source

    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.

    Declaration
    public static void LessOrEqual(float arg1, float arg2, string message, params object[] args)
    Parameters
    Type Name Description
    float arg1

    The first value, expected to be less

    float arg2

    The second value, expected to be greater

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    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.

    Declaration
    [CLSCompliant(false)]
    public static void LessOrEqual(uint arg1, uint arg2)
    Parameters
    Type Name Description
    uint arg1

    The first value, expected to be less

    uint arg2

    The second value, expected to be greater

    View Source

    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.

    Declaration
    [CLSCompliant(false)]
    public static void LessOrEqual(uint arg1, uint arg2, string message, params object[] args)
    Parameters
    Type Name Description
    uint arg1

    The first value, expected to be less

    uint arg2

    The second value, expected to be greater

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    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.

    Declaration
    [CLSCompliant(false)]
    public static void LessOrEqual(ulong arg1, ulong arg2)
    Parameters
    Type Name Description
    ulong arg1

    The first value, expected to be less

    ulong arg2

    The second value, expected to be greater

    View Source

    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.

    Declaration
    [CLSCompliant(false)]
    public static void LessOrEqual(ulong arg1, ulong arg2, string message, params object[] args)
    Parameters
    Type Name Description
    ulong arg1

    The first value, expected to be less

    ulong arg2

    The second value, expected to be greater

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Negative(decimal)

    Asserts that a decimal is negative. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Negative(decimal actual)
    Parameters
    Type Name Description
    decimal actual

    The number to be examined

    View Source

    Negative(decimal, string, params object?[]?)

    Asserts that a decimal is negative. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Negative(decimal actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    decimal actual

    The number to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Negative(double)

    Asserts that a double is negative. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Negative(double actual)
    Parameters
    Type Name Description
    double actual

    The number to be examined

    View Source

    Negative(double, string, params object?[]?)

    Asserts that a double is negative. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Negative(double actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    double actual

    The number to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Negative(int)

    Asserts that an int is negative. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Negative(int actual)
    Parameters
    Type Name Description
    int actual

    The number to be examined

    View Source

    Negative(int, string, params object?[]?)

    Asserts that an int is negative. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Negative(int actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    int actual

    The number to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Negative(long)

    Asserts that a Long is negative. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Negative(long actual)
    Parameters
    Type Name Description
    long actual

    The number to be examined

    View Source

    Negative(long, string, params object?[]?)

    Asserts that a Long is negative. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Negative(long actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    long actual

    The number to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Negative(float)

    Asserts that a float is negative. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Negative(float actual)
    Parameters
    Type Name Description
    float actual

    The number to be examined

    View Source

    Negative(float, string, params object?[]?)

    Asserts that a float is negative. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Negative(float actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    float actual

    The number to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Negative(uint)

    Asserts that an unsigned int is negative. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    [CLSCompliant(false)]
    public static void Negative(uint actual)
    Parameters
    Type Name Description
    uint actual

    The number to be examined

    View Source

    Negative(uint, string, params object?[]?)

    Asserts that an unsigned int is negative. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    [CLSCompliant(false)]
    public static void Negative(uint actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    uint actual

    The number to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Negative(ulong)

    Asserts that an unsigned Long is negative. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    [CLSCompliant(false)]
    public static void Negative(ulong actual)
    Parameters
    Type Name Description
    ulong actual

    The number to be examined

    View Source

    Negative(ulong, string, params object?[]?)

    Asserts that an unsigned Long is negative. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    [CLSCompliant(false)]
    public static void Negative(ulong actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    ulong actual

    The number to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    NotNull(object?)

    Verifies that the object that is passed in is not equal to null. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void NotNull(object? anObject)
    Parameters
    Type Name Description
    object anObject

    The object that is to be tested

    View Source

    NotNull(object?, string, params object?[]?)

    Verifies that the object that is passed in is not equal to null. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void NotNull(object? anObject, string message, params object?[]? args)
    Parameters
    Type Name Description
    object anObject

    The object that is to be tested

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    NotZero(decimal)

    Asserts that a decimal is not zero. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void NotZero(decimal actual)
    Parameters
    Type Name Description
    decimal actual

    The number to be examined

    View Source

    NotZero(decimal, string, params object?[]?)

    Asserts that a decimal is not zero. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void NotZero(decimal actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    decimal actual

    The number to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    NotZero(double)

    Asserts that a double is not zero. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void NotZero(double actual)
    Parameters
    Type Name Description
    double actual

    The number to be examined

    View Source

    NotZero(double, string, params object?[]?)

    Asserts that a double is not zero. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void NotZero(double actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    double actual

    The number to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    NotZero(int)

    Asserts that an int is not zero. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void NotZero(int actual)
    Parameters
    Type Name Description
    int actual

    The number to be examined

    View Source

    NotZero(int, string, params object?[]?)

    Asserts that an int is not zero. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void NotZero(int actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    int actual

    The number to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    NotZero(long)

    Asserts that a Long is not zero. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void NotZero(long actual)
    Parameters
    Type Name Description
    long actual

    The number to be examined

    View Source

    NotZero(long, string, params object?[]?)

    Asserts that a Long is not zero. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void NotZero(long actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    long actual

    The number to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    NotZero(float)

    Asserts that a float is not zero. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void NotZero(float actual)
    Parameters
    Type Name Description
    float actual

    The number to be examined

    View Source

    NotZero(float, string, params object?[]?)

    Asserts that a float is not zero. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void NotZero(float actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    float actual

    The number to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    NotZero(uint)

    Asserts that an unsigned int is not zero. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    [CLSCompliant(false)]
    public static void NotZero(uint actual)
    Parameters
    Type Name Description
    uint actual

    The number to be examined

    View Source

    NotZero(uint, string, params object?[]?)

    Asserts that an unsigned int is not zero. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    [CLSCompliant(false)]
    public static void NotZero(uint actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    uint actual

    The number to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    NotZero(ulong)

    Asserts that an unsigned Long is not zero. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    [CLSCompliant(false)]
    public static void NotZero(ulong actual)
    Parameters
    Type Name Description
    ulong actual

    The number to be examined

    View Source

    NotZero(ulong, string, params object?[]?)

    Asserts that an unsigned Long is not zero. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    [CLSCompliant(false)]
    public static void NotZero(ulong actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    ulong actual

    The number to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Null(object?)

    Verifies that the object that is passed in is equal to null. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Null(object? anObject)
    Parameters
    Type Name Description
    object anObject

    The object that is to be tested

    View Source

    Null(object?, string, params object?[]?)

    Verifies that the object that is passed in is equal to null. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Null(object? anObject, string message, params object?[]? args)
    Parameters
    Type Name Description
    object anObject

    The object that is to be tested

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Positive(decimal)

    Asserts that a decimal is positive. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Positive(decimal actual)
    Parameters
    Type Name Description
    decimal actual

    The number to be examined

    View Source

    Positive(decimal, string, params object?[]?)

    Asserts that a decimal is positive. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Positive(decimal actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    decimal actual

    The number to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Positive(double)

    Asserts that a double is positive. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Positive(double actual)
    Parameters
    Type Name Description
    double actual

    The number to be examined

    View Source

    Positive(double, string, params object?[]?)

    Asserts that a double is positive. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Positive(double actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    double actual

    The number to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Positive(int)

    Asserts that an int is positive. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Positive(int actual)
    Parameters
    Type Name Description
    int actual

    The number to be examined

    View Source

    Positive(int, string, params object?[]?)

    Asserts that an int is positive. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Positive(int actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    int actual

    The number to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Positive(long)

    Asserts that a Long is positive. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Positive(long actual)
    Parameters
    Type Name Description
    long actual

    The number to be examined

    View Source

    Positive(long, string, params object?[]?)

    Asserts that a Long is positive. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Positive(long actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    long actual

    The number to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Positive(float)

    Asserts that a float is positive. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Positive(float actual)
    Parameters
    Type Name Description
    float actual

    The number to be examined

    View Source

    Positive(float, string, params object?[]?)

    Asserts that a float is positive. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Positive(float actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    float actual

    The number to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Positive(uint)

    Asserts that an unsigned int is positive. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    [CLSCompliant(false)]
    public static void Positive(uint actual)
    Parameters
    Type Name Description
    uint actual

    The number to be examined

    View Source

    Positive(uint, string, params object?[]?)

    Asserts that an unsigned int is positive. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    [CLSCompliant(false)]
    public static void Positive(uint actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    uint actual

    The number to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Positive(ulong)

    Asserts that an unsigned Long is positive. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    [CLSCompliant(false)]
    public static void Positive(ulong actual)
    Parameters
    Type Name Description
    ulong actual

    The number to be examined

    View Source

    Positive(ulong, string, params object?[]?)

    Asserts that an unsigned Long is positive. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    [CLSCompliant(false)]
    public static void Positive(ulong actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    ulong actual

    The number to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    True(bool)

    Asserts that a condition is true. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void True(bool condition)
    Parameters
    Type Name Description
    bool condition

    The evaluated condition

    View Source

    True(bool, string, params object?[]?)

    Asserts that a condition is true. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void True(bool condition, string message, params object?[]? args)
    Parameters
    Type Name Description
    bool condition

    The evaluated condition

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    True(bool?)

    Asserts that a condition is true. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void True(bool? condition)
    Parameters
    Type Name Description
    bool? condition

    The evaluated condition

    View Source

    True(bool?, string, params object?[]?)

    Asserts that a condition is true. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void True(bool? condition, string message, params object?[]? args)
    Parameters
    Type Name Description
    bool? condition

    The evaluated condition

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Zero(decimal)

    Asserts that a decimal is zero. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Zero(decimal actual)
    Parameters
    Type Name Description
    decimal actual

    The number to be examined

    View Source

    Zero(decimal, string, params object?[]?)

    Asserts that a decimal is zero. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Zero(decimal actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    decimal actual

    The number to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Zero(double)

    Asserts that a double is zero. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Zero(double actual)
    Parameters
    Type Name Description
    double actual

    The number to be examined

    View Source

    Zero(double, string, params object?[]?)

    Asserts that a double is zero. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Zero(double actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    double actual

    The number to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Zero(int)

    Asserts that an int is zero. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Zero(int actual)
    Parameters
    Type Name Description
    int actual

    The number to be examined

    View Source

    Zero(int, string, params object?[]?)

    Asserts that an int is zero. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Zero(int actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    int actual

    The number to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Zero(long)

    Asserts that a Long is zero. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Zero(long actual)
    Parameters
    Type Name Description
    long actual

    The number to be examined

    View Source

    Zero(long, string, params object?[]?)

    Asserts that a Long is zero. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Zero(long actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    long actual

    The number to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Zero(float)

    Asserts that a float is zero. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Zero(float actual)
    Parameters
    Type Name Description
    float actual

    The number to be examined

    View Source

    Zero(float, string, params object?[]?)

    Asserts that a float is zero. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    public static void Zero(float actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    float actual

    The number to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Zero(uint)

    Asserts that an unsigned int is zero. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    [CLSCompliant(false)]
    public static void Zero(uint actual)
    Parameters
    Type Name Description
    uint actual

    The number to be examined

    View Source

    Zero(uint, string, params object?[]?)

    Asserts that an unsigned int is zero. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    [CLSCompliant(false)]
    public static void Zero(uint actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    uint actual

    The number to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    View Source

    Zero(ulong)

    Asserts that an unsigned Long is zero. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    [CLSCompliant(false)]
    public static void Zero(ulong actual)
    Parameters
    Type Name Description
    ulong actual

    The number to be examined

    View Source

    Zero(ulong, string, params object?[]?)

    Asserts that an unsigned Long is zero. Returns without throwing an exception when inside a multiple assert block.

    Declaration
    [CLSCompliant(false)]
    public static void Zero(ulong actual, string message, params object?[]? args)
    Parameters
    Type Name Description
    ulong actual

    The number to be examined

    string message

    The message to display in case of failure

    object[] args

    Array of objects to be used in formatting the message

    • View Source
    In this article
    Back to top Generated by DocFX | Copyright (c) 2018- The NUnit Project - Licensed under CC BY-NC-SA 4.0