public void IsObjectOutOf () { TcpChannel chn = new TcpChannel (1245); ChannelServices.RegisterChannel (chn); try { RemotingConfiguration.RegisterWellKnownServiceType (typeof (MarshalObject), "MarshalObject2.rem", WellKnownObjectMode.Singleton); MarshalObject objRem = (MarshalObject) Activator.GetObject (typeof (MarshalObject), "tcp://localhost:1245/MarshalObject2.rem"); Assert ("#A16", RemotingServices.IsObjectOutOfAppDomain (objRem)); Assert ("#A17", RemotingServices.IsObjectOutOfContext (objRem)); MarshalObject objMarshal = new MarshalObject (); Assert ("#A18", !RemotingServices.IsObjectOutOfAppDomain (objMarshal)); Assert ("#A19", !RemotingServices.IsObjectOutOfContext (objMarshal)); } finally { ChannelServices.UnregisterChannel (chn); } }
// Helper function that create a new // MarshalObject with an unique ID private static MarshalObject NewMarshalObject () { string uri = "MonoTests.System.Runtime.Remoting.RemotingServicesTest.MarshalObject" + MarshalObjectId.ToString (); MarshalObject objMarshal = new MarshalObject (MarshalObjectId, uri); MarshalObjectId++; return objMarshal; }