Example #1
0
        protected override void AddContent()
        {
            Control content = AddDiv(Body, null);

            content.ID = "Content";

            if (ServiceClass.Description.Length > 0)
            {
                AddPara(content, "service-help", ServiceClass.Description);
            }

            Control para = AddPara(content, "intro", null);

            AddLiteral(para, "The following ");
            AddLink(para, "JSON-RPC", "http://www.json-rpc.org/");
            AddLiteral(para, " methods are supported (try these using the ");
            AddLink(para, JsonRpcServices.GetServiceName(Service) + " test page", Request.FilePath + "?test");
            AddLiteral(para, "):");

            Control dl = AddGeneric(content, "dl", null);

            content.Controls.Add(dl);

            Method[]  methods  = SortedMethods;
            ArrayList idemList = new ArrayList(methods.Length);

            foreach (Method method in methods)
            {
                AddMethod(dl, method);

                if (method.Idempotent)
                {
                    idemList.Add(method);
                }
            }

            if (idemList.Count > 0)
            {
                AddGeneric(content, "hr", null);
                AddPara(content, null, "The following method(s) of this service are marked as idempotent and therefore safe for use with HTTP GET:");

                Control idemMethodList = AddGeneric(content, "ul", null);
                foreach (Method method in idemList)
                {
                    AddGeneric(idemMethodList, "li", null, method.Name);
                }
            }

            base.AddContent();
        }
Example #2
0
        public void MethodLookupIsCaseInsensitive()
        {
            ServiceClass clazz = JsonRpcServices.GetClassFromType(typeof(TestService));

            Assert.IsNotNull(clazz.FindMethodByName("FOO"));
        }
Example #3
0
 public virtual ServiceClass GetClass()
 {
     return(mClass ?? (mClass = JsonRpcServices.GetClassFromType(GetType())));
 }
Example #4
0
        public void CustomServiceName()
        {
            ServiceClass clazz = JsonRpcServices.GetClassFromType(typeof(TestService));

            Assert.AreEqual("MyService", clazz.Name);
        }
Example #5
0
        public void TaggedMethodsExported()
        {
            ServiceClass clazz = JsonRpcServices.GetClassFromType(typeof(TestService));

            Assert.AreEqual(2, clazz.GetMethods().Length);
        }
Example #6
0
        public void UntaggedMethodsNotExported()
        {
            ServiceClass clazz = JsonRpcServices.GetClassFromType(typeof(EmptyService));

            Assert.AreEqual(0, clazz.GetMethods().Length);
        }
Example #7
0
        public void ServiceNameIsTypeName()
        {
            ServiceClass clazz = JsonRpcServices.GetClassFromType(typeof(EmptyService));

            Assert.AreEqual("EmptyService", clazz.Name);
        }
Example #8
0
 public void NullType()
 {
     JsonRpcServices.GetClassFromType(null);
 }