<PackageReference Include="NUnit" Version="3.2.0" />

CollectionSubsetConstraint

CollectionSubsetConstraint is used to determine whether one collection is a subset of another
using System; using System.Collections; namespace NUnit.Framework.Constraints { public class CollectionSubsetConstraint : CollectionItemsEqualConstraint { private IEnumerable expected; public override string Description => "subset of " + MsgUtils.FormatValue(expected); public CollectionSubsetConstraint(IEnumerable expected) : base(expected) { this.expected = expected; base.DisplayName = "SubsetOf"; } protected override bool Matches(IEnumerable actual) { return Tally(expected).TryRemove(actual); } public CollectionSubsetConstraint Using<TSubsetType, TSupersetType>(Func<TSubsetType, TSupersetType, bool> comparison) { Using(EqualityAdapter.For(comparison)); return this; } } }