Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
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));
        }
Exemplo n.º 3
0
        public void AddInEmptyCache()
        {
            var expected = 43.0;
            var target   = new SizesCache();

            target.AddOrChange(0, expected);

            Assert.AreEqual(expected, target.GetEstimate(0));
        }
Exemplo n.º 4
0
 private void RegisterHeight([NotNull] TreeView tree, int level, double size)
 {
     cachedSizes.AddOrChange(0, size);
     tree.CachedSizes.AddOrChange(level, size);
 }
Exemplo n.º 5
0
        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));
        }