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
codeTestDelegateA TestDelegate to be executed
constraintIResolveConstraintA 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
conditionboolThe 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
conditionboolThe evaluated condition
messagestringThe 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
conditionboolThe evaluated condition
messagestringThe message to display if the condition is false
argsobject[]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
delActualValueDelegate<TActual>An ActualValueDelegate returning the value to be tested
exprIResolveConstraintA 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
delActualValueDelegate<TActual>An ActualValueDelegate returning the value to be tested
exprIResolveConstraintA Constraint expression to be applied
messagestringThe message that will be displayed on failure
Type Parameters
TActual
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
delActualValueDelegate<TActual>An ActualValueDelegate returning the value to be tested
exprIResolveConstraintA Constraint expression to be applied
messagestringThe message that will be displayed on failure
argsobject[]Arguments to be used in formatting the message
Type Parameters
TActual
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
actualTActualThe actual value to test
expressionIResolveConstraintA 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
actualTActualThe actual value to test
expressionIResolveConstraintA Constraint to be applied
messagestringThe 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
actualTActualThe actual value to test
expressionIResolveConstraintA Constraint expression to be applied
messagestringThe message that will be displayed on failure
argsobject[]Arguments to be used in formatting the message
Type Parameters
TActual
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
actualTActualThe actual value to test
expressionIResolveConstraintA 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
actualTActualThe actual value to test
expressionIResolveConstraintA Constraint to be applied
messagestringThe 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
actualTActualThe actual value to test
expressionIResolveConstraintA Constraint to be applied
messagestringThe message that will be displayed on failure
argsobject[]Arguments to be used in formatting the message
Type Parameters
TActual
Map(ICollection)
Returns a ListMapper based on a collection.
public ListMapper Map(ICollection original)
Parameters
originalICollectionThe original collection