示例#1
0
        public void Add_TwoEqualEntities_SizeEqualsOn(IHashSet <int> hasSet)
        {
            hasSet.Add(1);

            Assert.That(hasSet.Add(1), Is.EqualTo(false));
            Assert.That(hasSet.Count, Is.EqualTo(1));
        }
示例#2
0
        public void Containts_AddedFourItems_ForLastContaintsIsTrue(IHashSet <int> hasSet)
        {
            hasSet.Add(1);
            hasSet.Add(2);
            hasSet.Add(3);
            hasSet.Add(5);

            Assert.That(hasSet.Contains(3), Is.EqualTo(true));
            Assert.That(hasSet.Contains(4), Is.EqualTo(false));
        }
 //O(1) time complexity; worst case O(n)
 //add an item to this hash table
 public void Add(TV value)
 {
     hashSet.Add(value);
 }
示例#4
0
 public void NegativeNumbersShouldNotCrash() => _set.Add(-100);
示例#5
0
 protected override void Put(IHashSet <string> collection, string value)
 {
     collection.Add(value);
     _last = value;
 }
示例#6
0
 //O(1) time complexity; worst case O(n)
 //add an item to this hash table
 public void Add(V value)
 {
     HashSet.Add(value);
 }