示例#1
0
        public void Test_IsEmpty_Count_OnCreation()
        {
            var hash = new LinearProbingHash <Byte, Char>();

            Assert.True(hash.IsEmpty);
            Assert.Equal(0, hash.Count);
        }
示例#2
0
        public void Test_Add_Get()
        {
            var hash = new LinearProbingHash <Byte, Char>();

            hash.Add(1, 'A');

            Assert.Equal('A', hash.Get(1));
        }
示例#3
0
        public void Test_Delete()
        {
            var hash = new LinearProbingHash <Byte, Char>();

            hash.Add(1, 'A');
            hash.Delete(1);

            Assert.False(hash.Contains(1));
        }
示例#4
0
        public void Test_Contains()
        {
            var hash = new LinearProbingHash <Byte, Char>();

            hash.Add(1, 'A');
            hash.Add(2, 'B');

            Assert.True(hash.Contains(1));
            Assert.True(hash.Contains(2));
        }
示例#5
0
        private LinearProbingHash <Byte, Char> CreateFullLinearProbingHash()
        {
            LinearProbingHash <Byte, Char> hash = new LinearProbingHash <Byte, Char>(7);

            hash.Add(1, 'A');
            hash.Add(2, 'B');
            hash.Add(3, 'C');
            hash.Add(4, 'D');
            hash.Add(5, 'E');
            hash.Add(6, 'F');

            return(hash);
        }
示例#6
0
        public void Test_Get_KeyNotFoundException()
        {
            var hash = new LinearProbingHash <Byte, Char>();

            Assert.Throws <KeyNotFoundException>(() => hash.Get(100));
        }