Ejemplo n.º 1
0
        public void InvokeMessageEvent_NullDispatcher_ExceptionThrown()
        {
            TestUnityMessageEventDispatcherInterface dispatcherInterface = null;

            Assert.Throws <UnityMessageHandleException>(() =>
                                                        UnityMessageEventFunctions.InvokeMessageEventWithDispatcher(dispatcherInterface,
                                                                                                                    new UnityTestMessagePayload()));
        }
Ejemplo n.º 2
0
        public void RegisterMessageEvent_NullDispatcher_ExceptionThrown()
        {
            TestUnityMessageEventDispatcherInterface dispatcherInterface = null;
            var responseObject = new UnityTestMessageHandleResponseObject <UnityTestMessagePayload>();

            Assert.Throws <UnityMessageHandleException>(() =>
                                                        UnityMessageEventFunctions.RegisterActionWithDispatcher <UnityTestMessagePayload>(dispatcherInterface,
                                                                                                                                          responseObject.OnResponse));
        }
Ejemplo n.º 3
0
        public void UnregisterMessageEvent_UnregistersEvent()
        {
            var dispatcherInterface = new TestUnityMessageEventDispatcherInterface();
            var responseObject      = new UnityTestMessageHandleResponseObject <UnityTestMessagePayload>();
            var handle = dispatcherInterface.Dispatcher.RegisterForMessageEvent <UnityTestMessagePayload>(responseObject.OnResponse);

            UnityMessageEventFunctions.UnregisterActionWithDispatcher(dispatcherInterface, handle);

            Assert.IsFalse(handle.IsRegistered());
        }
Ejemplo n.º 4
0
        public void UnregisterMessageEvent_NullDispatcher_ExceptionThrown()
        {
            TestUnityMessageEventDispatcherInterface dispatcherInterface = null;

            var handle = new UnityMessageEventHandle <UnityTestMessagePayload>();

            Assert.Throws <UnityMessageHandleException>(() =>
                                                        UnityMessageEventFunctions.UnregisterActionWithDispatcher(dispatcherInterface,
                                                                                                                  handle));
        }
Ejemplo n.º 5
0
        public void RegisterMessageEvent_RegistersMessageEvent()
        {
            var dispatcherInterface = new TestUnityMessageEventDispatcherInterface();
            var responseObject      = new UnityTestMessageHandleResponseObject <UnityTestMessagePayload>();

            var handle = UnityMessageEventFunctions.RegisterActionWithDispatcher <UnityTestMessagePayload>(dispatcherInterface, responseObject.OnResponse);

            Assert.IsTrue(handle.IsRegistered());

            dispatcherInterface.Dispatcher.UnregisterForMessageEvent(handle);
        }
Ejemplo n.º 6
0
        public void InvokeMessageEventWithDispatcher_InvokesEvent()
        {
            var dispatcherInterface = new TestUnityMessageEventDispatcherInterface();
            var responseObject      = new UnityTestMessageHandleResponseObject <UnityTestMessagePayload>();
            var handle = dispatcherInterface.Dispatcher.RegisterForMessageEvent <UnityTestMessagePayload>(responseObject.OnResponse);

            UnityMessageEventFunctions.InvokeMessageEventWithDispatcher(dispatcherInterface, new UnityTestMessagePayload());

            Assert.IsTrue(responseObject.ActionCalled);

            dispatcherInterface.Dispatcher.UnregisterForMessageEvent(handle);
        }