PexAssert PexAssert PexAssert PexAssert Class

Definition

A static helper class that contains a set of methods to express assertions in parameterized unit tests.

public ref class PexAssert abstract sealed
[__Instrument]
public static class PexAssert
type PexAssert = class
Public Class PexAssert
Inheritance
PexAssertPexAssertPexAssertPexAssert
Attributes
__InstrumentAttribute

Remarks

PexAssert is similar in behavior to Assert. The methods make various statements about the code under test. If the statement is false, the method throws PexAssertFailedException. Any message in the exception object is displayed in IntelliTest Exploration window.

Methods

AreEqual(Boolean, Boolean) AreEqual(Boolean, Boolean) AreEqual(Boolean, Boolean) AreEqual(Boolean, Boolean)

Asserts that two bool values are equal.

AreEqual(String, String, Boolean, CultureInfo, String, Object[]) AreEqual(String, String, Boolean, CultureInfo, String, Object[]) AreEqual(String, String, Boolean, CultureInfo, String, Object[]) AreEqual(String, String, Boolean, CultureInfo, String, Object[])

Asserts that a culture-specific comparison of two strings is true, with a specified message in the exception object.

AreEqual(String, String, Boolean, String, Object[]) AreEqual(String, String, Boolean, String, Object[]) AreEqual(String, String, Boolean, String, Object[]) AreEqual(String, String, Boolean, String, Object[])

Asserts that two strings are equal with a specified message in the exception object.

AreEqual(String, String, Boolean, CultureInfo, String) AreEqual(String, String, Boolean, CultureInfo, String) AreEqual(String, String, Boolean, CultureInfo, String) AreEqual(String, String, Boolean, CultureInfo, String)

Asserts that a culture-specific comparison of two strings is true, with a specified message in the exception object.

AreEqual(Double, Double, Double, String, Object[]) AreEqual(Double, Double, Double, String, Object[]) AreEqual(Double, Double, Double, String, Object[]) AreEqual(Double, Double, Double, String, Object[])

Asserts that two double values are equal within a specified precision, with a specified message in the exception object.

AreEqual(String, String, Boolean, String) AreEqual(String, String, Boolean, String) AreEqual(String, String, Boolean, String) AreEqual(String, String, Boolean, String)

Asserts that two strings are equal with a specified message in the exception object.

AreEqual(String, String, Boolean, CultureInfo) AreEqual(String, String, Boolean, CultureInfo) AreEqual(String, String, Boolean, CultureInfo) AreEqual(String, String, Boolean, CultureInfo)

Asserts that a culture-specific comparison of two strings is true.

AreEqual(Single, Single, Single, String) AreEqual(Single, Single, Single, String) AreEqual(Single, Single, Single, String) AreEqual(Single, Single, Single, String)

Asserts that two float values are equal within a specified precision, with a specified message in the exception object.

AreEqual(Object, Object, String, Object[]) AreEqual(Object, Object, String, Object[]) AreEqual(Object, Object, String, Object[]) AreEqual(Object, Object, String, Object[])

Asserts that two object instances are equal, with a specified message in the exception object.

AreEqual(Single, Single, Single, String, Object[]) AreEqual(Single, Single, Single, String, Object[]) AreEqual(Single, Single, Single, String, Object[]) AreEqual(Single, Single, Single, String, Object[])

Asserts that two float values are equal within a specified precision, with a specified message in the exception object.

AreEqual(Boolean, Boolean, String, Object[]) AreEqual(Boolean, Boolean, String, Object[]) AreEqual(Boolean, Boolean, String, Object[]) AreEqual(Boolean, Boolean, String, Object[])

Asserts that two bool values are equal.

AreEqual(String, String, Boolean) AreEqual(String, String, Boolean) AreEqual(String, String, Boolean) AreEqual(String, String, Boolean)

Asserts that two strings are equal, using the Ordinal comparer.

AreEqual(Single, Single, Single) AreEqual(Single, Single, Single) AreEqual(Single, Single, Single) AreEqual(Single, Single, Single)

Asserts that two float values are equal within a specified precision.

AreEqual(Object, Object, String) AreEqual(Object, Object, String) AreEqual(Object, Object, String) AreEqual(Object, Object, String)

Asserts that two object instances are equal, with a specified message in the exception object.

AreEqual(Double, Double, Double) AreEqual(Double, Double, Double) AreEqual(Double, Double, Double) AreEqual(Double, Double, Double)

Asserts that two double values are equal within a specified precision.

AreEqual(Boolean, Boolean, String) AreEqual(Boolean, Boolean, String) AreEqual(Boolean, Boolean, String) AreEqual(Boolean, Boolean, String)

Asserts that two bool values are equal.

AreEqual(Object, Object) AreEqual(Object, Object) AreEqual(Object, Object) AreEqual(Object, Object)

