Exemple #1
0
 public void TestIsProperSubsetOf()
 {
     var a = new RedBlackSetTester<int>();
     Assert.That(() => a.IsProperSubsetOf(null), Throws.InstanceOf<ArgumentNullException>());
     Assert.That(a.IsProperSubsetOf(Enumerable.Range(1, 1)));
     Assert.That(a.IsProperSubsetOf(Enumerable.Empty<int>()), Is.False);
     a.AddRange(_primes);
     Assert.That(a.IsProperSubsetOf(_numbers));
     a.AddRange(_even.Where(UpTo100));
     Assert.That(a.IsProperSubsetOf(_numbers));
     a.AddRange(_odd.Where(UpTo100));
     Assert.That(a.IsProperSubsetOf(_numbers), Is.False);
 }
Exemple #2
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)));
 }
Exemple #3
0
 public void TestOverlap()
 {
     var a = new RedBlackSetTester<int>(_odd);
     Assert.That(() => a.Overlaps(null), Throws.InstanceOf<ArgumentNullException>());
     Assert.That(a.Overlaps(_even), Is.False);
     a.AddRange(_primes);
     Assert.That(a.Overlaps(_even));
 }
Exemple #4
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));
 }
Exemple #5
0
 public void TestIsSupersetOf()
 {
     var a = new RedBlackSetTester<int>();
     Assert.That(() => a.IsSupersetOf(null), Throws.InstanceOf<ArgumentNullException>());
     Assert.That(a.IsSupersetOf(Enumerable.Empty<int>()));
     Assert.That(a.IsSupersetOf(Enumerable.Range(1, 1)), Is.False);
     a.AddRange(_odd);
     Assert.That(a.IsSupersetOf(_primes), Is.False);
     a.Add(2);
     Assert.That(a.IsSupersetOf(_primes));
 }