ExactCountOperator
Represents a constraint that succeeds if the specified
count of members of a collection match a base constraint.
namespace NUnit.Framework.Constraints
{
public class ExactCountOperator : SelfResolvingOperator
{
private int expectedCount;
public ExactCountOperator(int expectedCount)
{
left_precedence = 1;
right_precedence = 10;
this.expectedCount = expectedCount;
}
public override void Reduce(ConstraintBuilder.ConstraintStack stack)
{
if (base.RightContext == null || base.RightContext is BinaryOperator)
stack.Push(new ExactCountConstraint(expectedCount));
else
stack.Push(new ExactCountConstraint(expectedCount, stack.Pop()));
}
}
}