public void TestTwoArgumentMethodWithOnlyOneArgumentProvided()
 {
     TestBean testBean = new TestBean();
     MethodInfo method = testBean.GetType().GetMethod("StringAndIntegerArgumentMethod");
     DefaultMethodInvoker invoker = new DefaultMethodInvoker(testBean, method);
     invoker.InvokeMethod("ABC");
 }
 public void TestIntegerArgumentWithVoidReturnAndFailedConversion()
 {
     TestBean testBean = new TestBean();
     MethodInfo method = testBean.GetType().GetMethod("IntegerArgumentWithVoidReturn");
     DefaultMethodInvoker invoker = new DefaultMethodInvoker(testBean, method);
     invoker.InvokeMethod("ABC");
 }
        public void TestIntegerArgumentWithVoidReturnAndFailedConversion()
        {
            TestBean             testBean = new TestBean();
            MethodInfo           method   = testBean.GetType().GetMethod("IntegerArgumentWithVoidReturn");
            DefaultMethodInvoker invoker  = new DefaultMethodInvoker(testBean, method);

            invoker.InvokeMethod("ABC");
        }
        public void TestTwoArgumentMethodWithOnlyThreeArgumentsProvided()
        {
            TestBean             testBean = new TestBean();
            MethodInfo           method   = testBean.GetType().GetMethod("StringAndIntegerArgumentMethod");
            DefaultMethodInvoker invoker  = new DefaultMethodInvoker(testBean, method);

            invoker.InvokeMethod("ABC", 123, 456);
        }
 public void TestStringArgumentWithVoidReturnAndSuccessfulConversion()
 {
     TestBean testBean = new TestBean();
     MethodInfo method = testBean.GetType().GetMethod("StringArgumentWithVoidReturn");
     DefaultMethodInvoker invoker = new DefaultMethodInvoker(testBean, method);
     invoker.InvokeMethod(123);
     Assert.That(testBean.lastStringArgument, Is.EqualTo("123"));
 }
        public void TestTwoArgumentsAndSuccessfulConversion()
        {
            TestBean             testBean = new TestBean();
            MethodInfo           method   = testBean.GetType().GetMethod("StringAndIntegerArgumentMethod");
            DefaultMethodInvoker invoker  = new DefaultMethodInvoker(testBean, method);
            object result = invoker.InvokeMethod("ABC", "789");

            Assert.That(result, Is.EqualTo("ABC:789"));
        }
        public void TestIntegerArgumentWithVoidReturnAndSuccessfulConversion()
        {
            TestBean             testBean = new TestBean();
            MethodInfo           method   = testBean.GetType().GetMethod("IntegerArgumentWithVoidReturn");
            DefaultMethodInvoker invoker  = new DefaultMethodInvoker(testBean, method);

            invoker.InvokeMethod("123");
            Assert.That(testBean.lastIntegerArgument, Is.EqualTo(123));
        }
        public void TestStringArgumentWithVoidReturnAndNoConversionNecessary()
        {
            TestBean             testBean = new TestBean();
            MethodInfo           method   = testBean.GetType().GetMethod("StringArgumentWithVoidReturn");
            DefaultMethodInvoker invoker  = new DefaultMethodInvoker(testBean, method);

            invoker.InvokeMethod("test");
            Assert.That(testBean.lastStringArgument, Is.EqualTo("test"));
        }
Exemple #9
0
        /*\
        |*| int TEST_CONST1 = 5; // 测试类静态常量;
        |*| string TEST_CONST2 = "test_const2";
        |*| int value1; // 字段的注释;
        |*| long value2;
        \*/

        public static void OnProcess(NetManager.NetSession session, IBean _arg_)
        {
            TestBean arg = (TestBean)_arg_;

            System.Console.WriteLine("{0}.onProcess: arg={1}", arg.GetType().Name, arg);

            RC4Filter filter = new RC4Filter();

            filter.SetInputKey(new byte[] { 1, 2, 3 }, 3);
            filter.SetOutputKey(new byte[] { 1, 2, 3 }, 3);
            ((TestClient)session.manager).SetFilter(filter);

            session.Send(arg);
        }
 public void TestTwoArgumentsAndNoConversionRequired()
 {
     TestBean testBean = new TestBean();
     MethodInfo method = testBean.GetType().GetMethod("StringAndIntegerArgumentMethod");
     DefaultMethodInvoker invoker = new DefaultMethodInvoker(testBean, method);
     object result = invoker.InvokeMethod("ABC", 456);
     Assert.That(result, Is.EqualTo("ABC:456"));
 }