public static object RemoteCallback(object dummy)
 {
     BinaryIpcServerChannel serverChannel = new BinaryIpcServerChannel(PortName);
     TestService serviceProvider = new TestService();
     serverChannel.RegisterService(ServiceName, serviceProvider);
     return null;
 }
        /// <summary>
        /// Creates a test isolation client.
        /// </summary>
        /// <param name="ipcPortName">The IPC port name.</param>
        /// <param name="linkId">The unique id of the client/server pair.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="ipcPortName"/> is null.</exception>
        public TestIsolationClient(string ipcPortName, Guid linkId)
        {
            if (ipcPortName == null)
                throw new ArgumentNullException("ipcPortName");

            this.linkId = linkId;

            clientChannel = new BinaryIpcClientChannel(ipcPortName);
            serverChannel = new BinaryIpcServerChannel(ipcPortName + ".ClientCallback");
        }
        /// <summary>
        /// Creates a test isolation server.
        /// </summary>
        /// <param name="ipcPortName">The IPC port name.</param>
        /// <param name="linkId">The unique id of the client/server pair.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="ipcPortName"/> is null.</exception>
        public TestIsolationServer(string ipcPortName, Guid linkId)
        {
            if (ipcPortName == null)
                throw new ArgumentNullException("ipcPortName");

            serverChannel = new BinaryIpcServerChannel(ipcPortName);
            clientChannel = new BinaryIpcClientChannel(ipcPortName + ".ServerCallback");
            activeTasks = new Dictionary<Guid, IsolatedTaskState>();

            MessageConsumer messageConsumer = new MessageConsumer()
                .Handle<IsolatedTaskFinishedMessage>(HandleIsolatedTaskFinished);

            messageExchange = new MessageExchange(messageConsumer);
            serverChannel.RegisterService(GetMessageExchangeLinkServiceName(linkId), messageExchange);
        }
 public void RegisterServiceThrowsIfComponentIsNull()
 {
     using (BinaryIpcServerChannel channel = new BinaryIpcServerChannel("port"))
         channel.RegisterService("service", null);
 }
 public void RegisterServiceThrowsIfServiceNameIsNull()
 {
     using (BinaryIpcServerChannel channel = new BinaryIpcServerChannel("port"))
         channel.RegisterService(null, Mocks.Stub<MarshalByRefObject>());
 }