Exemple #1
0
        public void GetValue()
        {
            // arrange
            HashTbl <int> table = new HashTbl <int>(16);

            table.Add("Josie", 9);
            table.Add("Dog", 10);
            table.Add("Cupcake", 5);

            var result = table.Get("Dog");

            Assert.Equal(10, result);
        }
        public void CanHandleACollision()
        {
            // Arrange
            HashTbl <int> table = new HashTbl <int>(16);

            table.Add("Josie", 9);
            table.Add("Josie", 5);

            //  Act
            var result = table.Get("Josie");

            // Assert
            Assert.Equal(9, result);
        }
        public void CanRetrieveFromABucketWithACollision()
        {
            // Arrange
            HashTbl <int> table = new HashTbl <int>(16);

            table.Add("Josie", 9);
            table.Add("Dog", 10);
            table.Add("Josie", 5);

            //  Act
            var result = table.Get("Josie");

            // Assert
            Assert.Equal(9, result);
        }