예제 #1
0
        public void Can_Call_Instance_Many_Param()
        {
            var executor = new MessageHandlerMethodDispatcher(typeof(MessageHandler).GetMethod("InstanceHandleManyParam"), null);

            Assert.True(executor.IsInstanceMethod);
            executor.Execute(new MessageHandler(), "p1", "p2", "p3");
            Assert.True(TestPassed, "Did Not Pass");
        }
예제 #2
0
        public void Can_Call_Static_Single_Param()
        {
            var executor = new MessageHandlerMethodDispatcher(typeof(MessageHandler).GetMethod("StaticHandleSingleParam"), null);

            Assert.False(executor.IsInstanceMethod);
            executor.Execute("p1");
            Assert.True(TestPassed, "Did Not Pass");
        }
예제 #3
0
        public void Can_Call_Lambda()
        {
            var executor = MessageHandlerMethodDispatcher.FromDelegate <object>((message, messageContext) =>
            {
                Assert.NotNull(message);
                Assert.NotNull(messageContext);
                MessageHandlerMethodDispatcherTests.TestPassed = true;
            });

            executor.Execute("Message", Helpers.GetUninitializedObject <MessageContext>());
            Assert.True(TestPassed, "Did Not Pass");
        }
예제 #4
0
        public void Can_Call_Lambda_Alt()
        {
            Action <object, MessageContext> f = (message, messageContext) =>
            {
                Assert.NotNull(message);
                Assert.NotNull(messageContext);
                MessageHandlerMethodDispatcherTests.TestPassed = true;
            };
            var executor = new MessageHandlerMethodDispatcher(f, null);

            executor.Execute("Message", Helpers.GetUninitializedObject <MessageContext>());
            Assert.True(TestPassed, "Did Not Pass");
        }
예제 #5
0
        public void TestsShouldWork()
        {
            var executor = new MessageHandlerMethodDispatcher(typeof(MessageHandler).GetMethod("TestTest"), null);

            Assert.Throws <Exception>(() => executor.Execute(), "Test");
        }