You've already forked linux-packaging-mono
Imported Upstream version 5.8.0.22
Former-commit-id: df344e34b07851d296efb3e6604c8db42b6f7aa3
This commit is contained in:
parent
5f4a27cc8a
commit
7d05485754
@@ -14,6 +14,8 @@ using System.Runtime.Remoting.Channels.Tcp;
|
||||
using System.Runtime.Remoting.Channels.Http;
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.Remoting
|
||||
{
|
||||
[TestFixture]
|
||||
@@ -40,12 +42,14 @@ namespace MonoTests.Remoting
|
||||
AppDomain domain = BaseCallTest.CreateDomain ("testdomain_activation");
|
||||
server = (ActivationServer) domain.CreateInstanceAndUnwrap(GetType().Assembly.FullName,"MonoTests.Remoting.ActivationServer");
|
||||
|
||||
RemotingConfiguration.RegisterActivatedClientType (typeof(CaObject1), "tcp://localhost:9433");
|
||||
RemotingConfiguration.RegisterActivatedClientType (typeof(CaObject2), "http://localhost:9434");
|
||||
RemotingConfiguration.RegisterWellKnownClientType (typeof(WkObjectSinglecall1), "tcp://localhost:9433/wkoSingleCall1");
|
||||
RemotingConfiguration.RegisterWellKnownClientType (typeof(WkObjectSingleton1), "tcp://localhost:9433/wkoSingleton1");
|
||||
RemotingConfiguration.RegisterWellKnownClientType (typeof(WkObjectSinglecall2), "http://localhost:9434/wkoSingleCall2");
|
||||
RemotingConfiguration.RegisterWellKnownClientType (typeof(WkObjectSingleton2), "http://localhost:9434/wkoSingleton2");
|
||||
var tcpUrlPrefix = $"tcp://localhost:{server.TcpPort}";
|
||||
var httpUrlPrefix = $"http://localhost:{server.HttpPort}";
|
||||
RemotingConfiguration.RegisterActivatedClientType (typeof(CaObject1), tcpUrlPrefix);
|
||||
RemotingConfiguration.RegisterActivatedClientType (typeof(CaObject2), httpUrlPrefix);
|
||||
RemotingConfiguration.RegisterWellKnownClientType (typeof(WkObjectSinglecall1), tcpUrlPrefix + "/wkoSingleCall1");
|
||||
RemotingConfiguration.RegisterWellKnownClientType (typeof(WkObjectSingleton1), tcpUrlPrefix + "/wkoSingleton1");
|
||||
RemotingConfiguration.RegisterWellKnownClientType (typeof(WkObjectSinglecall2), httpUrlPrefix + "/wkoSingleCall2");
|
||||
RemotingConfiguration.RegisterWellKnownClientType (typeof(WkObjectSingleton2), httpUrlPrefix + "/wkoSingleton2");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -163,8 +167,10 @@ namespace MonoTests.Remoting
|
||||
|
||||
public ActivationServer ()
|
||||
{
|
||||
tcp = new TcpChannel (9433);
|
||||
http = new HttpChannel (9434);
|
||||
TcpPort = NetworkHelpers.FindFreePort ();
|
||||
HttpPort = NetworkHelpers.FindFreePort ();
|
||||
tcp = new TcpChannel (TcpPort);
|
||||
http = new HttpChannel (HttpPort);
|
||||
|
||||
ChannelServices.RegisterChannel (tcp);
|
||||
ChannelServices.RegisterChannel (http);
|
||||
@@ -182,6 +188,9 @@ namespace MonoTests.Remoting
|
||||
ChannelServices.UnregisterChannel (tcp);
|
||||
ChannelServices.UnregisterChannel (http);
|
||||
}
|
||||
|
||||
public int TcpPort { get; private set; }
|
||||
public int HttpPort { get; private set; }
|
||||
}
|
||||
|
||||
public class BaseObject: MarshalByRefObject
|
||||
|
@@ -16,6 +16,8 @@ using System.Runtime.Remoting.Channels.Ipc;
|
||||
using System.Threading;
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.Remoting
|
||||
{
|
||||
public interface INested
|
||||
@@ -166,15 +168,16 @@ namespace MonoTests.Remoting
|
||||
[Test]
|
||||
public void TestTcpChannel ()
|
||||
{
|
||||
var port = NetworkHelpers.FindFreePort ();
|
||||
IDictionary props = new Hashtable ();
|
||||
props ["name"] = Guid.NewGuid ().ToString("N");
|
||||
props ["port"] = 18191;
|
||||
props ["port"] = port;
|
||||
TcpChannel chan = new TcpChannel (props, null, null);
|
||||
ChannelServices.RegisterChannel (chan);
|
||||
|
||||
try {
|
||||
Register <Server<object>> ("gentcptest.rem");
|
||||
RunTests (Connect <Server<object>> ("tcp://localhost:18191/gentcptest.rem"));
|
||||
RunTests (Connect <Server<object>> ($"tcp://localhost:{port}/gentcptest.rem"));
|
||||
} finally {
|
||||
ChannelServices.UnregisterChannel (chan);
|
||||
}
|
||||
|
@@ -7,6 +7,8 @@ using System.Runtime.Remoting.Channels;
|
||||
using System.Runtime.Remoting.Channels.Http;
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.Remoting.Http
|
||||
{
|
||||
//Test for Bug 324362 - SoapFormatter cannot deserialize the same MBR twice
|
||||
@@ -67,13 +69,14 @@ namespace MonoTests.Remoting.Http
|
||||
[Test]
|
||||
public void Main ()
|
||||
{
|
||||
channel = new HttpChannel (3344);
|
||||
var port = NetworkHelpers.FindFreePort ();
|
||||
channel = new HttpChannel (port);
|
||||
ChannelServices.RegisterChannel (channel);
|
||||
RemotingConfiguration.RegisterWellKnownServiceType
|
||||
(typeof (Bug321420),"Server.soap", WellKnownObjectMode.Singleton);
|
||||
|
||||
Bug321420 s = (Bug321420) Activator.GetObject (typeof
|
||||
(Bug321420), "http://localhost:3344/Server.soap");
|
||||
(Bug321420), $"http://localhost:{port}/Server.soap");
|
||||
|
||||
// this works: s.Method ("a", "b");
|
||||
s.Method ("a", "a");
|
||||
@@ -98,7 +101,7 @@ namespace MonoTests.Remoting.Http
|
||||
public void Main ()
|
||||
{
|
||||
Foo foo = (Foo) Activator.GetObject (typeof (Foo),
|
||||
"http://localhost:4321/Test");
|
||||
$"http://localhost:{server.HttpPort}/Test");
|
||||
|
||||
Bar bar = foo.Login ();
|
||||
if (bar != null)
|
||||
@@ -142,7 +145,8 @@ namespace MonoTests.Remoting.Http
|
||||
|
||||
public void Start ()
|
||||
{
|
||||
c = new HttpChannel (4321);
|
||||
HttpPort = NetworkHelpers.FindFreePort ();
|
||||
c = new HttpChannel (HttpPort);
|
||||
ChannelServices.RegisterChannel (c);
|
||||
|
||||
Type t = typeof(Foo);
|
||||
@@ -155,6 +159,8 @@ namespace MonoTests.Remoting.Http
|
||||
c.StopListening (null);
|
||||
ChannelServices.UnregisterChannel (c);
|
||||
}
|
||||
|
||||
public int HttpPort { get; private set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +178,7 @@ namespace MonoTests.Remoting.Http
|
||||
ChannelServices.RegisterChannel (channel);
|
||||
MarshalByRefObject obj = (MarshalByRefObject) RemotingServices.Connect (
|
||||
typeof (IFactorial),
|
||||
"http://localhost:60000/MyEndPoint");
|
||||
$"http://localhost:{server.HttpPort}/MyEndPoint");
|
||||
IFactorial cal = (IFactorial) obj;
|
||||
Assert.AreEqual (cal.CalculateFactorial (4), 24);
|
||||
}
|
||||
@@ -209,7 +215,8 @@ namespace MonoTests.Remoting.Http
|
||||
|
||||
public void Start ()
|
||||
{
|
||||
c = new HttpChannel (60000);
|
||||
HttpPort = NetworkHelpers.FindFreePort ();
|
||||
c = new HttpChannel (HttpPort);
|
||||
ChannelServices.RegisterChannel (c);
|
||||
|
||||
Type t = typeof(Calculator);
|
||||
@@ -222,6 +229,8 @@ namespace MonoTests.Remoting.Http
|
||||
c.StopListening (null);
|
||||
ChannelServices.UnregisterChannel (c);
|
||||
}
|
||||
|
||||
public int HttpPort { get; private set; }
|
||||
}
|
||||
|
||||
public class Calculator : MarshalByRefObject, IFactorial
|
||||
|
@@ -28,7 +28,6 @@ namespace MonoTests.Remoting
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore ("https://bugzilla.xamarin.com/show_bug.cgi?id=36634")]
|
||||
public void Bug609381 ()
|
||||
{
|
||||
string portName = "ipc" + Guid.NewGuid ().ToString ("N");
|
||||
|
@@ -18,6 +18,8 @@ using System.Runtime.Remoting.Proxies;
|
||||
using System.Runtime.Remoting.Channels;
|
||||
using System.Runtime.Remoting.Channels.Tcp;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.Runtime.Remoting.RemotingServicesInternal
|
||||
{
|
||||
// We need our own proxy to intercept messages to remote object
|
||||
@@ -286,17 +288,18 @@ namespace MonoTests.Remoting
|
||||
[Test]
|
||||
public void Connect ()
|
||||
{
|
||||
var port = NetworkHelpers.FindFreePort ();
|
||||
MarshalObject objMarshal = NewMarshalObject ();
|
||||
|
||||
IDictionary props = new Hashtable ();
|
||||
props ["name"] = objMarshal.Uri;
|
||||
props ["port"] = 1236;
|
||||
props ["port"] = port;
|
||||
TcpChannel chn = new TcpChannel (props, null, null);
|
||||
ChannelServices.RegisterChannel (chn);
|
||||
|
||||
try {
|
||||
RemotingServices.Marshal (objMarshal, objMarshal.Uri);
|
||||
MarshalObject objRem = (MarshalObject) RemotingServices.Connect (typeof (MarshalObject), "tcp://localhost:1236/" + objMarshal.Uri);
|
||||
MarshalObject objRem = (MarshalObject) RemotingServices.Connect (typeof (MarshalObject), $"tcp://localhost:{port}/" + objMarshal.Uri);
|
||||
Assert.IsTrue (RemotingServices.IsTransparentProxy (objRem), "#A08");
|
||||
} finally {
|
||||
ChannelServices.UnregisterChannel (chn);
|
||||
@@ -308,17 +311,18 @@ namespace MonoTests.Remoting
|
||||
[Test]
|
||||
public void MarshalThrowException ()
|
||||
{
|
||||
var port = NetworkHelpers.FindFreePort ();
|
||||
MarshalObject objMarshal = NewMarshalObject ();
|
||||
|
||||
IDictionary props = new Hashtable ();
|
||||
props ["name"] = objMarshal.Uri;
|
||||
props ["port"] = 1237;
|
||||
props ["port"] = port;
|
||||
TcpChannel chn = new TcpChannel (props, null, null);
|
||||
ChannelServices.RegisterChannel (chn);
|
||||
|
||||
try {
|
||||
RemotingServices.Marshal (objMarshal, objMarshal.Uri);
|
||||
MarshalObject objRem = (MarshalObject) RemotingServices.Connect (typeof (MarshalObject), "tcp://localhost:1237/" + objMarshal.Uri);
|
||||
MarshalObject objRem = (MarshalObject) RemotingServices.Connect (typeof (MarshalObject), $"tcp://localhost:{port}/" + objMarshal.Uri);
|
||||
// This line should throw a RemotingException
|
||||
// It is forbidden to export an object which is not
|
||||
// a real object
|
||||
@@ -341,14 +345,15 @@ namespace MonoTests.Remoting
|
||||
[Test]
|
||||
public void ExecuteMessage ()
|
||||
{
|
||||
TcpChannel chn = new TcpChannel (1235);
|
||||
var port = NetworkHelpers.FindFreePort ();
|
||||
TcpChannel chn = new TcpChannel (port);
|
||||
ChannelServices.RegisterChannel (chn);
|
||||
try {
|
||||
MarshalObject objMarshal = NewMarshalObject ();
|
||||
RemotingConfiguration.RegisterWellKnownServiceType (typeof (MarshalObject), objMarshal.Uri, WellKnownObjectMode.SingleCall);
|
||||
|
||||
// use a proxy to catch the Message
|
||||
MyProxy proxy = new MyProxy (typeof (MarshalObject), (MarshalObject) Activator.GetObject (typeof (MarshalObject), "tcp://localhost:1235/" + objMarshal.Uri));
|
||||
MyProxy proxy = new MyProxy (typeof (MarshalObject), (MarshalObject) Activator.GetObject (typeof (MarshalObject), $"tcp://localhost:{port}/" + objMarshal.Uri));
|
||||
|
||||
MarshalObject objRem = (MarshalObject) proxy.GetTransparentProxy ();
|
||||
|
||||
@@ -373,12 +378,13 @@ namespace MonoTests.Remoting
|
||||
[Test]
|
||||
public void IsOneWay ()
|
||||
{
|
||||
TcpChannel chn = new TcpChannel (1238);
|
||||
var port = NetworkHelpers.FindFreePort ();
|
||||
TcpChannel chn = new TcpChannel (port);
|
||||
ChannelServices.RegisterChannel (chn);
|
||||
try {
|
||||
RemotingConfiguration.RegisterWellKnownServiceType (typeof (MarshalObject), "MarshalObject.rem", WellKnownObjectMode.Singleton);
|
||||
|
||||
MarshalObject objRem = (MarshalObject) Activator.GetObject (typeof (MarshalObject), "tcp://localhost:1238/MarshalObject.rem");
|
||||
MarshalObject objRem = (MarshalObject) Activator.GetObject (typeof (MarshalObject), $"tcp://localhost:{port}/MarshalObject.rem");
|
||||
|
||||
Assert.IsTrue (RemotingServices.IsTransparentProxy (objRem), "#A10.1");
|
||||
|
||||
@@ -396,13 +402,14 @@ namespace MonoTests.Remoting
|
||||
[Test]
|
||||
public void GetObjRefForProxy ()
|
||||
{
|
||||
TcpChannel chn = new TcpChannel (1239);
|
||||
var port = NetworkHelpers.FindFreePort ();
|
||||
TcpChannel chn = new TcpChannel (port);
|
||||
ChannelServices.RegisterChannel (chn);
|
||||
try {
|
||||
// Register le factory as a SAO
|
||||
RemotingConfiguration.RegisterWellKnownServiceType (typeof (MarshalObjectFactory), "MonoTests.System.Runtime.Remoting.RemotingServicesTest.Factory.soap", WellKnownObjectMode.Singleton);
|
||||
|
||||
MarshalObjectFactory objFactory = (MarshalObjectFactory) Activator.GetObject (typeof (MarshalObjectFactory), "tcp://localhost:1239/MonoTests.System.Runtime.Remoting.RemotingServicesTest.Factory.soap");
|
||||
MarshalObjectFactory objFactory = (MarshalObjectFactory) Activator.GetObject (typeof (MarshalObjectFactory), $"tcp://localhost:{port}/MonoTests.System.Runtime.Remoting.RemotingServicesTest.Factory.soap");
|
||||
|
||||
// Get a new "CAO"
|
||||
MarshalObject objRem = objFactory.GetNewMarshalObject ();
|
||||
@@ -419,12 +426,13 @@ namespace MonoTests.Remoting
|
||||
[Test]
|
||||
public void GetRealProxy ()
|
||||
{
|
||||
TcpChannel chn = new TcpChannel (1241);
|
||||
var port = NetworkHelpers.FindFreePort ();
|
||||
TcpChannel chn = new TcpChannel (port);
|
||||
ChannelServices.RegisterChannel (chn);
|
||||
try {
|
||||
RemotingConfiguration.RegisterWellKnownServiceType (typeof (MarshalObject), "MonoTests.System.Runtime.Remoting.RemotingServicesTest.MarshalObject.soap", WellKnownObjectMode.Singleton);
|
||||
|
||||
MyProxy proxy = new MyProxy (typeof (MarshalObject), (MarshalByRefObject) Activator.GetObject (typeof (MarshalObject), "tcp://localhost:1241/MonoTests.System.Runtime.Remoting.RemotingServicesTest.MarshalObject.soap"));
|
||||
MyProxy proxy = new MyProxy (typeof (MarshalObject), (MarshalByRefObject) Activator.GetObject (typeof (MarshalObject), $"tcp://localhost:{port}/MonoTests.System.Runtime.Remoting.RemotingServicesTest.MarshalObject.soap"));
|
||||
MarshalObject objRem = (MarshalObject) proxy.GetTransparentProxy ();
|
||||
|
||||
RealProxy rp = RemotingServices.GetRealProxy (objRem);
|
||||
@@ -440,14 +448,15 @@ namespace MonoTests.Remoting
|
||||
[Test]
|
||||
public void SetObjectUriForMarshal ()
|
||||
{
|
||||
TcpChannel chn = new TcpChannel (1242);
|
||||
var port = NetworkHelpers.FindFreePort ();
|
||||
TcpChannel chn = new TcpChannel (port);
|
||||
ChannelServices.RegisterChannel (chn);
|
||||
try {
|
||||
MarshalObject objRem = NewMarshalObject ();
|
||||
RemotingServices.SetObjectUriForMarshal (objRem, objRem.Uri);
|
||||
RemotingServices.Marshal (objRem);
|
||||
|
||||
objRem = (MarshalObject) Activator.GetObject (typeof (MarshalObject), "tcp://localhost:1242/" + objRem.Uri);
|
||||
objRem = (MarshalObject) Activator.GetObject (typeof (MarshalObject), $"tcp://localhost:{port}/" + objRem.Uri);
|
||||
Assert.IsNotNull (objRem, "#A14");
|
||||
} finally {
|
||||
ChannelServices.UnregisterChannel (chn);
|
||||
@@ -459,7 +468,8 @@ namespace MonoTests.Remoting
|
||||
[Test]
|
||||
public void GetServeurTypeForUri ()
|
||||
{
|
||||
TcpChannel chn = new TcpChannel (1243);
|
||||
var port = NetworkHelpers.FindFreePort ();
|
||||
TcpChannel chn = new TcpChannel (port);
|
||||
Type type = typeof (MarshalObject);
|
||||
ChannelServices.RegisterChannel (chn);
|
||||
try {
|
||||
@@ -480,12 +490,13 @@ namespace MonoTests.Remoting
|
||||
[Category ("NotWorking")]
|
||||
public void IsObjectOutOf ()
|
||||
{
|
||||
TcpChannel chn = new TcpChannel (1245);
|
||||
var port = NetworkHelpers.FindFreePort ();
|
||||
TcpChannel chn = new TcpChannel (port);
|
||||
ChannelServices.RegisterChannel (chn);
|
||||
try {
|
||||
RemotingConfiguration.RegisterWellKnownServiceType (typeof (MarshalObject), "MarshalObject2.rem", WellKnownObjectMode.Singleton);
|
||||
|
||||
MarshalObject objRem = (MarshalObject) Activator.GetObject (typeof (MarshalObject), "tcp://localhost:1245/MarshalObject2.rem");
|
||||
MarshalObject objRem = (MarshalObject) Activator.GetObject (typeof (MarshalObject), $"tcp://localhost:{port}/MarshalObject2.rem");
|
||||
|
||||
Assert.IsTrue (RemotingServices.IsObjectOutOfAppDomain (objRem), "#A16");
|
||||
Assert.IsTrue (RemotingServices.IsObjectOutOfContext (objRem), "#A17");
|
||||
@@ -501,14 +512,15 @@ namespace MonoTests.Remoting
|
||||
[Test]
|
||||
public void ApplicationNameTest ()
|
||||
{
|
||||
var port = NetworkHelpers.FindFreePort ();
|
||||
RemotingConfiguration.ApplicationName = "app";
|
||||
TcpChannel chn = new TcpChannel (1246);
|
||||
TcpChannel chn = new TcpChannel (port);
|
||||
ChannelServices.RegisterChannel (chn);
|
||||
try {
|
||||
RemotingConfiguration.RegisterWellKnownServiceType (typeof (MarshalObject), "obj3.rem", WellKnownObjectMode.Singleton);
|
||||
|
||||
MarshalObject objRem = (MarshalObject) Activator.GetObject (typeof (MarshalObject), "tcp://localhost:1246/app/obj3.rem");
|
||||
MarshalObject objRem2 = (MarshalObject) Activator.GetObject (typeof (MarshalObject), "tcp://localhost:1246/obj3.rem");
|
||||
MarshalObject objRem = (MarshalObject) Activator.GetObject (typeof (MarshalObject), $"tcp://localhost:{port}/app/obj3.rem");
|
||||
MarshalObject objRem2 = (MarshalObject) Activator.GetObject (typeof (MarshalObject), $"tcp://localhost:{port}/obj3.rem");
|
||||
|
||||
Assert.IsTrue (RemotingServices.IsTransparentProxy (objRem), "#AN1");
|
||||
Assert.IsTrue (RemotingServices.IsTransparentProxy (objRem2), "#AN2");
|
||||
@@ -528,13 +540,14 @@ namespace MonoTests.Remoting
|
||||
[Test]
|
||||
public void GetObjectWithChannelDataTest ()
|
||||
{
|
||||
TcpChannel chn = new TcpChannel (1247);
|
||||
var port = NetworkHelpers.FindFreePort ();
|
||||
TcpChannel chn = new TcpChannel (port);
|
||||
ChannelServices.RegisterChannel (chn);
|
||||
try {
|
||||
RemotingConfiguration.RegisterWellKnownServiceType (typeof (MarshalObject), "getobjectwithchanneldata.rem", WellKnownObjectMode.Singleton);
|
||||
|
||||
string channelData = "test";
|
||||
Assert.IsNotNull (Activator.GetObject (typeof (MarshalObject), "tcp://localhost:1247/getobjectwithchanneldata.rem", channelData), "#01");
|
||||
Assert.IsNotNull (Activator.GetObject (typeof (MarshalObject), $"tcp://localhost:{port}/getobjectwithchanneldata.rem", channelData), "#01");
|
||||
} finally {
|
||||
ChannelServices.UnregisterChannel (chn);
|
||||
}
|
||||
@@ -544,28 +557,29 @@ namespace MonoTests.Remoting
|
||||
[Ignore ("We cannot test RemotingConfiguration.Configure() because it keeps channels registered. If we really need to test it, do it as a standalone case")]
|
||||
public void ConnectProxyCast ()
|
||||
{
|
||||
var port = NetworkHelpers.FindFreePort ();
|
||||
object o;
|
||||
RemotingConfiguration.Configure (null);
|
||||
|
||||
o = RemotingServices.Connect (typeof (MarshalByRefObject), "tcp://localhost:3434/ff1.rem");
|
||||
o = RemotingServices.Connect (typeof (MarshalByRefObject), $"tcp://localhost:{port}/ff1.rem");
|
||||
Assert.IsInstanceOfType (typeof (DD), o, "#m1");
|
||||
Assert.IsInstanceOfType (typeof (A), o, "#m2");
|
||||
Assert.IsInstanceOfType (typeof (B), o, "#m3");
|
||||
AssertHelper.IsNotInstanceOfType (typeof (CC), !(o is CC), "#m4");
|
||||
|
||||
o = RemotingServices.Connect (typeof (A), "tcp://localhost:3434/ff3.rem");
|
||||
o = RemotingServices.Connect (typeof (A), $"tcp://localhost:{port}/ff3.rem");
|
||||
Assert.IsInstanceOfType (typeof (DD), o, "#a1");
|
||||
Assert.IsInstanceOfType (typeof (A), o, "#a2");
|
||||
Assert.IsInstanceOfType (typeof (B), o, "#a3");
|
||||
AssertHelper.IsNotInstanceOfType (typeof (CC), o, "#a4");
|
||||
|
||||
o = RemotingServices.Connect (typeof (DD), "tcp://localhost:3434/ff4.rem");
|
||||
o = RemotingServices.Connect (typeof (DD), $"tcp://localhost:{port}/ff4.rem");
|
||||
Assert.IsInstanceOfType (typeof (DD), o, "#d1");
|
||||
Assert.IsInstanceOfType (typeof (A), o, "#d2");
|
||||
Assert.IsInstanceOfType (typeof (B), o, "#d3");
|
||||
AssertHelper.IsNotInstanceOfType (typeof (CC), o, "#d4");
|
||||
|
||||
o = RemotingServices.Connect (typeof (CC), "tcp://localhost:3434/ff5.rem");
|
||||
o = RemotingServices.Connect (typeof (CC), $"tcp://localhost:{port}/ff5.rem");
|
||||
AssertHelper.IsNotInstanceOfType (typeof (DD), o, "#c1");
|
||||
Assert.IsInstanceOfType (typeof (A), o, "#c2");
|
||||
Assert.IsInstanceOfType (typeof (B), o, "#c3");
|
||||
|
@@ -35,6 +35,8 @@ using System.Runtime.Remoting.Channels.Tcp;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.Remoting
|
||||
{
|
||||
[TestFixture]
|
||||
@@ -50,9 +52,10 @@ namespace MonoTests.Remoting
|
||||
|
||||
MarshalObject marshal = new MarshalObject ();
|
||||
|
||||
var port = NetworkHelpers.FindFreePort ();
|
||||
IDictionary props = new Hashtable ();
|
||||
props ["name"] = "marshal channel";
|
||||
props ["port"] = 1236;
|
||||
props ["port"] = port;
|
||||
props ["bindTo"] = IPAddress.Loopback.ToString ();
|
||||
chn = new TcpChannel (props, null, null);
|
||||
|
||||
@@ -62,11 +65,11 @@ namespace MonoTests.Remoting
|
||||
urls = chn.GetUrlsForUri (SERVICE_URI);
|
||||
Assert.IsNotNull (urls, "#A2");
|
||||
Assert.AreEqual (1, urls.Length, "#A3");
|
||||
Assert.AreEqual ("tcp://" + IPAddress.Loopback.ToString () + ":1236/" + SERVICE_URI, urls [0], "#A6");
|
||||
Assert.AreEqual ($"tcp://{IPAddress.Loopback.ToString ()}:{port}/{SERVICE_URI}", urls [0], "#A6");
|
||||
ds = chn.ChannelData as ChannelDataStore;
|
||||
Assert.IsNotNull (ds, "#A4");
|
||||
Assert.AreEqual (1, ds.ChannelUris.Length, "#A5");
|
||||
Assert.AreEqual ("tcp://" + IPAddress.Loopback.ToString () + ":1236", ds.ChannelUris [0], "#A6");
|
||||
Assert.AreEqual ($"tcp://{IPAddress.Loopback.ToString ()}:{port}", ds.ChannelUris [0], "#A6");
|
||||
|
||||
ChannelServices.UnregisterChannel (chn);
|
||||
|
||||
|
Reference in New Issue
Block a user