Esempio n. 1
0
 public void TestIntersectWith()
 {
     var a = new RedBlackSetTester<int>(_even);
     Assert.That(() => a.IntersectWith(null), Throws.InstanceOf<ArgumentNullException>());
     a.IntersectWith(_primes);
     Assert.That(a, Has.Count.EqualTo(1));
     Assert.That(a.Contains(2));
     a.IntersectWith(_odd);
     Assert.That(a, Is.Empty);
 }
Esempio 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));
 }
Esempio n. 3
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)));
 }