Example #1
0
        public void DelayDereference()
        {
            FakeFn fn = new FakeFn();

            Delay delay = new Delay(fn);

            Assert.AreEqual(0, fn.Counter);

            object result = delay.Dereference();

            Assert.AreEqual(1, result);

            object result2 = delay.Dereference();

            Assert.AreEqual(1, result);
            Assert.AreEqual(1, fn.Counter);

            fn.Invoke();

            Assert.AreEqual(2, fn.Counter);
        }