Esempio n. 1
0
        private void Validate_IsProperSubsetOf(PooledSet <T> set, Span <T> span)
        {
            bool setContainsValueNotInEnumerable = false;
            bool enumerableContainsValueNotInSet = false;
            IEqualityComparer <T> comparer       = set.Comparer;

            foreach (T value in set) // Every value in Set must be in Enumerable
            {
                if (!SpanContains(span, value, comparer))
                {
                    setContainsValueNotInEnumerable = true;
                    break;
                }
            }
            foreach (T value in span) // Enumerable must contain at least one value not in Set
            {
                if (!set.Contains(value))
                {
                    enumerableContainsValueNotInSet = true;
                    break;
                }
            }
            Assert.Equal(!setContainsValueNotInEnumerable && enumerableContainsValueNotInSet, set.IsProperSubsetOf(span));
        }