CollectionSupersetConstraint
CollectionSupersetConstraint is used to determine whether
one collection is a superset of another
using System.Collections;
namespace NUnit.Framework.Constraints
{
public class CollectionSupersetConstraint : CollectionItemsEqualConstraint
{
private IEnumerable expected;
public override string Description => "superset of " + MsgUtils.FormatValue(expected);
public CollectionSupersetConstraint(IEnumerable expected)
: base(expected)
{
this.expected = expected;
base.DisplayName = "SupersetOf";
}
protected override bool Matches(IEnumerable actual)
{
return Tally(actual).TryRemove(expected);
}
}
}