コード例 #1
0
        public static object RemoteCallback(object dummy)
        {
            BinaryIpcServerChannel serverChannel   = new BinaryIpcServerChannel(PortName);
            TestService            serviceProvider = new TestService();

            serverChannel.RegisterService(ServiceName, serviceProvider);
            return(null);
        }
コード例 #2
0
        /// <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");
        }
コード例 #3
0
        /// <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);
        }
コード例 #4
0
 public void RegisterServiceThrowsIfComponentIsNull()
 {
     using (BinaryIpcServerChannel channel = new BinaryIpcServerChannel("port"))
         channel.RegisterService("service", null);
 }
コード例 #5
0
 public void RegisterServiceThrowsIfServiceNameIsNull()
 {
     using (BinaryIpcServerChannel channel = new BinaryIpcServerChannel("port"))
         channel.RegisterService(null, Mocks.Stub <MarshalByRefObject>());
 }