Пример #1
0
        public void GetSubscriptions_Success()
        {
            var result = new object[3]
            {
                1,
                "Success",
                new string[1][] {
                    new string[2]
                    {
                        "/chatter",
                        "std_msgs/String"
                    }
                }
            };

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

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

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

            ret.Count.Is(1);
            ret[0].TopicName.Is("/chatter");
            ret[0].MessageType.Is("std_msgs/String");
        }
Пример #2
0
        public void GetSubscriptions_Empty()
        {
            var result = new object[3]
            {
                1,
                "Success",
                new object[0]
            };

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

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

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