Ejemplo n.º 1
0
 public void TestSymmetricExceptWith()
 {
     var a = new RedBlackSetTester<int>(_odd.Where(UpTo100));
     Assert.That(() => a.SymmetricExceptWith(null), Throws.InstanceOf<ArgumentNullException>());
     a.SymmetricExceptWith(_even.Where(UpTo100));
     Assert.That(a.SetEquals(_numbers));
     a.Clear();
     a.AddRange(_primes);
     a.SymmetricExceptWith(_odd.Where(UpTo100).Concat(Enumerable.Repeat(2, 2)));
     Assert.That(a.Contains(_primes.First()), Is.False);
     Assert.That(_primes.Skip(1).All(p => !a.Contains(p)));
 }
Ejemplo n.º 2
0
 public void TestUnionWith()
 {
     var a = new RedBlackSetTester<int>(_odd.Where(UpTo100));
     Assert.That(() => a.SymmetricExceptWith(null), Throws.InstanceOf<ArgumentNullException>());
     int count = a.Count;
     a.UnionWith(_primes);
     Assert.That(a.Count, Is.EqualTo(count + 1));
     Assert.That(a.Contains(2));
     a.UnionWith(_even.Where(UpTo100));
     Assert.That(a.SetEquals(_numbers));
 }
Ejemplo n.º 3
0
 public void TestSetEquals()
 {
     var a = new RedBlackSetTester<int>(_odd.Where(UpTo100));
     Assert.That(() => a.SetEquals(null), Throws.InstanceOf<ArgumentNullException>());
     Assert.That(a.SetEquals(_numbers), Is.False);
     a.AddRange(_primes);
     Assert.That(a.SetEquals(_numbers), Is.False);
     a.AddRange(_even.Where(UpTo100));
     Assert.That(a.SetEquals(_numbers));
 }