public void GetBusStats_SuccessRosPyListener()
        {
            var result = new object[3]
            {
                1,
                "",
                new object[3]
                {
                    new object[1][]
                    {
                        new object[3]
                        {
                            "/rosout",
                            453259,
                            new object[1][]
                            {
                                new object[4]
                                {
                                    1,
                                    454488,
                                    2887,
                                    true
                                }
                            }
                        }
                    },
                    new object[1][]
                    {
                        new object[2]
                        {
                            "/chatter",
                            new object[1][]
                            {
                                new object[5]
                                {
                                    2,
                                    183,
                                    4037,
                                    -1,
                                    true
                                }
                            }
                        }
                    },
                    new object[0]
                }
            };

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

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

            var stats = client.GetBusStatsAsync("/test").Result;

            stats.PublishStatistics.Count.Is(1);
            stats.SubscribeStatistics.Count.Is(1);
            stats.ServiceStatistics.Count.Is(0);
        }
        public void GetBusStats_Unknown()
        {
            var result = new object[3]
            {
                -1,
                "unknown node [/test]",
                ""
            };

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

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

            var ex = AssertEx.Throws <AggregateException>(() => client.GetBusStatsAsync("/test").Wait());

            ex.InnerException.Message.Is("unknown node [/test]");
        }
Beispiel #3
0
 public void TestMethod1()
 {
     var stats = _slaveClient.GetBusStatsAsync("test").Result;
 }