コード例 #1
0
        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);
        }
コード例 #2
0
        public void TestReccursiveRaise()
        {
            clickCount = 0;

            var button = new Button();
            button.Click += TestReccursiveRaiseOnClick;
            button.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));

            Assert.AreEqual(10, clickCount);
        }
コード例 #3
0
        public void TestUnregisterHandlerInsideHandler()
        {
            testUnregisterHandlerCallCount = 0;

            var button = new Button();
            button.Click += TestUnregisterHandlerOnClick;
            button.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));

            Assert.AreEqual(1, testUnregisterHandlerCallCount);
        }