public void ViewSymmetricExceptWith () { var set = new SortedSet<int> { 1, 3, 5, 7, 9 }; var view = set.GetViewBetween (4, 8); view.SymmetricExceptWith (new [] { 4, 5, 6, 6, 4 }); Assert.IsTrue (view.SequenceEqual (new [] { 4, 6, 7 })); Assert.IsTrue (set.SequenceEqual (new [] { 1, 3, 4, 6, 7, 9 })); }
public void UnionWith () { var set = new SortedSet<int> { 1, 3, 5, 7, 9 }; set.UnionWith (new [] { 5, 7, 3, 7, 11, 7, 5, 2 }); Assert.IsTrue (set.SequenceEqual (new [] { 1, 2, 3, 5, 7, 9, 11 })); }
public void SymmetricExceptWith () { var set = new SortedSet<int> { 1, 3, 5, 7, 9 }; set.SymmetricExceptWith (new [] { 5, 7, 3, 7, 11, 7, 5, 2 }); Assert.IsTrue (set.SequenceEqual (new [] { 1, 2, 9, 11 })); }
public void ViewIntersectWith () { var set = new SortedSet<int> { 1, 3, 5, 7, 9 }; var view = set.GetViewBetween (4, 8); view.IntersectWith (new [] { 1, 5, 9 }); Assert.IsTrue (view.SequenceEqual (new [] { 5 })); Assert.IsTrue (set.SequenceEqual (new [] { 1, 3, 5, 9 })); view.IntersectWith (new [] { 1, 2 }); Assert.IsTrue (view.SequenceEqual (new int [] {})); Assert.IsTrue (set.SequenceEqual (new [] { 1, 3, 9 })); }
public void IntersectWith () { var set = new SortedSet<int> { 1, 3, 5, 7, 9 }; set.IntersectWith (new [] { 5, 7, 3, 7, 11, 7, 5, 2 }); Assert.IsTrue (set.SequenceEqual (new [] { 3, 5, 7 })); }
public void ViewClear () { var set = new SortedSet<int> { 1, 3, 5, 7, 9 }; var view = set.GetViewBetween (3, 7); view.Clear (); Assert.AreEqual (0, view.Count); Assert.IsTrue (set.SequenceEqual (new [] { 1, 9 })); }
public void RemoveWhere () { var set = new SortedSet<int> { 1, 2, 3, 4, 5, 6 }; Assert.AreEqual (3, set.RemoveWhere (i => i % 2 == 0)); Assert.AreEqual (3, set.Count); Assert.IsTrue (set.SequenceEqual (new [] { 1, 3, 5 })); }
public void GetEnumerator () { var set = new SortedSet<int> { 5, 3, 1, 2, 6, 4 }; Assert.IsTrue (set.SequenceEqual (new [] { 1, 2, 3, 4, 5, 6 })); }