public void LookupService_Success() { var result = new object[3] { 1, "rosrpc URI: [rosrpc://192.168.11.5:37171]", "rosrpc://192.168.11.5:37171" }; MXmlRpcClientProtocol.AllInstances.UrlSetString = (t1, t2) => { }; MMasterProxy.AllInstances.BeginLookupServiceStringStringAsyncCallbackObject = (t1, t2, t3, t4, t5) => { t4(null); return null; }; MMasterProxy.AllInstances.EndLookupServiceIAsyncResult = (t1, t2) => result; var client = new MasterClient(new Uri("http://localhost")); client.LookupServiceAsync("/test", "/service_test").Result.Is(new Uri("rosrpc://192.168.11.5:37171")); }
public void LookupService_NoProvider() { var result = new object[3] { -1, "no provider", "" }; MXmlRpcClientProtocol.AllInstances.UrlSetString = (t1, t2) => { }; MMasterProxy.AllInstances.BeginLookupServiceStringStringAsyncCallbackObject = (t1, t2, t3, t4, t5) => { t4(null); return null; }; MMasterProxy.AllInstances.EndLookupServiceIAsyncResult = (t1, t2) => result; var client = new MasterClient(new Uri("http://localhost")); var ex = AssertEx.Throws<AggregateException>(() => client.LookupServiceAsync("/test", "/service_test").Wait()); ex.InnerException.Message.Is("no provider"); }