Example #1
0
        public void ChangingArgsAreSetCorrectly()
        {
            LifeCycleButton button = new LifeCycleButton();

            Assert.IsNull(button.Handler);
            var firstHandler = new HandlerStub();

            button.Handler = firstHandler;

            Assert.AreEqual(button.LastHandlerChangingEventArgs.NewHandler, firstHandler);
            Assert.IsNull(button.LastHandlerChangingEventArgs.OldHandler);

            var secondHandler = new HandlerStub();

            button.Handler = secondHandler;
            Assert.AreEqual(button.LastHandlerChangingEventArgs.OldHandler, firstHandler);
            Assert.AreEqual(button.LastHandlerChangingEventArgs.NewHandler, secondHandler);

            button.Handler = null;
            Assert.AreEqual(button.LastHandlerChangingEventArgs.OldHandler, secondHandler);
            Assert.AreEqual(button.LastHandlerChangingEventArgs.NewHandler, null);

            Assert.AreEqual(3, button.changing);
            Assert.AreEqual(3, button.changed);
        }
Example #2
0
        public void VirtualViewSet()
        {
            Button      button      = new Button();
            HandlerStub handlerStub = new HandlerStub();

            button.Handler = handlerStub;

            Assert.IsNotNull(handlerStub.VirtualView);
        }