public void testPutAndGet()
        {
            FastByIDMap <long?> map = new FastByIDMap <long?>();

            Assert.IsNull(map.Get(500000L));
            map.Put(500000L, 2L);
            Assert.AreEqual(2L, (long)map.Get(500000L));
        }
        public void testRehash()
        {
            FastByIDMap <String> map = buildTestFastMap();

            map.Remove(500000L);
            map.Rehash();
            Assert.IsNull(map.Get(500000L));
            Assert.AreEqual("bang", map.Get(47L));
        }
        public void testGrow()
        {
            FastByIDMap <String> map = new FastByIDMap <String>(1, 1);

            map.Put(500000L, "alpha");
            map.Put(47L, "bang");
            Assert.IsNull(map.Get(500000L));
            Assert.AreEqual("bang", map.Get(47L));
        }
        public void testMaxSize()
        {
            FastByIDMap <String> map = new FastByIDMap <String>();

            map.Put(4, "bang");
            Assert.AreEqual(1, map.Count());
            map.Put(47L, "bang");
            Assert.AreEqual(2, map.Count());
            Assert.IsNull(map.Get(500000L));
            map.Put(47L, "buzz");
            Assert.AreEqual(2, map.Count());
            Assert.AreEqual("buzz", map.Get(47L));
        }
        public void testVersusHashMap()
        {
            FastByIDMap <String>       actual   = new FastByIDMap <String>();
            IDictionary <long, string> expected = new Dictionary <long, string>(1000000);
            var r = RandomUtils.getRandom();

            for (int i = 0; i < 1000000; i++)
            {
                double d   = r.nextDouble();
                long   key = (long)r.nextInt(100);
                if (d < 0.4)
                {
                    Assert.AreEqual(expected.ContainsKey(key)?expected[key]:null, actual.Get(key));
                }
                else
                {
                    if (d < 0.7)
                    {
                        var expectedOldVal = expected.ContainsKey(key) ? expected[key] : null;
                        expected[key] = "bang";
                        Assert.AreEqual(expectedOldVal, actual.Put(key, "bang"));
                    }
                    else
                    {
                        var expectedOldVal = expected.ContainsKey(key) ? expected[key] : null;
                        expected.Remove(key);
                        Assert.AreEqual(expectedOldVal, actual.Remove(key));
                    }
                    Assert.AreEqual(expected.Count, actual.Count());
                    Assert.AreEqual(expected.Count == 0, actual.IsEmpty());
                }
            }
        }
        public void testClear()
        {
            FastByIDMap <long?> map = new FastByIDMap <long?>();

            map.Put(500000L, 2L);
            map.Clear();
            Assert.AreEqual(0, map.Count());
            Assert.True(map.IsEmpty());
            Assert.IsNull(map.Get(500000L));
        }