コード例 #1
0
        public void SendSNEventHasReturn4()
        {
            ResetEveryTest();
            ISNEvent testInsintace = new SNEvent();
            int      value         = 0;
            Func <int, int, int, int, int> voidFc = (int i, int i2, int i3, int i4) => {
                return(value += (i + i2 + i3 + i4));
            };

            testInsintace.Register(SNMsg.ExampleMsg, voidFc);
            testInsintace.Register(SNMsg.ExampleMsg, voidFc);

            testInsintace.DispatchHasReturn <int, int, int, int, int> (SNMsg.ExampleMsg, 1, 1, 1, 1, ref item);
            Assert.AreEqual(value, 8);
        }
コード例 #2
0
        public void RegisterSNEventTest5()
        {
            ISNEvent testInsintace = new SNEvent();
            ISNEvent e             = null;

            SNFramework.Action <string, int, int, int, int> voidAc5 = (string s, int i, int p3, int p4, int p5) => {
            };
            e = testInsintace.Register(SNMsg.ExampleMsg, voidAc5);
            Assert.IsNotNull(e);
        }
コード例 #3
0
        public void RegisterSNEventTest4()
        {
            ISNEvent testInsintace = new SNEvent();
            ISNEvent e             = null;

            Action <string, int, int, int> voidAc4 = (string s, int i, int p3, int p4) => {
            };

            e = testInsintace.Register(SNMsg.ExampleMsg, voidAc4);
            Assert.IsNotNull(e);
        }
コード例 #4
0
        public void UnregisterSNEventTest()
        {
            ISNEvent testInsintace = new SNEvent();

            Action voidAc = () => {
            };
            ISNEvent e    = testInsintace.Register(SNMsg.ExampleMsg, voidAc);

            e = testInsintace.Unregister(SNMsg.ExampleMsg, voidAc);
            Assert.IsNotNull(e);
        }
コード例 #5
0
        public void RegisterSNEventTest1()
        {
            ISNEvent testInsintace = new SNEvent();
            ISNEvent e             = null;

            Action <int> voidAc1 = (int i) => {
            };

            e = testInsintace.Register(SNMsg.ExampleMsg, voidAc1);
            Assert.IsNotNull(e);
        }
コード例 #6
0
        public void SendSNEventTest0()
        {
            ISNEvent testInsintace = new SNEvent();
            int      param         = 0;

            Action voidAc = () => {
                param = 1;
            };

            testInsintace.Register(SNMsg.ExampleMsg, voidAc);
            testInsintace.Dispatch(SNMsg.ExampleMsg);
            Assert.AreEqual(param, 1);
        }
コード例 #7
0
        public void SendSNEventHasReturn3()
        {
            ResetEveryTest();
            ISNEvent testInsintace = new SNEvent();

            Func <int, int, int, int> voidFc = (int i, int i2, int i3) => {
                return(i + i2 + i3);
            };

            testInsintace.Register(SNMsg.ExampleMsg, voidFc);
            testInsintace.DispatchHasReturn <int, int, int, int> (SNMsg.ExampleMsg, 1, 1, 1, ref item);
            Assert.AreEqual(item, 3);
        }
コード例 #8
0
        public void SendSNEventHasReturn()
        {
            ISNEvent testInsintace = new SNEvent();

            Func <int> voidFc = () => {
                return(1);
            };

            testInsintace.Register(SNMsg.ExampleMsg, voidFc);

            testInsintace.DispatchHasReturn <int> (SNMsg.ExampleMsg, ref item);
            Assert.AreEqual(item, 1);
        }
コード例 #9
0
        public void SendSNEventTest1()
        {
            ISNEvent testInsintace = new SNEvent();
            int      param         = 0;

            Action <int> voidAc1 = (int i) => {
                param = i;
            };

            testInsintace.Register(SNMsg.ExampleMsg, voidAc1);
            testInsintace.Dispatch(SNMsg.ExampleMsg, 1);
            Assert.AreEqual(param, 1);
        }
コード例 #10
0
        public void SendSNEventTest2()
        {
            ISNEvent testInsintace = new SNEvent();
            string   str           = "";
            int      param         = 0;

            Action <string, int> voidAc2 = (string s, int i) => {
                str   = "1";
                param = 1;
            };

            testInsintace.Register(SNMsg.ExampleMsg, voidAc2);
            testInsintace.Dispatch(SNMsg.ExampleMsg, "1", 1);
            Assert.AreEqual(param, 1);
            Assert.AreEqual(str, "1");
        }
コード例 #11
0
        public void SendSNEventTest5()
        {
            ISNEvent testInsintace = new SNEvent();
            string   str           = "";
            int      param         = 0;
            int      param2        = 0;
            int      param3        = 0;
            int      param4        = 0;

            SNFramework.Action <string, int, int, int, int> voidAc5 = (string s, int i, int p3, int p4, int p5) => {
                str    = "1";
                param  = 1;
                param2 = 1;
                param3 = 1;
                param4 = 1;
            };
            testInsintace.Register(SNMsg.ExampleMsg, voidAc5);
            testInsintace.Dispatch(SNMsg.ExampleMsg, "1", 1, 1, 1, 1);
            Assert.AreEqual(param, 1);
            Assert.AreEqual(str, "1");
            Assert.AreEqual(param2, 1);
            Assert.AreEqual(param3, 1);
            Assert.AreEqual(param4, 1);
        }