Exemple #1
0
        public void SimpleTests()
        {
            int dumpCount  = 0;
            int foundCount = 0;
            int capacity   = (int)Math.Pow(10, 2);
            var dict       = new LruDictionary <int, Data>(capacity, x => dumpCount++);

            for (int i = 0; i < _inputList.Count; i++)
            {
                dict.Set(_inputList[i], new Data(_inputList[i]));
            }

            for (int i = _inputList.Count - 1; i >= 0; i--)
            {
                bool found = dict.TryGetValue(_inputList[i], out Data value);
                if (found)
                {
                    foundCount++;
                }
            }

            dict.Count.Should().Be(capacity);
            dumpCount.Should().BeGreaterThan(0);
            foundCount.Should().BeGreaterThan(0);
        }