public void AddInFilledCache()
        {
            var target = new SizesCache();

            target.AddOrChange(0, 43);
            target.AddOrChange(0, 46);
            target.AddOrChange(0, 46);

            Assert.AreEqual(46, target.GetEstimate(0));
        }
        public void CleanUpFilledCacheNormalCase()
        {
            var target = new SizesCache();

            target.AddOrChange(0, 40);
            target.AddOrChange(0, 41);
            target.AddOrChange(0, 42);
            target.AddOrChange(0, 43);

            target.CleanUp(0);
            Assert.AreEqual(0, target.GetEstimate(0));
        }
        public void AddInEmptyCache()
        {
            var expected = 43.0;
            var target   = new SizesCache();

            target.AddOrChange(0, expected);

            Assert.AreEqual(expected, target.GetEstimate(0));
        }
Exemple #4
0
 private void RegisterHeight([NotNull] TreeView tree, int level, double size)
 {
     cachedSizes.AddOrChange(0, size);
     tree.CachedSizes.AddOrChange(level, size);
 }
        public void ChangeWithMaxItems()
        {
            var target = new SizesCache();

            target.AddOrChange(0, 1);
            target.AddOrChange(0, 1);
            target.AddOrChange(0, 3);
            target.AddOrChange(0, 3);
            target.AddOrChange(0, 5);
            target.AddOrChange(0, 7);
            target.AddOrChange(0, 7);
            target.AddOrChange(0, 9);
            target.AddOrChange(0, 9);
            target.AddOrChange(0, 11);
            target.AddOrChange(0, 11);
            target.AddOrChange(0, 11);

            Assert.AreEqual(11, target.GetEstimate(0));
        }