public void RemoteObjectProxyTest1() { bool IsReady = false; Task t = new Task(() => { RemoteObjectsServer s = new RemoteObjectsServer(); s.Start(15111); // TODO: get free port s.GetObjectHandler = GetObjectHandler; IsReady = true; }); t.Start(); Stopwatch st = Stopwatch.StartNew(); while (!IsReady && st.ElapsedMilliseconds < 10000) { Thread.Sleep(50); } RemoteObjectsClient c = new RemoteObjectsClient(); //TODO: temp get local host c.Connect(SocketHelper.GetDisplayHost(), SocketHelper.GetDisplayPort()); IDisplay calc1 = c.GetObject <IDisplay>("aa1"); int total = calc1.Add(2, 5); Assert.AreEqual(7, total); }
internal static T Create(RemoteObjectsClient remoteObjectsClient, Guid guid) { object proxy = Create <T, RemoteObjectProxy <T> >(); ((RemoteObjectProxy <T>)proxy).mRemoteObjectsClient = remoteObjectsClient; ((RemoteObjectProxy <T>)proxy).RemoteObjectGuid = guid; return((T)proxy); }
private NewPayLoad AttachDisplay(NewPayLoad pl) { string host = pl.GetValueString(); int port = pl.GetValueInt(); RemoteObjectsClient c = new RemoteObjectsClient(); c.Connect(host, port); //TODO: fix hard coded !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Assembly driverAssembly = Assembly.LoadFrom(@"C:\Yaron\TFS\Ginger\Devs\GingerNextVer_Dev\GingerWebServicesPlugin\bin\Debug\netstandard2.0\WebServices.GingerPlugin.dll"); Type t = driverAssembly.GetType("Amdocs.Ginger.WebServices.IWebServicesDriverDisplay"); // We do all using reflection, since we don't have ref to the driver dll, it will load at run time MethodInfo mi = typeof(RemoteObjectsClient).GetMethod("GetObject").MakeGenericMethod(new Type[] { t }); object driverDisplayRemoteObject = mi.Invoke(c, new object[] { "ID aas as !!!" }); mDriver.GetType().GetMethod("AttachDisplay").Invoke(mDriver, new object[] { driverDisplayRemoteObject }); return(new NewPayLoad("OK", "Done")); }