コード例 #1
0
        public void TestAdd2()
        {
            CopyOnWriteArraySet <Object> full = PopulatedSet(3);

            full.Add(1);
            Assert.AreEqual(3, full.Size());
        }
コード例 #2
0
        public void TestAdd3()
        {
            CopyOnWriteArraySet <Object> full = PopulatedSet(3);

            full.Add(three);
            Assert.IsTrue(full.Contains(three));
        }
コード例 #3
0
        static CopyOnWriteArraySet <Object> PopulatedSet(int n)
        {
            CopyOnWriteArraySet <Object> a = new CopyOnWriteArraySet <Object>();

            Assert.IsTrue(a.IsEmpty());

            for (int i = 0; i < n; ++i)
            {
                a.Add(i);
            }

            Assert.IsFalse(a.IsEmpty());
            Assert.AreEqual(n, a.Size());
            return(a);
        }
コード例 #4
0
        public void TestEquals()
        {
            CopyOnWriteArraySet <Object> a = PopulatedSet(3);
            CopyOnWriteArraySet <Object> b = PopulatedSet(3);

            Assert.IsTrue(a.Equals(b));
            Assert.IsTrue(b.Equals(a));
            Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
            a.Add(m1);
            Assert.IsFalse(a.Equals(b));
            Assert.IsFalse(b.Equals(a));
            b.Add(m1);
            Assert.IsTrue(a.Equals(b));
            Assert.IsTrue(b.Equals(a));
            Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
        }