Пример #1
0
        public void ExactValueTest2()
        {
            var dispatcher = new CStaticEventHandlersAndDispatcher();

            dispatcher.RegisterHandler <CStaticEventHandlersAndDispatcher>(EShapes.Square, _disp => _disp.m_square = true);

            dispatcher.ClearFlags();
            dispatcher.Post(EShapes.Circle);
            dispatcher.Post(EShapes.Square);

            Assert.IsTrue(dispatcher.m_square, "m_square");
            Assert.IsFalse(dispatcher.m_circle, "m_circle");
            Assert.IsFalse(dispatcher.m_shape, "m_shape");
            Assert.IsFalse(dispatcher.m_anything, "m_anything");
            Assert.AreEqual(1, dispatcher.EventExecutionCount, "Event Execution Count");
        }
Пример #2
0
        public void X_LambdaRegisrationDispatcherTypeMismatchTest2()
        {
            var disp = new CStaticEventHandlersAndDispatcher();

            disp.RegisterHandler <CBadEventHandler_SecondParamBadDispatcher>(AttributeTargets.Assembly, x => { });
        }
Пример #3
0
        public void X_LambdaRegisrationDispatcherTypeMismatchTest()
        {
            var disp = new CStaticEventHandlersAndDispatcher();

            disp.RegisterHandler <int, CBadEventHandler_SecondParamBadDispatcher>((x, y) => { });
        }