Asserts that two object instances are equal.

AreEqual(Double, Double, Double, String) AreEqual(Double, Double, Double, String) AreEqual(Double, Double, Double, String) AreEqual(Double, Double, Double, String)

Asserts that two double values are equal within a specified precision, with a specified message in the exception object.

AreEqual<T>(T, T, String, Object[]) AreEqual<T>(T, T, String, Object[]) AreEqual<T>(T, T, String, Object[]) AreEqual<T>(T, T, String, Object[])

Asserts that two object instances with a specified type are equal, with a specified message in the exception object.

AreEqual<T>(T, T, String) AreEqual<T>(T, T, String) AreEqual<T>(T, T, String) AreEqual<T>(T, T, String)

Asserts that two object instances with a specified type are equal, with a specified message in the exception object.

AreEqual<T>(T, T, PexEqualityComparison<T>) AreEqual<T>(T, T, PexEqualityComparison<T>) AreEqual<T>(T, T, PexEqualityComparison<T>) AreEqual<T>(T, T, PexEqualityComparison<T>)

Asserts that two object instances with a specified type are equal, based on an EqualityComparison delegate.

AreEqual<T>(T, T) AreEqual<T>(T, T) AreEqual<T>(T, T) AreEqual<T>(T, T)

Asserts that two object instances with a specified type are equal.

AreNotEqual(String, String, Boolean, String) AreNotEqual(String, String, Boolean, String) AreNotEqual(String, String, Boolean, String) AreNotEqual(String, String, Boolean, String)

Asserts that two strings are not equal, with a specified message in the exception object.

AreNotEqual(String, String, Boolean, CultureInfo, String, Object[]) AreNotEqual(String, String, Boolean, CultureInfo, String, Object[]) AreNotEqual(String, String, Boolean, CultureInfo, String, Object[]) AreNotEqual(String, String, Boolean, CultureInfo, String, Object[])

Asserts that a culture-specific comparison of two strings is false, with a specified message in the exception object.

AreNotEqual(String, String, Boolean, String, Object[]) AreNotEqual(String, String, Boolean, String, Object[]) AreNotEqual(String, String, Boolean, String, Object[]) AreNotEqual(String, String, Boolean, String, Object[])

Asserts that two strings are not equal, with a specified message in the exception object.

AreNotEqual(String, String, Boolean, CultureInfo, String) AreNotEqual(String, String, Boolean, CultureInfo, String) AreNotEqual(String, String, Boolean, CultureInfo, String) AreNotEqual(String, String, Boolean, CultureInfo, String)

Asserts that a culture-specific comparison of two strings is false, with a specified message in the exception object.

AreNotEqual(Single, Single, Single, String, Object[]) AreNotEqual(Single, Single, Single, String, Object[]) AreNotEqual(Single, Single, Single, String, Object[]) AreNotEqual(Single, Single, Single, String, Object[])

Asserts that two float values are not equal within a specified precision, with a specified message in the exception object.

AreNotEqual(Double, Double, Double, String, Object[]) AreNotEqual(Double, Double, Double, String, Object[]) AreNotEqual(Double, Double, Double, String, Object[]) AreNotEqual(Double, Double, Double, String, Object[])

Asserts that two double values are not equal within a specified precision, with a specified message in the exception object.

AreNotEqual(String, String, Boolean, CultureInfo) AreNotEqual(String, String, Boolean, CultureInfo) AreNotEqual(String, String, Boolean, CultureInfo) AreNotEqual(String, String, Boolean, CultureInfo)

Asserts that a culture-specific comparison of two strings is false.

AreNotEqual(Single, Single, Single, String) AreNotEqual(Single, Single, Single, String) AreNotEqual(Single, Single, Single, String) AreNotEqual(Single, Single, Single, String)

Asserts that two float values are not equal within a specified precision, with a specified message in the exception object.

AreNotEqual(Object, Object, String, Object[]) AreNotEqual(Object, Object, String, Object[]) AreNotEqual(Object, Object, String, Object[]) AreNotEqual(Object, Object, String, Object[])

Asserts that two object instances are not equal, with a specified message in the exception object.

AreNotEqual(Double, Double, Double, String) AreNotEqual(Double, Double, Double, String) AreNotEqual(Double, Double, Double, String) AreNotEqual(Double, Double, Double, String)

Asserts that two double values are not equal within a specified precision, with a specified message in the exception object.

AreNotEqual(String, String, Boolean) AreNotEqual(String, String, Boolean) AreNotEqual(String, String, Boolean) AreNotEqual(String, String, Boolean)

Asserts that two strings are not equal.

AreNotEqual(Single, Single, Single) AreNotEqual(Single, Single, Single) AreNotEqual(Single, Single, Single) AreNotEqual(Single, Single, Single)

