public void Ctor_CustomComparer() { var comparer = new AbsoluteValueEqualityComparer(); var set = new Set <int>(comparer); set.Add(1); set.Add(-1); Assert.That(set.Count, Is.EqualTo(1)); }
public void Ctor_CustomComparerWithICollectionInitialization() { var data = Enumerable.Range(-50, 100).ToArray(); var comparer = new AbsoluteValueEqualityComparer(); var set = new Set <int>(data, comparer); var expected = data.Where(v => v <= 0); CollectionAssert.AreEquivalent(expected, set); }