Hashtable h = new Hashtable ();
foreach (DictionaryEntry e in props) {
+ h [e.Key] = e.Value;
+
switch (e.Key as string) {
case "portName":
h ["path"] = BuildPathFromPortName ((string)e.Value);
break;
- default:
- h [e.Key] = e.Value;
- break;
}
}
return h;
public IpcServerChannel (string name, string portName)
{
- _portName = portName = BuildPathFromPortName (portName);
+ _portName = portName;
+ _path = portName = BuildPathFromPortName (portName);
_innerChannel = Activator.CreateInstance(UnixChannelLoader.LoadServerChannel (), new object [] {name, portName});
}
return payload;
}
}
+
+ [Test]
+ public void TestCtor2 ()
+ {
+ string channelName = Guid.NewGuid ().ToString ("N");
+ string portName = "ipc" + Guid.NewGuid ().ToString ("N");
+ string url = String.Format ("ipc://{0}/server.rem", portName);
+
+ IpcServerChannel chan = new IpcServerChannel (channelName, portName);
+ string[] uris = chan.GetUrlsForUri ("server.rem");
+ Assert.IsNotNull (uris);
+ Assert.Greater (uris.Length, 0);
+
+ bool found = false;
+ foreach (string s in uris) {
+ if (s == url) {
+ found = true;
+ break;
+ }
+ }
+ Assert.IsTrue (found);
+ }
+
+ [Test]
+ public void TestCtor3 ()
+ {
+ string portName = "ipc" + Guid.NewGuid ().ToString ("N");
+ string url = String.Format ("ipc://{0}/server.rem", portName);
+
+ Hashtable props = new Hashtable ();
+ props ["portName"] = portName;
+ IpcChannel chan = new IpcChannel (props, null, null);
+ string[] uris = chan.GetUrlsForUri ("server.rem");
+ Assert.IsNotNull (uris);
+ Assert.Greater (uris.Length, 0);
+
+ bool found = false;
+ foreach (string s in uris) {
+ if (s == url) {
+ found = true;
+ break;
+ }
+ }
+ Assert.IsTrue (found);
+ }
}
}