public void UnionWithTest() { var someSet = new GenericSet <string>(); set.Add("One"); set.Add("Two"); set.Add("Three"); someSet.Add("Five"); someSet.Add("Six"); someSet.UnionWith(set); Assert.IsTrue(someSet.Contains("Three")); Assert.IsTrue(someSet.Contains("One")); Assert.IsTrue(someSet.Contains("Six")); Assert.IsTrue(someSet.Contains("Five")); Assert.IsTrue(someSet.Contains("Two")); Assert.AreEqual(5, someSet.Count); }
public void UnionWithTest() { var someSet = new GenericSet <int>(); set.Add(1); set.Add(2); set.Add(0); someSet.Add(0); someSet.Add(-1); someSet.Add(-4); someSet.UnionWith(set); Assert.IsTrue(someSet.Contains(-4)); Assert.IsTrue(someSet.Contains(2)); Assert.IsTrue(someSet.Contains(0)); Assert.IsTrue(someSet.Contains(-4)); Assert.IsTrue(someSet.Contains(-1)); Assert.AreEqual(5, someSet.Count); }
public void ContainsTest() { set.Add(1); set.Add(2); set.Add(3); Assert.IsTrue(set.Contains(1)); Assert.IsTrue(set.Contains(2)); Assert.IsTrue(set.Contains(3)); Assert.IsFalse(set.Contains(3121321)); Assert.IsFalse(set.Contains(131221)); }
public void ExceptWithTest() { var someSet = new GenericSet <int>(); set.Add(1); set.Add(2); set.Add(3); set.Add(4); set.Add(5); someSet.Add(1); someSet.Add(2); someSet.Add(3); someSet.Add(12); someSet.ExceptWith(set); Assert.IsFalse(someSet.Contains(1)); Assert.IsFalse(someSet.Contains(2)); Assert.IsFalse(someSet.Contains(3)); Assert.IsTrue(someSet.Contains(12)); Assert.AreEqual(1, someSet.Count); }
public void ExceptWithTest() { var someSet = new GenericSet <string>(); set.Add("One"); set.Add("Two"); set.Add("Three"); set.Add("Four"); set.Add("Five"); someSet.Add("Ten"); someSet.Add("Eleven"); someSet.Add("Twelve"); someSet.Add("Three"); someSet.ExceptWith(set); Assert.IsFalse(someSet.Contains("Three")); Assert.IsTrue(someSet.Contains("Eleven")); Assert.IsTrue(someSet.Contains("Twelve")); Assert.IsTrue(someSet.Contains("Ten")); Assert.AreEqual(3, someSet.Count); }
public void RemoveTest() { set.Add("One"); set.Add("Two"); set.Add("Three"); set.Add("Four"); set.Add("Five"); Assert.AreEqual(5, set.Count); Assert.IsTrue(set.Contains("One")); set.Remove("One"); Assert.AreEqual(4, set.Count); Assert.IsFalse(set.Contains("One")); Assert.IsTrue(set.Contains("Five")); }
public void IntersectWithTest() { var someSet = new GenericSet <int>(); set.Add(1); set.Add(2); set.Add(3); set.Add(4); set.Add(5); someSet.Add(1); someSet.Add(2); someSet.Add(3); someSet.Add(6); someSet.Add(7); someSet.IntersectWith(set); Assert.IsFalse(someSet.Contains(6)); Assert.IsFalse(someSet.Contains(7)); Assert.IsTrue(someSet.Contains(1)); Assert.IsTrue(someSet.Contains(2)); Assert.IsTrue(someSet.Contains(3)); Assert.AreEqual(3, someSet.Count); }
public void SymmetricExceptWithTest() { var someSet = new GenericSet <string>(); set.Add("1"); set.Add("2"); set.Add("3"); set.Add("4"); set.Add("5"); someSet.Add("1"); someSet.Add("2"); someSet.Add("3"); someSet.Add("4"); someSet.Add("5"); someSet.SymmetricExceptWith(set); Assert.IsFalse(someSet.Contains("1")); Assert.IsFalse(someSet.Contains("2")); Assert.IsFalse(someSet.Contains("3")); Assert.IsFalse(someSet.Contains("4")); Assert.IsFalse(someSet.Contains("5")); Assert.AreEqual(0, someSet.Count); }
public void IntersectWithTest() { var someSet = new GenericSet <string>(); set.Add("One"); set.Add("Two"); set.Add("Three"); set.Add("Four"); set.Add("Five"); someSet.Add("Ten"); someSet.Add("Twenty"); someSet.Add("Eleven"); someSet.Add("Twelve"); someSet.Add("Seven"); someSet.IntersectWith(set); Assert.IsFalse(someSet.Contains("Ten")); Assert.IsFalse(someSet.Contains("Twenty")); Assert.IsFalse(someSet.Contains("Eleven")); Assert.IsFalse(someSet.Contains("Twelve")); Assert.IsFalse(someSet.Contains("Seven")); Assert.AreEqual(0, someSet.Count); }
static void Main(string[] args) { var set = new GenericSet <int>(); set.Add(1); set.Add(2); set.Add(3); Console.WriteLine(set.Contains(2)); Console.WriteLine(set.Contains(3)); set.Remove(3); set.Remove(2); Console.WriteLine(set.Contains(1)); set.Remove(1); Console.WriteLine(set.Contains(3)); Console.WriteLine(set.Contains(2)); Console.WriteLine(set.Contains(1)); }
public void SymmetricExceptWithTest() { var someSet = new GenericSet <int>(); set.Add(1); set.Add(2); set.Add(0); set.Add(4); someSet.Add(5); someSet.Add(2); someSet.Add(0); someSet.Add(-1); someSet.Add(-4); someSet.SymmetricExceptWith(set); Assert.IsFalse(someSet.Contains(2)); Assert.IsFalse(someSet.Contains(0)); Assert.IsTrue(someSet.Contains(1)); Assert.IsTrue(someSet.Contains(-1)); Assert.IsTrue(someSet.Contains(4)); Assert.IsTrue(someSet.Contains(-4)); Assert.IsTrue(someSet.Contains(5)); Assert.AreEqual(5, someSet.Count); }