Table of Contents

Class PropertyExistsConstraint

Namespace
NUnit.Framework.Constraints
Assembly
nunit.framework.dll

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 vaue of the property. The two constraints are now separate.

public class PropertyExistsConstraint : Constraint, IConstraint, IResolveConstraint
Inheritance
PropertyExistsConstraint
Implements
Inherited Members

Constructors

PropertyExistsConstraint(string)

Initializes a new instance of the PropertyExistConstraint class.

public PropertyExistsConstraint(string name)

Parameters

name string

The name of the property.

Properties

Description

The Description of what this constraint tests, for use in messages and in the ConstraintResult.

public override string Description { get; }

Property Value

string

Methods

ApplyTo<TActual>(TActual)

Test whether the property exists for a given object

public override ConstraintResult ApplyTo<TActual>(TActual actual)

Parameters

actual TActual

The object to be tested

Returns

ConstraintResult

True for success, false for failure

Type Parameters

TActual

GetStringRepresentation()

Returns the string representation of the constraint.

protected override string GetStringRepresentation()

Returns

string