Exemple #1
0
        public void TestClear()
        {
            var testSet = new ThreadSafeSet <string>(new HashSet <string>());


            testSet.Add("a");
            testSet.Add("b");
            Assert.IsTrue(testSet.Count > 0, "count before clear");
            testSet.Clear();
            Assert.IsFalse(testSet.Count > 0, "count after clear");
        }
Exemple #2
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);
        }
 /// <summary>Removes all items from the store.</summary>
 public void Clear()
 {
     _store.Clear();
 }