示例#1
0
        public void NoInstance()
        {
            var classType = typeof(TestService.TestClass);
            var handler   = new ClassMethodHandler(classType, classType.GetMethod("FloatToString"), false);

            Assert.Throws <TargetException> (() => handler.Invoke(new object[] { null, 3.14159f }));
        }
示例#2
0
        public void DefaultArguments()
        {
            var instance  = new TestService.TestClass("foo");
            var object_id = ObjectStore.Instance.AddInstance(instance);
            var handler   = new ClassMethodHandler(typeof(TestService.TestClass).GetMethod("IntToString"));

            Assert.AreEqual("foo42", handler.Invoke(new object[] { object_id, Type.Missing }));
        }
示例#3
0
        public void SimpleUsage()
        {
            var instance  = new TestService.TestClass("foo");
            var object_id = ObjectStore.Instance.AddInstance(instance);
            var handler   = new ClassMethodHandler(typeof(TestService.TestClass).GetMethod("FloatToString"));

            Assert.AreEqual("foo3.14159", handler.Invoke(new object[] { object_id, 3.14159f }));
        }
示例#4
0
        public void DefaultArguments()
        {
            var instance  = new TestService.TestClass("foo");
            var classType = typeof(TestService.TestClass);
            var handler   = new ClassMethodHandler(classType, classType.GetMethod("IntToString"), false);

            Assert.AreEqual("foo42", handler.Invoke(new object[] { instance, Type.Missing }));
        }
示例#5
0
        public void SimpleUsage()
        {
            var instance  = new TestService.TestClass("foo");
            var classType = typeof(TestService.TestClass);
            var handler   = new ClassMethodHandler(classType, classType.GetMethod("FloatToString"), false);

            Assert.AreEqual("foo3.14159", handler.Invoke(new object[] { instance, 3.14159f }));
        }
示例#6
0
        public void NoInstance()
        {
            var handler = new ClassMethodHandler(typeof(TestService.TestClass).GetMethod("FloatToString"));

            Assert.Throws <ArgumentException> (() => handler.Invoke(new object[] { 1000UL, 3.14159f }));
        }