Esempio n. 1
0
        public void LazyAthShouldReturnFactoryFunctionResultOnGetValue()
        {
            var person     = new Person();
            var lazyPerson = new AthLazy <Person>(() => person);

            Assert.Equal(lazyPerson.GetValue(), person);
        }
Esempio n. 2
0
        public void LazyAthShouldCallFactoryFunctionOnlyOnce()
        {
            int callCount  = 0;
            var lazyPerson = new AthLazy <Person>(() => {
                callCount++;
                return(new Person());
            });

            lazyPerson.GetValue();
            lazyPerson.GetValue();
            lazyPerson.GetValue();
            Assert.Equal(1, callCount);
        }