Beispiel #1
0
        public void function_returns_new_data_when_new_arguments_are_passed()
        {
            const int iters   = 100;
            var       counter = new FunctionCallCounter();

            for (int i = 0; i < iters; i++)
            {
                _cache.GetOrAddFunc(() => counter.GetCallCount(i)).UsingKeys(i);
            }

            var result = counter.TotalCount;

            Assert.Equal(iters, result);
        }
Beispiel #2
0
        public void func_returns_data_once()
        {
            const int iters   = 100;
            var       counter = new FunctionCallCounter();

            for (int i = 0; i < iters; i++)
            {
                _cache.GetOrAddFunc(() => counter.GetCallCount(0)).UsingKeys(0);
            }

            var result = counter.TotalCount;

            Assert.Equal(1, result);
        }