public void MethodLookupIsCaseFree() { ServiceClass clazz = JsonRpcServices.GetClassFromType(typeof(TestService)); Method foo = clazz.FindMethodByName("Foo"); Assert.AreEqual("Foo", foo.Name); Assert.AreSame(foo, clazz.FindMethodByName("foo")); Assert.AreSame(foo, clazz.FindMethodByName("FOO")); Assert.AreSame(foo, clazz.FindMethodByName("Foo")); }
public void MethodWithWarpedParametersButVoidResult() { ServiceClass clazz = JsonRpcServices.GetClassFromType(typeof(ServiceWithMethodsUsingWarpedParameters)); Method foo = clazz.FindMethodByName("FooNoResult"); Assert.AreEqual(typeof(void), foo.ResultType); }
public void AttributeFromMethod() { ServiceClass clazz = JsonRpcServices.GetClassFromType(typeof(TestService)); Method method = clazz.FindMethodByName("Baz"); Assert.AreEqual("Baz", method.Name); Assert.AreEqual("Bar", method.InternalName); }
public void CustomNameViaAttribute() { ServiceClass clazz = JsonRpcServices.GetClassFromType(typeof(TestService)); Method method = clazz.FindMethodByName("Foo"); Assert.AreEqual("Foo", method.Name); Assert.AreEqual("Foo", method.InternalName); }
public void MethodWithWarpedParametersAndResult() { ServiceClass clazz = JsonRpcServices.GetClassFromType(typeof(ServiceWithMethodsUsingWarpedParameters)); Method foo = clazz.FindMethodByName("Foo"); Assert.AreEqual(typeof(DateTime), foo.ResultType); Parameter[] parameters = foo.GetParameters(); Assert.AreEqual(2, parameters.Length); Parameter parameter; parameter = parameters[0]; Assert.AreEqual("stringArg", parameter.Name); Assert.AreEqual(0, parameter.Position); Assert.AreEqual(typeof(string), parameter.ParameterType); parameter = parameters[1]; Assert.AreEqual("intArg", parameter.Name); Assert.AreEqual(1, parameter.Position); Assert.AreEqual(typeof(int), parameter.ParameterType); }
public void DefaultNameIsMethodName() { ServiceClass clazz = JsonRpcServices.GetClassFromType(typeof(TestService)); Assert.AreEqual("Foo", clazz.FindMethodByName("Foo").Name); }