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 })); }
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 })); }
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 })); }
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 })); }
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 })); }
public void NoInstance() { var handler = new ClassMethodHandler(typeof(TestService.TestClass).GetMethod("FloatToString")); Assert.Throws <ArgumentException> (() => handler.Invoke(new object[] { 1000UL, 3.14159f })); }