Table of Contents

Class ExactCountConstraint

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

ExactCountConstraint applies another constraint to each item in a collection, succeeding only if a specified number of items succeed.

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

Constructors

ExactCountConstraint(int)

Construct a standalone ExactCountConstraint

public ExactCountConstraint(int expectedCount)

Parameters

expectedCount int

ExactCountConstraint(int, IConstraint)

Construct an ExactCountConstraint on top of an existing constraint

public ExactCountConstraint(int expectedCount, IConstraint itemConstraint)

Parameters

expectedCount int
itemConstraint IConstraint

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)

Apply the item constraint to each item in the collection, succeeding only if the expected number of items pass.

public override ConstraintResult ApplyTo<TActual>(TActual actual)

Parameters

actual TActual

The value to be tested

Returns

ConstraintResult

A ConstraintResult

Type Parameters

TActual