示例#1
0
 public virtual void TestContainsAll()
 {
     var a = new Item(42);
     var b = new Item(a.id + 1);
     var c = new Item(b.id + 1);
     var a_ = new Item(a.id);
     var needle = new Collection4();
     var haystack = new Collection4();
     haystack.Add(a);
     needle.Add(a);
     needle.Add(b);
     Assert.IsFalse(haystack.ContainsAll(needle));
     needle.Remove(b);
     Assert.IsTrue(haystack.ContainsAll(needle));
     needle.Add(b);
     haystack.Add(b);
     Assert.IsTrue(haystack.ContainsAll(needle));
     needle.Add(a_);
     Assert.IsTrue(haystack.ContainsAll(needle));
     needle.Add(c);
     Assert.IsFalse(haystack.ContainsAll(needle));
     needle.Clear();
     Assert.IsTrue(haystack.ContainsAll(needle));
     haystack.Clear();
     Assert.IsTrue(haystack.ContainsAll(needle));
 }
示例#2
0
		public virtual void TestContainsAll()
		{
			Collection4TestCase.Item a = new Collection4TestCase.Item(42);
			Collection4TestCase.Item b = new Collection4TestCase.Item(a.id + 1);
			Collection4TestCase.Item c = new Collection4TestCase.Item(b.id + 1);
			Collection4TestCase.Item a_ = new Collection4TestCase.Item(a.id);
			Collection4 needle = new Collection4();
			Collection4 haystack = new Collection4();
			haystack.Add(a);
			needle.Add(a);
			needle.Add(b);
			Assert.IsFalse(haystack.ContainsAll(needle));
			needle.Remove(b);
			Assert.IsTrue(haystack.ContainsAll(needle));
			needle.Add(b);
			haystack.Add(b);
			Assert.IsTrue(haystack.ContainsAll(needle));
			needle.Add(a_);
			Assert.IsTrue(haystack.ContainsAll(needle));
			needle.Add(c);
			Assert.IsFalse(haystack.ContainsAll(needle));
			needle.Clear();
			Assert.IsTrue(haystack.ContainsAll(needle));
			haystack.Clear();
			Assert.IsTrue(haystack.ContainsAll(needle));
		}