public void CreateObjRef() { MarshalObject objMarshal = new MarshalObject(); RemotingServices.SetObjectUriForMarshal(objMarshal, "MarshalByRefObjectTest.objMarshal1"); RemotingServices.Marshal(objMarshal); ObjRef objRef = objMarshal.CreateObjRef(typeof(MarshalObject)); Assert.AreEqual(objRef.URI, RemotingServices.GetObjectUri(objMarshal), "#A01"); // TODO: When implemented in the mono RemotingServices class //RemotingServices.Disconnect(objMarshal); }
public void LifetimeService() { MarshalObject objMarshal = new MarshalObject(); RemotingServices.SetObjectUriForMarshal(objMarshal, "MarshalByRefObjectTest.objMarshal2"); RemotingServices.Marshal(objMarshal); objMarshal.InitializeLifetimeService(); ILease lease = (ILease) objMarshal.GetLifetimeService(); Assert.AreEqual(lease.InitialLeaseTime, TimeSpan.FromSeconds(10), "#A02"); // TODO: When implemented in the mono RemotingServices class //RemotingServices.Disconnect(objMarshal); }
public void CreateObjRefThrowException() { MarshalObject objMarshal = new MarshalObject(); ObjRef objRef = objMarshal.CreateObjRef(typeof(MarshalObject)); }
public void GetObject() { MarshalObject objMarshal = new MarshalObject(1); RemotingServices.SetObjectUriForMarshal(objMarshal, "MarshalByRefObjectTest.objMarshal3"); RemotingServices.Marshal(objMarshal); TcpChannel chn = new TcpChannel(1294); ChannelServices.RegisterChannel(chn); object objRem = Activator.GetObject(typeof(MarshalObject), "tcp://localhost:1294/MarshalByRefObjectTest.objMarshal3"); MarshalObject objMarshalRem = (MarshalObject) objRem; Assert.AreEqual(1, objMarshalRem.Id, "#A03"); // TODO: When implemented in the mono RemotingServices class //RemotingServices.Disconnect(objMarshal); // chn.StopListening(null); ChannelServices.UnregisterChannel(chn); }