コード例 #1
0
ファイル: MasterClientTest.cs プロジェクト: garaemon/RosSharp
        public void LookupNode_UnknownError()
        {
            var result = new object[3]
            {
                -1,
                "unknown node [/hogehoge]",
                ""
            };

            MXmlRpcClientProtocol.AllInstances.UrlSetString = (t1, t2) => { };
            MMasterProxy.AllInstances.BeginLookupNodeStringStringAsyncCallbackObject = (t1, t2, t3, t4, t5) => { t4(null); return null; };
            MMasterProxy.AllInstances.EndLookupNodeIAsyncResult = (t1, t2) => result;

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

            var ex = AssertEx.Throws<AggregateException>(() => client.LookupNodeAsync("/test", "/hogehoge").Wait());
            ex.InnerException.Message.Is("unknown node [/hogehoge]");
        }
コード例 #2
0
ファイル: MasterClientTest.cs プロジェクト: garaemon/RosSharp
        public void LookupNode_Success()
        {
            var result = new object[3]
            {
                1,
                "node api",
                "http://192.168.11.4:59511/"
            };

            MXmlRpcClientProtocol.AllInstances.UrlSetString = (t1, t2) => { };
            MMasterProxy.AllInstances.BeginLookupNodeStringStringAsyncCallbackObject = (t1, t2, t3, t4, t5) => { t4(null); return null; };
            MMasterProxy.AllInstances.EndLookupNodeIAsyncResult = (t1, t2) => result;

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

            client.LookupNodeAsync("/test", "/rosout").Result.Is(new Uri("http://192.168.11.4:59511/"));
        }