Edit

Share via


AttributeConstraint Class

Definition

AttributeConstraint tests that a specified attribute is present on a Type or other provider and that the value of the attribute satisfies some other constraint.

public class AttributeConstraint : NUnit.Framework.Constraints.PrefixConstraint
type AttributeConstraint = class
    inherit PrefixConstraint
Inheritance
AttributeConstraint

Constructors

AttributeConstraint(Type, Constraint)

Constructs an AttributeConstraint for a specified attriute Type and base constraint.

Fields

actual

The actual value being tested against a constraint

(Inherited from Constraint)
baseConstraint

The base constraint

(Inherited from PrefixConstraint)

Properties

And

Returns a ConstraintExpression by appending And to the current constraint.

(Inherited from Constraint)
DisplayName

The display name of this Constraint for use by ToString(). The default value is the name of the constraint with trailing "Constraint" removed. Derived classes may set this to another name in their constructors.

(Inherited from Constraint)
Or

Returns a ConstraintExpression by appending Or to the current constraint.

(Inherited from Constraint)
With

Returns a ConstraintExpression by appending And to the current constraint.

(Inherited from Constraint)

Methods

After(Int32, Int32) (Inherited from Constraint)
After(Int32) (Inherited from Constraint)
GetStringRepresentation()
Matches(Object)

Determines whether the Type or other provider has the expected attribute and if its value matches the additional constraint specified.

Matches<T>(ActualValueDelegate<T>) (Inherited from Constraint)
Matches<T>(T) (Inherited from Constraint)
ToString()

Default override of ToString returns the constraint DisplayName followed by any arguments within angle brackets.

(Inherited from Constraint)
WriteActualValueTo(MessageWriter)

Writes the actual value supplied to the specified writer.

WriteDescriptionTo(MessageWriter)

Writes a description of the attribute to the specified writer.

WriteMessageTo(MessageWriter)

Write the failure message to the MessageWriter provided as an argument. The default implementation simply passes the constraint and the actual value to the writer, which then displays the constraint description and the value. Constraints that need to provide additional details, such as where the error occured can override this.

(Inherited from Constraint)

Explicit Interface Implementations

IResolveConstraint.Resolve() (Inherited from Constraint)

Applies to