public void LazyAthShouldReturnFactoryFunctionResultOnGetValue() { var person = new Person(); var lazyPerson = new AthLazy <Person>(() => person); Assert.Equal(lazyPerson.GetValue(), person); }
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); }