CollectionContainsConstraint
CollectionContainsConstraint is used to test whether a collection
contains an expected object as a member.
using System;
using System.Collections;
using System;
using System.Collections;
namespace NUnit.Framework.Constraints
{
public class CollectionSupersetConstraint : CollectionItemsEqualConstraint
{
private IEnumerable _expected = expected;
public override string DisplayName => "SupersetOf";
public override string Description => "superset of " + MsgUtils.FormatValue(_expected);
public CollectionSupersetConstraint(IEnumerable expected)
: base(expected)
{
}
protected override bool Matches(IEnumerable actual)
{
return Tally(actual).TryRemove(_expected);
}
public CollectionSupersetConstraint Using<TSupersetType, TSubsetType>(Func<TSupersetType, TSubsetType, bool> comparison)
{
Func<TSubsetType, TSupersetType, bool> comparison2 = (TSubsetType actual, TSupersetType expected) => comparison(expected, actual);
Func<TSubsetType, TSupersetType, bool> comparison2;
Using(EqualityAdapter.For(comparison2));
return this;
}
}
}