public void Callback_GivenTwoDelegate() { Callback callback = new Callback(); ButtonWithDelegates button = new ButtonWithDelegates("Ok"); button.Register(callback.Notify); button.Register(Notify); button.Click(); Assert.IsTrue(callback.Called); Assert.IsTrue(Called); }
public void Notify_GivenLambdaExpression_Success() { ButtonWithDelegates button = new ButtonWithDelegates("Ok"); bool called = false; Action notify = () => { called = true; }; button.Register(Notify); button.Register( () => { called = true; }); button.Click(); Assert.IsTrue(called); }
public void Notify_GivenDelegate_Success() { ButtonWithDelegates button = new ButtonWithDelegates("Ok"); button.Register(Notify); button.Click(); Assert.IsTrue(Called); }
public void Callback_GivenCallackClass() { Callback callback = new Callback(); ButtonWithDelegates button = new ButtonWithDelegates("Ok"); button.Register(callback); button.Click(); Assert.IsTrue(callback.Called); }
public void Notify_GivenLocalMethod_Success() { ButtonWithDelegates button = new ButtonWithDelegates("Ok"); bool called = false; void Notify() { called = true; } button.Register(Notify); button.Click(); Assert.IsTrue(called); }