public void DefaultComparerOfTypeIsUsedRegardlessOfCollection() { ICollection <string> set = HashSetProvider.NewHashSet <string>( StringComparer.OrdinalIgnoreCase, "abc"); Assert.IsTrue(set.Contains("ABC")); Assert.AreEqual(1, set.Count); Assert.IsFalse(set.SequenceEqual(new[] { "ABC" })); }
public void SetWithDifferentComparer() { ICollection <string> sourceAsCollection = HashSetProvider.NewHashSet (StringComparer.OrdinalIgnoreCase, "foo", "bar", "baz"); IEnumerable <string> sourceAsSequence = sourceAsCollection; Assert.IsTrue(sourceAsCollection.Contains("BAR")); Assert.IsTrue(sourceAsSequence.Contains("BAR")); // This is the line that concerns me Assert.IsFalse(sourceAsSequence.Contains("BAR", null)); Assert.IsFalse(sourceAsSequence.Contains("BAR", StringComparer.Ordinal)); }