예제 #1
0
        public void ForwardOnChangeTest()
        {
            // two bindables of different type
            var child  = new Bindable <int>();
            var parent = new Bindable <string>();

            parent.ForwardOnChange(child);

            var counter = 0;
            BindableCallback listener = ((c, o) => { counter++; });

            // listener on parent without immediate dispatch
            parent.OnChange(listener, false);

            // dispatch on the child
            child.Dispatch();

            Assert.AreEqual(1, counter, "The OnChange should have been forwarded once to the parent");

            // remove the forwarding
            parent.RemoveForwardedOnChange(child);

            // dispatch again on the child
            child.Dispatch();

            Assert.AreEqual(1, counter, "The OnChange should not have been forwarded again.");
        }