private static void TrySetAttachment(object obj, ICustomAttributeProvider source) { IAttributeAttachment attachment = obj as IAttributeAttachment; if (attachment != null) { attachment.SetAttachment(source); } }
public void FirstParameterOfStaticMethodDoesNotAppearInTheReflectedModel() { ServiceClassBuilder scb = new ServiceClassBuilder(); MethodInfo method = typeof(ServiceWithStaticMethod).GetMethod("StaticMethod"); JsonRpcMethodAttribute attribute = new JsonRpcMethodAttribute(); IAttributeAttachment attachment = attribute; attachment.SetAttachment(method); IMethodReflector reflector = attribute; MethodBuilder mb = scb.DefineMethod(); reflector.Build(mb); Assert.AreEqual(0, mb.Parameters.Count); }