Esempio n. 1
0
        public void should_publish_and_subscribe_through_direct_queue_async()
        {
            var publisher  = new TestDirectPublisher(_connection);
            var subscriber = new TestDirectSubscriber(_connection);

            publisher.Channel.EnsureExchange();
            subscriber.Channel.EnsureQueue();

            publisher.Publish(_publishMessage);

            Message responseMessage = null;
            var     response        = subscriber.Subscribe(x => responseMessage = x);

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

            Thread.Sleep(Timeout);

            responseMessage.ShouldNotBeNull();
            responseMessage.Text.ShouldEqual(_publishMessage.Text);

            subscriber.Channel.DeleteQueue();
            subscriber.Close();

            publisher.Channel.DeleteExchange();
            publisher.Close();
        }
Esempio n. 2
0
        public void should_publish_and_subscribe_through_direct_queue()
        {
            var publisher  = new TestDirectPublisher(_connection);
            var subscriber = new TestDirectSubscriber(_connection);

            publisher.Channel.EnsureExchange();
            subscriber.Channel.EnsureQueue();

            publisher.Publish(_publishMessage);
            var response = subscriber.Dequeue(Timeout);

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

            subscriber.Channel.DeleteQueue();
            subscriber.Close();

            publisher.Channel.DeleteExchange();
            publisher.Close();
        }