Пример #1
0
        public void TestBuildMethodcallWithIq()
        {
            var iq = new RpcIq
            {
                Id   = "0815",
                Type = Matrix.Xmpp.IqType.Set
            };

            var call = new MethodCall {
                MethodName = "bid"
            };

            var parameters = new Parameters
            {
                new StructParameter
                {
                    { "symbol", "RHAT" },
                    { "limit", 2.25 },
                    { "expires", new DateTime(2002, 07, 09, 20, 0, 0) }
                }
            };

            call.SetParameters(parameters);
            iq.Rpc.MethodCall = call;

            iq.ShouldBe(Resource.Get("Xmpp.Rpc.rpc_iq1.xml"));
        }
Пример #2
0
        public void TestBuildIqWithStructThatContainsAnArray()
        {
            var iq = new RpcIq
            {
                Id   = "0815",
                Type = Matrix.Xmpp.IqType.Set
            };

            var call = new MethodCall {
                MethodName = "bid"
            };

            var parameters = new Parameters
            {
                new StructParameter
                {
                    { "symbol", "RHAT" },
                    { "limit", 2.25 },
                    { "some_array", new Parameters {
                          "A", "B", "C", "D"
                      } }
                }
            };

            call.SetParameters(parameters);
            iq.Rpc.MethodCall = call;
            iq.ShouldBe(Resource.Get("Xmpp.Rpc.rpc_iq3.xml"));
        }
Пример #3
0
        public void TestBuildRpcQuery2()
        {
            var rpc  = new Matrix.Xmpp.Rpc.Rpc();
            var call = new MethodCall {
                MethodName = "examples.getStateName"
            };

            var pars = new Parameters {
                6
            };

            call.SetParameters(pars);

            rpc.MethodCall = call;
            rpc.ShouldBe(Resource.Get("Xmpp.Rpc.rpc_query2.xml"));
        }
Пример #4
0
        public void TestBuildRpcQuery()
        {
            var rpc        = new Matrix.Xmpp.Rpc.Rpc();
            var methodCall = new MethodCall {
                MethodName = "bid"
            };

            var parameters = new Parameters
            {
                new StructParameter
                {
                    { "symbol", "RHAT" },
                    { "limit", 2.25 },
                    { "expires", new DateTime(2002, 07, 09, 20, 0, 0) }
                }
            };

            methodCall.SetParameters(parameters);
            rpc.MethodCall = methodCall;

            rpc.ShouldBe(Resource.Get("Xmpp.Rpc.rpc_query1.xml"));
        }
Пример #5
0
        public void TestBuildMethodcallWithIq2()
        {
            var iq = new RpcIq
            {
                Id   = "4jLvG-34",
                To   = "[email protected]/Smack",
                From = "[email protected]/Smack",
                Type = Matrix.Xmpp.IqType.Set
            };

            var call = new MethodCall {
                MethodName = "com.collabng.net.remoteable.ViewpointRemoteable.setViewpoint"
            };

            var parameters = new Parameters
            {
                "viewpoint_BackView_collabng"
            };

            call.SetParameters(parameters);
            iq.Rpc.MethodCall = call;

            iq.ShouldBe(Resource.Get("Xmpp.Rpc.rpc_iq2.xml"));
        }