Esempio n. 1
0
        public void multiDelegateRegisterTest()
        {
            DelegateObject obj = new DelegateObject();
            int            i   = 0;

            obj.func += onFunc;
            obj.func += onFunc;
            bool onFunc()
            {
                i++;
                Debug.Log(i);
                return(true);
            }

            obj.invoke();
            Assert.AreEqual(1, i);
        }
Esempio n. 2
0
        public void funcDelegateTest()
        {
            DelegateObject obj = new DelegateObject();

            obj.func += () =>
            {
                Debug.Log("1=>true");
                return(true);
            };
            obj.func += () =>
            {
                Debug.Log("2=>false");
                return(false);
            };
            //obj.func += () =>
            //{
            //    Debug.Log("3=>true");
            //    return true;
            //};
            Assert.False(obj.invoke());
        }