Class ContainsConstraint
- Namespace
- NUnit.Framework.Constraints
- Assembly
- nunit.framework.dll
ContainsConstraint tests a whether a string contains a substring or a collection contains an object. It postpones the decision of which test to use until the type of the actual argument is known. This allows testing whether a string is contained in a collection or as a substring of another string using the same syntax.
public class ContainsConstraint : Constraint, IConstraint, IResolveConstraint
- Inheritance
-
ContainsConstraint
- Implements
- Inherited Members
Constructors
ContainsConstraint(object)
Initializes a new instance of the ContainsConstraint class.
public ContainsConstraint(object expected)
Parameters
expected
objectThe _expected.
Properties
Description
The Description of what this constraint tests, for use in messages and in the ConstraintResult.
public override string Description { get; }
Property Value
IgnoreCase
Flag the constraint to ignore case and return self.
public ContainsConstraint IgnoreCase { get; }
Property Value
Methods
ApplyTo<TActual>(TActual)
Test whether the constraint is satisfied by a given value
public override ConstraintResult ApplyTo<TActual>(TActual actual)
Parameters
actual
TActualThe value to be tested
Returns
- ConstraintResult
True for success, false for failure
Type Parameters
TActual