public void when_starting_twice_then_ignores_second_request()
        {
            var receiver = new SubscriptionReceiver(this.Settings, this.Topic, this.Subscription);

            receiver.Start(m => MessageReleaseAction.CompleteMessage);

            receiver.Start(m => MessageReleaseAction.CompleteMessage);
        }
        public void when_starting_twice_then_ignores_second_request()
        {
            var receiver = new SubscriptionReceiver(this.Settings, this.Topic, this.Subscription);

            receiver.Start();

            receiver.Start();
        }
        public void when_sending_message_then_can_receive_it()
        {
            var sender = new TopicSender(this.Settings, this.Topic);
            Data data = new Data { Id = Guid.NewGuid(), Title = "Foo" };
            Data received = null;
            using (var receiver = new SubscriptionReceiver(this.Settings, this.Topic, this.Subscription))
            {
                var signal = new ManualResetEventSlim();

                receiver.Start(
                    m =>
                    {
                        received = m.GetBody<Data>();
                        signal.Set();
                        return MessageReleaseAction.CompleteMessage;
                    });

                sender.SendAsync(() => new BrokeredMessage(data));

                signal.Wait();
            }

            Assert.NotNull(received);
            Assert.Equal(data.Id, received.Id);
            Assert.Equal(data.Title, received.Title);
        }