public void Test_That_Delegate_Is_Called_Without_Lazy() { var testobj = TestObj.Create(); testobj.Date = GetDate_And_Wait_5_Seconds(); Assert.IsTrue(_getDateAndWait5SecondsHasBeenCalled); }
public void Test_That_Delegate_Is_Not_Called() { var testobj = TestObj.Create(); testobj.SetLazy(p => p.Date, GetDate_And_Wait_5_Seconds); Assert.IsFalse(_getDateAndWait5SecondsHasBeenCalled); }
public void Test_That_Delegate_Is_Called_With_Lazy() { var testobj = TestObj.Create(); testobj.SetLazy(p => p.Date, GetDate_And_Wait_5_Seconds); var date = testobj.Date; //accessing the member will make a call to the delegate Assert.IsTrue(_getDateAndWait5SecondsHasBeenCalled); }