Exemplo n.º 1
0
        public void ExecuteNamedParamsTest()
        {
            Incubator inc = new Incubator();

            inc.Set(new Echo());
            string         id      = "A Value";
            JsonRpcRequest request = new JsonRpcRequest();

            request.Incubator = inc;
            string value = "hello there ".RandomLetters(8);

            request.Params            = JToken.Parse("{{'value': '{0}'}}"._Format(value));
            request.RpcParams.By.Name = request.Params;
            request.Method            = "Send";
            request.Id = id;

            IHttpContext context = GetPostContextWithInput(request.ToJson());

            request           = (JsonRpcRequest)JsonRpcMessage.Parse(context);
            request.Incubator = inc;

            JsonRpcResponse response = request.Execute();

            Expect.IsTrue(response.GetType().Equals(typeof(JsonRpcResponse)));
            Expect.AreEqual(response.Result, value);
            Expect.IsNull(response.Error);
            Expect.AreEqual(request.Id, response.Id);
            Expect.AreEqual(id, response.Id);
        }