public void TestAdd2() { CopyOnWriteArraySet <Object> full = PopulatedSet(3); full.Add(1); Assert.AreEqual(3, full.Size()); }
public void TestAdd3() { CopyOnWriteArraySet <Object> full = PopulatedSet(3); full.Add(three); Assert.IsTrue(full.Contains(three)); }
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); }
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()); }