public void TestHandlerRaiseOrder() { lastHandlerCalledId = 0; var button = new Button(); button.Click += TestHandlerRaiseOrderOnClick1; button.Click += TestHandlerRaiseOrderOnClick2; button.Click += TestHandlerRaiseOrderOnClick3; button.Click += TestHandlerRaiseOrderOnClick4; button.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); Assert.AreEqual(4, lastHandlerCalledId); }
public void TestReccursiveRaise() { clickCount = 0; var button = new Button(); button.Click += TestReccursiveRaiseOnClick; button.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); Assert.AreEqual(10, clickCount); }
public void TestUnregisterHandlerInsideHandler() { testUnregisterHandlerCallCount = 0; var button = new Button(); button.Click += TestUnregisterHandlerOnClick; button.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); Assert.AreEqual(1, testUnregisterHandlerCallCount); }