Exemplo n.º 1
0
        public void should_rpc_async()
        {
            var server = new TestRpcServer(_connection);
            var client = new TestRpcClient(_connection);

            server.Channel.EnsureExchange();
            server.Channel.EnsureQueue();

            server.Serve(x => x);

            Message responseMessage = null;

            var response = client.Call(_publishMessage, x => responseMessage = x);

            response.ShouldNotBeNull();
            response.Error.ShouldBeFalse();

            Thread.Sleep(Timeout);

            responseMessage.ShouldNotBeNull();
            responseMessage.Text.ShouldEqual(_publishMessage.Text);
            System.Diagnostics.Trace.WriteLine(_publishMessage.Text);
            client.Close();

            server.Channel.DeleteQueue();
            server.Channel.DeleteExchange();
            server.Close();
        }
Exemplo n.º 2
0
        public void should_rpc()
        {
            var server = new TestRpcServer(_connection);
            var client = new TestRpcClient(_connection);

            server.Channel.EnsureExchange();
            server.Channel.EnsureQueue();

            server.Serve(x => x);

            var response = client.Call(_publishMessage, Timeout);

            response.ShouldNotBeNull();
            response.Error.ShouldBeFalse();
            response.Message.ShouldNotBeNull();
            response.Message.Text.ShouldEqual(_publishMessage.Text);

            client.Close();

            server.Channel.DeleteQueue();
            server.Channel.DeleteExchange();
            server.Close();
        }