public void Test_Tree_Double_Add() { Set s = new Set(SetImplementation.Tree); Assert.AreEqual(0, s.Count); s.Add("one"); Assert.AreEqual(1, s.Count); s.Add("one"); }
private void all(SetImplementation i) { Set s = new Set(i); Assert.AreEqual(0, s.Count); s.Add("one"); Assert.AreEqual(1, s.Count); Assert.IsTrue(s.Contains("one")); Assert.IsTrue(!s.Contains("two")); Assert.IsTrue(!s.Contains("three")); s.Add("two"); Assert.AreEqual(2, s.Count); Assert.IsTrue(s.Contains("one")); Assert.IsTrue(s.Contains("two")); Assert.IsTrue(!s.Contains("three")); s.Remove("one"); Assert.AreEqual(1, s.Count); Assert.IsTrue(!s.Contains("one")); Assert.IsTrue(s.Contains("two")); Assert.IsTrue(!s.Contains("three")); s.Add("one"); Assert.AreEqual(2, s.Count); Assert.IsTrue(s.Contains("one")); Assert.IsTrue(s.Contains("two")); Assert.IsTrue(!s.Contains("three")); s.Add("one"); Assert.AreEqual(2, s.Count); Assert.IsTrue(s.Contains("one")); Assert.IsTrue(s.Contains("two")); Assert.IsTrue(!s.Contains("three")); int count = 0; foreach (string str in s) { count++; Assert.AreEqual(3, str.Length); } Assert.AreEqual(2, count); }