Exemplo n.º 1
0
        public void RegisterService_Success()
        {
            var result = new object[3]
            {
                StatusCode.Success,
                "Registered [/test] as provider of [/myservice]",
                1
            };

            MXmlRpcClientProtocol.AllInstances.UrlSetString = (t1, t2) => { };
            MMasterProxy.AllInstances.BeginRegisterServiceStringStringStringStringAsyncCallbackObject = (t1, t2, t3, t4, t5, t6, t7) => { t6(null); return null; };
            MMasterProxy.AllInstances.EndRegisterServiceIAsyncResult= (t1, t2) => result;

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

            client.RegisterServiceAsync("/test", "/myservice", new Uri("http://192.168.11.2:11112"), new Uri("http://192.168.11.2:11111")).Wait();
        }
Exemplo n.º 2
0
        public void RegisterService_ParameterError()
        {
            var result = new object[3]
            {
                -1,
                "ERROR: parameter [service_api] is not an XMLRPC URI",
                0
            };

            MXmlRpcClientProtocol.AllInstances.UrlSetString = (t1, t2) => { };
            MMasterProxy.AllInstances.BeginRegisterServiceStringStringStringStringAsyncCallbackObject = (t1, t2, t3, t4, t5, t6, t7) => { t6(null); return null; };
            MMasterProxy.AllInstances.EndRegisterServiceIAsyncResult= (t1, t2) => result;

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

            var ex = AssertEx.Throws<AggregateException>(() => client.RegisterServiceAsync("/test", "/myservice", new Uri("http://localhost"), new Uri("http://localhost")).Wait());
            ex.InnerException.Message.Is("ERROR: parameter [service_api] is not an XMLRPC URI");
        }