Example #1
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 }));
 }
Example #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 }));
 }
Example #3
0
 public void PropertiesDefaultArgument()
 {
     var handler = new ClassMethodHandler (typeof(TestService.TestClass).GetMethod ("IntToString"));
     var parameters = handler.Parameters.ToList ();
     Assert.AreEqual (2, parameters.Count);
     Assert.AreEqual ("this", parameters [0].Name);
     Assert.AreEqual ("x", parameters [1].Name);
     Assert.AreEqual (typeof(ulong), parameters [0].Type);
     Assert.AreEqual (typeof(int), parameters [1].Type);
     Assert.IsFalse (parameters [0].HasDefaultValue);
     Assert.IsTrue (parameters [1].HasDefaultValue);
     Assert.AreEqual (typeof(string), handler.ReturnType);
 }
Example #4
0
 public void NoInstance()
 {
     var handler = new ClassMethodHandler (typeof(TestService.TestClass).GetMethod ("FloatToString"));
     Assert.Throws<ArgumentException> (() => handler.Invoke (new object[] { 1000UL, 3.14159f }));
 }