示例#1
0
        public void OnChangeRemoveOnChangeTest()
        {
            var bindable = new Bindable <int>();

            var counter = 0;

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

            // add without immediate dispatch
            bindable.OnChange(listener, false);

            bindable.Dispatch();
            Assert.AreEqual(1, counter, "The callback should have been called once.");

            bindable.RemoveOnChange(listener);

            bindable.Dispatch();
            Assert.AreEqual(1, counter, "The callback should have not been called again.");
        }