//Test 19
            //  other is set and set is single-item and set contains set
            public static void SetupTest19(out HashSet <IEnumerable> set, out IEnumerable <IEnumerable> other)
            {
                IEnumerableEqualityComparer comparer = new IEnumerableEqualityComparer();

                set = new HashSet <IEnumerable>(comparer);
                comparer.setSelf(set);
                set.Add(set);
                other = set;
            }
            //Test 2
            //  Item is the set and item is not in the set
            public static void SetupTest2(out HashSet <IEnumerable> set, out IEnumerable item)
            {
                List <int> item1 = new List <int>(new int[] { 1, 2 });
                List <int> item2 = new List <int>(new int[] { 2, -1 });

                IEnumerableEqualityComparer comparer = new IEnumerableEqualityComparer();

                set = new HashSet <IEnumerable>(comparer);
                comparer.setSelf(set);
                set.Add(item1);
                set.Add(item2);

                item = set;
            }
            //Test 21
            //  other is set and set is multi-item and set contains set
            public static void SetupTest21(out HashSet <IEnumerable> set, out IEnumerable <IEnumerable> other)
            {
                List <int> item1 = new List <int>(new int[] { 1, 3, 5, -2 });
                List <int> item2 = new List <int>(new int[] { 1, -3, 5, -2 });

                IEnumerableEqualityComparer comparer = new IEnumerableEqualityComparer();

                set = new HashSet <IEnumerable>(comparer);
                comparer.setSelf(set);
                set.Add(item1);
                set.Add(item2);
                set.Add(set);

                other = set;
            }
예제 #4
0
        public static void ICollectionAdd_Test7()
        {
            List <int> item1 = new List <int>(new int[] { 1, 2 });
            List <int> item2 = new List <int>(new int[] { 2, -1 });

            IEnumerableEqualityComparer comparer = new IEnumerableEqualityComparer();
            HashSet <IEnumerable>       hashSet  = new HashSet <IEnumerable>(comparer);

            comparer.setSelf(hashSet);
            hashSet.Add(item1);
            hashSet.Add(item2);

            IEnumerable item = hashSet;

            ((ICollection <IEnumerable>)hashSet).Add(item);

            HashSetTestSupport <IEnumerable> .VerifyHashSet(hashSet, new IEnumerable[] { item1, item2, item }, hashSet.Comparer);
        }
예제 #5
0
        public static void HashSet_Set_Remove_ItemNotInSet()
        {
            List <int> item1 = new List <int>(new int[] { 1, 2 });
            List <int> item2 = new List <int>(new int[] { 2, -1 });

            IEnumerableEqualityComparer comparer = new IEnumerableEqualityComparer();
            HashSet <IEnumerable>       hashSet  = new HashSet <IEnumerable>(comparer);

            comparer.setSelf(hashSet);
            hashSet.Add(item1);
            hashSet.Add(item2);

            IEnumerable item    = hashSet;
            bool        removed = hashSet.Remove(item);

            Assert.False(removed); //"Error: Remove returned wrong value"

            HashSetTestSupport <IEnumerable> .VerifyHashSet(hashSet, new IEnumerable[] { item1, item2 }, hashSet.Comparer);
        }
        public static void Contains_Test7()
        {
            List <int> item1 = new List <int>(new int[] { 1, 2 });
            List <int> item2 = new List <int>(new int[] { 2, -1 });

            IEnumerableEqualityComparer comparer = new IEnumerableEqualityComparer();
            HashSet <IEnumerable>       hashSet  = new HashSet <IEnumerable>(comparer);

            comparer.setSelf(hashSet);
            hashSet.Add(item1);
            hashSet.Add(item2);

            IEnumerable item     = hashSet;
            bool        contains = hashSet.Contains(item);

            Assert.False(contains); //"Error: Contains returned wrong value"

            HashSetTestSupport <IEnumerable> .VerifyHashSet(hashSet, new IEnumerable[] { item1, item2 }, hashSet.Comparer);
        }
            //Test 2
            //  Item is the set and item is not in the set
            public static void SetupTest2(out HashSet<IEnumerable> set, out IEnumerable item)
            {
                List<int> item1 = new List<int>(new int[] { 1, 2 });
                List<int> item2 = new List<int>(new int[] { 2, -1 });

                IEnumerableEqualityComparer comparer = new IEnumerableEqualityComparer();
                set = new HashSet<IEnumerable>(comparer);
                comparer.setSelf(set);
                set.Add(item1);
                set.Add(item2);

                item = set;
            }
            //Test 21
            //  other is set and set is multi-item and set contains set
            public static void SetupTest21(out HashSet<IEnumerable> set, out IEnumerable<IEnumerable> other)
            {
                List<int> item1 = new List<int>(new int[] { 1, 3, 5, -2 });
                List<int> item2 = new List<int>(new int[] { 1, -3, 5, -2 });

                IEnumerableEqualityComparer comparer = new IEnumerableEqualityComparer();
                set = new HashSet<IEnumerable>(comparer);
                comparer.setSelf(set);
                set.Add(item1);
                set.Add(item2);
                set.Add(set);

                other = set;
            }
 //Test 19
 //  other is set and set is single-item and set contains set
 public static void SetupTest19(out HashSet<IEnumerable> set, out IEnumerable<IEnumerable> other)
 {
     IEnumerableEqualityComparer comparer = new IEnumerableEqualityComparer();
     set = new HashSet<IEnumerable>(comparer);
     comparer.setSelf(set);
     set.Add(set);
     other = set;
 }
예제 #10
0
        public static void Contains_Test7()
        {
            List<int> item1 = new List<int>(new int[] { 1, 2 });
            List<int> item2 = new List<int>(new int[] { 2, -1 });

            IEnumerableEqualityComparer comparer = new IEnumerableEqualityComparer();
            HashSet<IEnumerable> hashSet = new HashSet<IEnumerable>(comparer);
            comparer.setSelf(hashSet);
            hashSet.Add(item1);
            hashSet.Add(item2);

            IEnumerable item = hashSet;
            bool contains = hashSet.Contains(item);
            Assert.False(contains); //"Error: Contains returned wrong value"

            HashSetTestSupport<IEnumerable>.VerifyHashSet(hashSet, new IEnumerable[] { item1, item2 }, hashSet.Comparer);
        }