Class PropertyExistsConstraint
PropertyExistsConstraint tests that a named property exists on the object provided through Match.
Originally, PropertyConstraint provided this feature in addition to making optional tests on the value of the property. The two constraints are now separate.
Inherited Members
Namespace: NUnit.Framework.Constraints
Assembly: nunit.framework.dll
Syntax
public class PropertyExistsConstraint : Constraint, IConstraint, IResolveConstraint
Constructors
View SourcePropertyExistsConstraint(string)
Initializes a new instance of the PropertyExistsConstraint class.
Declaration
public PropertyExistsConstraint(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the property. |
Properties
View SourceDescription
The Description of what this constraint tests, for use in messages and in the ConstraintResult.
Declaration
public override string Description { get; }
Property Value
Type | Description |
---|---|
string |
Overrides
Methods
View SourceApplyTo<TActual>(TActual)
Test whether the property exists for a given object
Declaration
public override ConstraintResult ApplyTo<TActual>(TActual actual)
Parameters
Type | Name | Description |
---|---|---|
TActual | actual | The object to be tested |
Returns
Type | Description |
---|---|
ConstraintResult | True for success, false for failure |
Type Parameters
Name | Description |
---|---|
TActual |
Overrides
View SourceGetStringRepresentation()
Returns the string representation of the constraint.
Declaration
protected override string GetStringRepresentation()
Returns
Type | Description |
---|---|
string |