Class AssertionHelper
AssertionHelper is an optional base class for user tests, allowing the use of shorter ids for constraints and asserts and avoiding conflict with the definition of Is, from which it inherits much of its behavior, in certain mock object frameworks.
public class AssertionHelper : ConstraintFactory
- Inheritance
-
AssertionHelper
- Inherited Members
Constructors
AssertionHelper()
public AssertionHelper()
Methods
Expect(TestDelegate, IResolveConstraint)
Asserts that the code represented by a delegate throws an exception that satisfies the constraint provided.
public void Expect(TestDelegate code, IResolveConstraint constraint)
Parameters
code
TestDelegateA TestDelegate to be executed
constraint
IResolveConstraintA ThrowsConstraint used in the test
Expect(bool)
Asserts that a condition is true. If the condition is false the method throws an AssertionException. Works Identically to That(bool).
public void Expect(bool condition)
Parameters
condition
boolThe evaluated condition
Expect(bool, string)
Asserts that a condition is true. If the condition is false the method throws an AssertionException. Works Identically to That(bool, string).
public void Expect(bool condition, string message)
Parameters
condition
boolThe evaluated condition
message
stringThe message to display if the condition is false
Expect(bool, string, params object[])
Asserts that a condition is true. If the condition is false the method throws an AssertionException. Works Identically to That(bool, string, params object[]).
public void Expect(bool condition, string message, params object[] args)
Parameters
condition
boolThe evaluated condition
message
stringThe message to display if the condition is false
args
object[]Arguments to be used in formatting the message
Expect<TActual>(ActualValueDelegate<TActual>, IResolveConstraint)
Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.
public void Expect<TActual>(ActualValueDelegate<TActual> del, IResolveConstraint expr)
Parameters
del
ActualValueDelegate<TActual>An ActualValueDelegate returning the value to be tested
expr
IResolveConstraintA Constraint expression to be applied
Type Parameters
TActual
Expect<TActual>(ActualValueDelegate<TActual>, IResolveConstraint, string)
Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.
public void Expect<TActual>(ActualValueDelegate<TActual> del, IResolveConstraint expr, string message)
Parameters
del
ActualValueDelegate<TActual>An ActualValueDelegate returning the value to be tested
expr
IResolveConstraintA Constraint expression to be applied
message
stringThe message that will be displayed on failure
Type Parameters
TActual
Expect<TActual>(ActualValueDelegate<TActual>, IResolveConstraint, string, params object[])
Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.
public void Expect<TActual>(ActualValueDelegate<TActual> del, IResolveConstraint expr, string message, params object[] args)
Parameters
del
ActualValueDelegate<TActual>An ActualValueDelegate returning the value to be tested
expr
IResolveConstraintA Constraint expression to be applied
message
stringThe message that will be displayed on failure
args
object[]Arguments to be used in formatting the message
Type Parameters
TActual
Expect<TActual>(TActual, IResolveConstraint)
Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.
public static void Expect<TActual>(TActual actual, IResolveConstraint expression)
Parameters
actual
TActualThe actual value to test
expression
IResolveConstraintA Constraint to be applied
Type Parameters
TActual
Expect<TActual>(TActual, IResolveConstraint, string)
Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.
public static void Expect<TActual>(TActual actual, IResolveConstraint expression, string message)
Parameters
actual
TActualThe actual value to test
expression
IResolveConstraintA Constraint to be applied
message
stringThe message that will be displayed on failure
Type Parameters
TActual
Expect<TActual>(TActual, IResolveConstraint, string, params object[])
Apply a constraint to an actual value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.
public static void Expect<TActual>(TActual actual, IResolveConstraint expression, string message, params object[] args)
Parameters
actual
TActualThe actual value to test
expression
IResolveConstraintA Constraint expression to be applied
message
stringThe message that will be displayed on failure
args
object[]Arguments to be used in formatting the message
Type Parameters
TActual
Expect<TActual>(ref TActual, IResolveConstraint)
Apply a constraint to a referenced value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.
public static void Expect<TActual>(ref TActual actual, IResolveConstraint expression)
Parameters
actual
TActualThe actual value to test
expression
IResolveConstraintA Constraint to be applied
Type Parameters
TActual
Expect<TActual>(ref TActual, IResolveConstraint, string)
Apply a constraint to a referenced value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.
public static void Expect<TActual>(ref TActual actual, IResolveConstraint expression, string message)
Parameters
actual
TActualThe actual value to test
expression
IResolveConstraintA Constraint to be applied
message
stringThe message that will be displayed on failure
Type Parameters
TActual
Expect<TActual>(ref TActual, IResolveConstraint, string, params object[])
Apply a constraint to a referenced value, succeeding if the constraint is satisfied and throwing an assertion exception on failure.
public static void Expect<TActual>(ref TActual actual, IResolveConstraint expression, string message, params object[] args)
Parameters
actual
TActualThe actual value to test
expression
IResolveConstraintA Constraint to be applied
message
stringThe message that will be displayed on failure
args
object[]Arguments to be used in formatting the message
Type Parameters
TActual
Map(ICollection)
Returns a ListMapper based on a collection.
public ListMapper Map(ICollection original)
Parameters
original
ICollectionThe original collection