private static EndPointMethodConfiguration CreateEndPointMethodConfiguration(string path)
        {
            var routeInfo = new RpcRouteInformation
            {
                HasBody       = false,
                Method        = HttpMethods.Get,
                RouteBasePath = path,
                RouteTemplate = path,
                Tokens        = Array.Empty <IRpcRouteToken>()
            };

            var invokeFunc = new MethodInvokeInformation
            {
                MethodInvokeDelegate = context => null
            };

            var configuration = new EndPointMethodConfiguration(routeInfo, context => null, invokeFunc, typeof(void));

            return(configuration);
        }
示例#2
0
        private static EndPointMethodConfiguration CreateSimpleMethodDefinition(out string serializedInstance)
        {
            var invokeInfo = new MethodInvokeInformation {
                MethodToInvoke = typeof(Invoker).GetMethod("InvokeMethod")
            };
            var methodDefinition = new EndPointMethodConfiguration(new RpcRouteInformation(), null, invokeInfo, typeof(ResultHolder));

            methodDefinition.Parameters.Add(new RpcParameterInfo {
                Name = "intValue", ParamType = typeof(int), Position = 0
            });
            methodDefinition.Parameters.Add(new RpcParameterInfo {
                Name = "stringValue", ParamType = typeof(string), Position = 1
            });
            methodDefinition.Parameters.Add(new RpcParameterInfo {
                Name = "nullableBoolValue", ParamType = typeof(bool?), Position = 1
            });

            serializedInstance = "{\"intValue\": 5, \"stringValue\":\"blah\", \"nullableBoolValue\": true}";

            return(methodDefinition);
        }