Exemplo n.º 1
0
        public void Get_ForNotExistingKey_ThrowsException(ProbingType type)
        {
            //arrange
            var oaht = new OpenAddressingHashTable <string, int>(5, type);
            //arrange + act
            Action act = () => { oaht.Get("null"); };

            //assert
            act.Should().Throw <System.Collections.Generic.KeyNotFoundException>();
        }
Exemplo n.º 2
0
        public void Get_ForNull_ThrowsException(ProbingType type)
        {
            //arrange
            var oaht = new OpenAddressingHashTable <string, int>(5, type);
            //arrange + act
            Action act = () => { oaht.Get(null); };

            //assert
            act.Should().Throw <ArgumentException>();
        }
Exemplo n.º 3
0
        public void Get_ForExistingKey_ReturnsTheValue(ProbingType type)
        {
            //arrange
            const string key   = "1";
            const int    value = 1;
            var          oaht  = new OpenAddressingHashTable <string, int>(5, type);

            oaht.Add(key, value);
            //act
            var result = oaht.Get(key);

            //assert
            result.Should().Be(value);
        }