示例#1
0
        public void RemoveWhere()
        {
            var hs = new ThreadSafeSet <int>(Enumerable.Range(0, 1000));

            foreach (int i in hs.RemoveWhere(x => x % 2 == 0))
            {
                Assert.AreEqual(0, i % 2);
            }
            Assert.AreEqual(500, hs.Count);
            foreach (int i in hs)
            {
                Assert.AreEqual(1, i % 2);
            }
            hs.Clear();
            hs.AddRange(Enumerable.Range(0, 1000));
            Assert.AreEqual(1000, hs.Count);
            hs.AddRange(Enumerable.Range(0, 1500));
            Assert.AreEqual(1500, hs.Count);
        }