Exemplo n.º 1
0
        public void MockGenericKeyed_with_string_should_be_lazy()
        {
            var target = new MockGenericKeyed <string>(() => Guid.NewGuid().ToString("n"));

            Assert.AreEqual(0, target.GetValueCount);
            var first = target.GetValue(1);

            Assert.AreNotEqual(null, first);
            Assert.AreEqual(1, target.GetValueCount);
            var second = target.GetValue(1);

            Assert.AreEqual(first, second);
            Assert.AreEqual(1, target.GetValueCount);
        }
Exemplo n.º 2
0
        public void MockGenericKeyed_with_int_should_be_lazy()
        {
            var target = new MockGenericKeyed <int>(() => 123);

            Assert.AreEqual(0, target.GetValueCount);
            var first = target.GetValue(1);

            Assert.AreEqual(123, first);
            Assert.AreEqual(1, target.GetValueCount);
            var second = target.GetValue(1);

            Assert.AreEqual(first, second);
            Assert.AreEqual(1, target.GetValueCount);
        }