public void Search_TwoObjectsWithSameHashCodeUsingReferenceEquals_CanGetFirstObject() { var root = ImmutableHashTree<FooWithSameHashCode, int>.Empty; var firstKey = new FooWithSameHashCode(1); var secondKey = new FooWithSameHashCode(2); var node = root.Add(firstKey, 10).Add(secondKey, 20); var result = node.Search(firstKey); Assert.AreEqual(10, result); }
public void Search_TwoObjectsWithSameHashCodeUsingReferenceEquals_CanGetFirstObject() { var root = ImmutableHashTree <FooWithSameHashCode, int> .Empty; var firstKey = new FooWithSameHashCode(1); var secondKey = new FooWithSameHashCode(2); var node = root.Add(firstKey, 10).Add(secondKey, 20); var result = node.Search(firstKey); Assert.Equal(10, result); }
public void Search_SameHashCode_ReturnsValue() { ImmutableHashTable <FooWithSameHashCode, int> hashTable = ImmutableHashTable <FooWithSameHashCode, int> .Empty; var firstKey = new FooWithSameHashCode(42); var secondKey = new FooWithSameHashCode(84); hashTable = hashTable.Add(firstKey, 42); hashTable = hashTable.Add(secondKey, 84); var value = hashTable.Search(firstKey); Assert.Equal(42, value); }
public void Search_SameHashCode_ReturnsValue() { ImmutableHashTable<FooWithSameHashCode, int> hashTable = ImmutableHashTable<FooWithSameHashCode, int>.Empty; var firstKey = new FooWithSameHashCode(42); var secondKey = new FooWithSameHashCode(84); hashTable = hashTable.Add(firstKey, 42); hashTable = hashTable.Add(secondKey, 84); var value = hashTable.Search(firstKey); Assert.Equal(42, value); }