示例#1
0
        public void CopyToTest()
        {
            int[] array;

            using (FileBackedHashSet <int> hashSet = new FileBackedHashSet <int>())
            {
                for (int i = 1; i <= 100; i++)
                {
                    hashSet.Add(i);
                }

                Assert.AreEqual(hashSet.Count, 100);

                array = new int[hashSet.Count];
                hashSet.CopyTo(array, 0);

                foreach (int i in array)
                {
                    Assert.IsTrue(hashSet.Contains(i));
                }
            }
        }
示例#2
0
        public void CopyToTest()
        {
            int[] array;

            using (FileBackedHashSet<int> hashSet = new FileBackedHashSet<int>())
            {
                for (int i = 1; i <= 100; i++)
                    hashSet.Add(i);

                Assert.AreEqual(hashSet.Count, 100);

                array = new int[hashSet.Count];
                hashSet.CopyTo(array, 0);

                foreach (int i in array)
                    Assert.IsTrue(hashSet.Contains(i));
            }
        }