예제 #1
0
        public void TestModelField1()
        {
            int RxAccountHandlerEvent = 0;
            int RxActionEvent1        = 0;
            int RxActionEvent2        = 0;
            int RxEventHandlerEvent1  = 0;
            int RxEventHandlerEvent2  = 0;

            TestModelField.RxAccountHandlerEvent().Select(t => 10).Subscribe(t => RxAccountHandlerEvent = t);
            TestModelField.RxActionEvent1().Select(t => 10).Subscribe(t => RxActionEvent1             = t);
            TestModelField.RxActionEvent2().Select(t => 10).Subscribe(t => RxActionEvent2             = t);
            TestModelField.RxEventHandlerEvent1().Select(t => 10).Subscribe(t => RxEventHandlerEvent1 = t);
            TestModelField.RxEventHandlerEvent2().Select(t => 10).Subscribe(t => RxEventHandlerEvent2 = t);

            TestModelField.FireAccountHandlerEvent();
            TestModelField.FireActionEvent1();
            TestModelField.FireActionEvent2();
            TestModelField.FireEventHandlerEvent1();
            TestModelField.FireEventHandlerEvent2();

            Assert.Equal(10, RxAccountHandlerEvent);
            Assert.Equal(10, RxActionEvent1);
            Assert.Equal(10, RxActionEvent2);
            Assert.Equal(10, RxEventHandlerEvent1);
            Assert.Equal(10, RxEventHandlerEvent2);
        }
예제 #2
0
        public void TestModelLocal()
        {
            int RxAccountHandlerEvent = 0;
            int RxActionEvent1        = 0;
            int RxActionEvent2        = 0;
            int RxEventHandlerEvent1  = 0;
            int RxEventHandlerEvent2  = 0;

            TestModel2 locaModel = new TestModel2();

            locaModel.RxAccountHandlerEvent().Select(t => 10).Subscribe(t => RxAccountHandlerEvent = t);
            locaModel.RxActionEvent1().Select(t => 10).Subscribe(t => RxActionEvent1             = t);
            locaModel.RxActionEvent2().Select(t => 10).Subscribe(t => RxActionEvent2             = t);
            locaModel.RxEventHandlerEvent1().Select(t => 10).Subscribe(t => RxEventHandlerEvent1 = t);
            locaModel.RxEventHandlerEvent2().Select(t => 10).Subscribe(t => RxEventHandlerEvent2 = t);

            locaModel.FireAccountHandlerEvent();
            locaModel.FireActionEvent1();
            locaModel.FireActionEvent2();
            locaModel.FireEventHandlerEvent1();
            locaModel.FireEventHandlerEvent2();

            Assert.Equal(10, RxAccountHandlerEvent);
            Assert.Equal(10, RxActionEvent1);
            Assert.Equal(10, RxActionEvent2);
            Assert.Equal(10, RxEventHandlerEvent1);
            Assert.Equal(10, RxEventHandlerEvent2);
        }