Example #1
0
		public virtual void TestContains()
		{
			object a = new object();
			Collection4 c = new Collection4();
			c.Add(new object());
			Assert.IsFalse(c.Contains(a));
			c.Add(a);
			Assert.IsTrue(c.Contains(a));
			c.Remove(a);
			Assert.IsFalse(c.Contains(a));
		}
Example #2
0
 private IEnumerable RandomPositiveIntegersWithoutDuplicates(int keyCount)
 {
     var generator = Generators.Take(keyCount, Streams.RandomIntegers());
     var res = new Collection4();
     var i = generator.GetEnumerator();
     while (i.MoveNext())
     {
         var currentInteger = (int) i.Current;
         if (currentInteger < 0)
         {
             currentInteger = -currentInteger;
         }
         if (!res.Contains(currentInteger))
         {
             res.Add(currentInteger);
         }
     }
     return res;
 }
Example #3
0
		private void AssertNotContainsNull(Collection4 c)
		{
			Assert.IsFalse(c.Contains(null));
			Assert.IsNull(c.Get(null));
			int size = c.Size();
			c.Ensure(null);
			Assert.AreEqual(size + 1, c.Size());
			c.Remove(null);
			Assert.AreEqual(size, c.Size());
		}
Example #4
0
 private void AssertContainsNull(Collection4 c)
 {
     Assert.IsTrue(c.Contains(null));
     Assert.IsNull(c.Get(null));
     var size = c.Size();
     c.Ensure(null);
     Assert.AreEqual(size, c.Size());
 }