public void UnionWithTest() { MySet <string> s = new MySet <string>(); s.Add("a"); s.Add("b"); MySet <string> c = new MySet <string>(); c.Add("a"); c.Add("b"); c.Add("c"); var actual = c.UnionWith(s); Assert.IsTrue(actual.Contains("a") & actual.Contains("b") & actual.Contains("c") & c.Count == 3); }
public void UnionIsCorrect() { var set = new MySet <int>() { 0, 2, 4, 5, 6, 8 }; var list = new List <int>() { 0, 1, 2, 3, 4, 6, 7, 8 }; set.UnionWith(list); Assert.IsTrue(set.Contains(0)); Assert.IsTrue(set.Contains(1)); Assert.IsTrue(set.Contains(2)); Assert.IsTrue(set.Contains(3)); Assert.IsTrue(set.Contains(4)); Assert.IsTrue(set.Contains(5)); Assert.IsTrue(set.Contains(6)); Assert.IsTrue(set.Contains(7)); Assert.IsTrue(set.Contains(8)); Assert.AreEqual(9, set.Count); }
public void UnionWithTest() { set.Add(2); set.UnionWith(list); Assert.IsTrue(set.Contains(1)); }