Beispiel #1
0
        public void GivenTwoEntries_WhenBothHaveSameIndex_ShouldStoreBothInLinkedList()
        {
            // Arrange
            var table = new MyHashTable <int, string>();

            // Act
            table.Put(5, "a");
            table.Put(500, "b");

            // Assert
            table.Get(5).Should().Be("a");
            table.Get(500).Should().Be("b");
        }
Beispiel #2
0
        public void GivenAnEntry_WhenAlreadyContainAEntryWithSameKey_ShouldUpdateTheValue()
        {
            // Arrange
            var table = new MyHashTable <int, string>();

            table.Put(1, "Juliana");

            // Act
            table.Put(1, "Guilherme");

            // Assert
            table.Get(1).Should().Be("Guilherme");
        }
Beispiel #3
0
        public void GivenAnEntry_WhenNotContainAEntryWithSameKey_ShouldAddTheEntryInArray()
        {
            // Arrange
            var table = new MyHashTable <int, string>();

            // Act
            table.Put(1, "Guilherme");

            // Assert
            table.Get(1).Should().Be("Guilherme");
        }