Beispiel #1
0
        private void Validate_SymmetricExceptWith(PooledSet <T> set, Span <T> span)
        {
            IEqualityComparer <T> comparer = set.Comparer;
            PooledSet <T>         expected = new PooledSet <T>(comparer);

            RegisterForDispose(expected);
            foreach (T element in span)
            {
                if (!set.Contains(element))
                {
                    expected.Add(element);
                }
            }
            foreach (T element in set)
            {
                if (!SpanContains(span, element, comparer))
                {
                    expected.Add(element);
                }
            }
            set.SymmetricExceptWith(span);
            Assert.Equal(expected.Count, set.Count);
            Assert.True(expected.SetEquals(set));
        }