Asserts that two float values are not equal within a specified precision.

AreNotEqual(Object, Object, String) AreNotEqual(Object, Object, String) AreNotEqual(Object, Object, String) AreNotEqual(Object, Object, String)

Asserts that two object instances are not equal, with a specified message in the exception object.

AreNotEqual(Double, Double, Double) AreNotEqual(Double, Double, Double) AreNotEqual(Double, Double, Double) AreNotEqual(Double, Double, Double)

Asserts that two double values are not equal within a specified precision.

AreNotEqual(Object, Object) AreNotEqual(Object, Object) AreNotEqual(Object, Object) AreNotEqual(Object, Object)

Asserts that two object instances are not equal.

AreNotEqual<T>(T, T) AreNotEqual<T>(T, T) AreNotEqual<T>(T, T) AreNotEqual<T>(T, T)

Asserts that two object instances with a specified type are not equal.

AreNotEqual<T>(T, T, PexEqualityComparison<T>) AreNotEqual<T>(T, T, PexEqualityComparison<T>) AreNotEqual<T>(T, T, PexEqualityComparison<T>) AreNotEqual<T>(T, T, PexEqualityComparison<T>)

Asserts that two object instances with a specified type are not equal, based on an EqualityComparison delegate.

AreNotEqual<T>(T, T, String) AreNotEqual<T>(T, T, String) AreNotEqual<T>(T, T, String) AreNotEqual<T>(T, T, String)

Asserts that two object instances with a specified type are not equal, with a specified message in the exception object.

AreNotEqual<T>(T, T, String, Object[]) AreNotEqual<T>(T, T, String, Object[]) AreNotEqual<T>(T, T, String, Object[]) AreNotEqual<T>(T, T, String, Object[])

Asserts that two object instances with a specified type are not equal, with a specified message in the exception object.

ClearReached() ClearReached() ClearReached() ClearReached()

Clears the Reached event

CreateException() CreateException() CreateException() CreateException()

Creates the assumption/assertion exception instance

Fail(String, Object[]) Fail(String, Object[]) Fail(String, Object[]) Fail(String, Object[])

Asserts unconditionally, with a specified message and formatting for the exception object.

Fail(Exception, String) Fail(Exception, String) Fail(Exception, String) Fail(Exception, String)

Asserts unconditionally.

Fail(String) Fail(String) Fail(String) Fail(String)

Asserts unconditionally, with a specified message in the exception object.

Fail() Fail() Fail() Fail()

Asserts Fail unconditionally. Test will throw a PexAssertFailedException.

IsNotNull(Object) IsNotNull(Object) IsNotNull(Object) IsNotNull(Object)

Asserts that the object reference is not null.

IsNotNull(Object, String) IsNotNull(Object, String) IsNotNull(Object, String) IsNotNull(Object, String)

Asserts that the object reference is not null with a specified message in the exception object.

IsNotNull(Object, String, Object[]) IsNotNull(Object, String, Object[]) IsNotNull(Object, String, Object[]) IsNotNull(Object, String, Object[])

Asserts that the object reference is not null with a specified message in the exception object.

IsNull(Object) IsNull(Object) IsNull(Object) IsNull(Object)

Asserts that the object reference is null.

IsNull(Object, String) IsNull(Object, String) IsNull(Object, String) IsNull(Object, String)

Asserts that the object reference is null with a specified message in the exception object.

IsNull(Object, String, Object[]) IsNull(Object, String, Object[]) IsNull(Object, String, Object[]) IsNull(Object, String, Object[])

Asserts that the object reference is null with a specified message in the exception object. if the object reference is not null.

IsTrue(Boolean) IsTrue(Boolean) IsTrue(Boolean) IsTrue(Boolean)

Asserts that the condition evaluates to true.

IsTrue(Boolean, String) IsTrue(Boolean, String) IsTrue(Boolean, String) IsTrue(Boolean, String)

Asserts that the condition evaluates to true, with a specified message and format in the exception object.

IsTrue(Boolean, String, Object[]) IsTrue(Boolean, String, Object[]) IsTrue(Boolean, String, Object[]) IsTrue(Boolean, String, Object[])

Asserts that the condition evaluates to true, with a specified message in the exception object.

ReachEventually() ReachEventually() ReachEventually() ReachEventually()

Specifies that the default location in the program should be reached eventually.

ReachEventually(Int32) ReachEventually(Int32) ReachEventually(Int32) ReachEventually(Int32)

Specifies a location in the program that should be reached eventually.

ReachEventually(String) ReachEventually(String) ReachEventually(String) ReachEventually(String)

Specifies a location in the program that should be reached eventually.

Events

Reached Reached Reached Reached

Raised when the Reached method is invoked

Applies to

See also