Exemplo n.º 1
0
        public void GetPublications_Success()
        {
            var result = new object[3]
            {
                1,
                "Success",
                new string[2][] {
                    new string[2]
                    {
                        "/rosout",
                        "rosgraph_msgs/Log"
                    },
                    new string[2]
                    {
                        "/chatter",
                        "std_msgs/String"
                    }
                }
            };

            MXmlRpcClientProtocol.AllInstances.UrlSetString = (t1, t2) => { };
            MSlaveProxy.AllInstances.BeginGetPublicationsStringAsyncCallbackObject = (t1, t2, t3, t4) => { t3(null); return(null); };
            MSlaveProxy.AllInstances.EndGetPublicationsIAsyncResult = (t1, t2) => result;

            var client = new SlaveClient(new Uri("http://localhost"));

            var ret = client.GetPublicationsAsync("/test").Result;

            ret.Count.Is(2);
            ret[0].TopicName.Is("/rosout");
            ret[0].MessageType.Is("rosgraph_msgs/Log");

            ret[1].TopicName.Is("/chatter");
            ret[1].MessageType.Is("std_msgs/String");
        }
Exemplo n.º 2
0
        public void GetPublications_Empty()
        {
            var result = new object[3]
            {
                1,
                "Success",
                new object[0]
            };

            MXmlRpcClientProtocol.AllInstances.UrlSetString = (t1, t2) => { };
            MSlaveProxy.AllInstances.BeginGetPublicationsStringAsyncCallbackObject = (t1, t2, t3, t4) => { t3(null); return(null); };
            MSlaveProxy.AllInstances.EndGetPublicationsIAsyncResult = (t1, t2) => result;

            var client = new SlaveClient(new Uri("http://localhost"));

            client.GetPublicationsAsync("/test").Result.Count.Is(0);
        }