public void apply_the_destination()
        {
            var message1 = new Message1();

            var sender = new SendDirectlyTo("tcp://server3:2222", message1);

            var original = ObjectMother.Envelope();

            var created = sender.CreateEnvelope(original);

            created.Message.ShouldBe(message1);
            created.Destination.ShouldBe("tcp://server3:2222".ToUri());
        }
        public void create_and_send_to_correct_destination()
        {
            var destination    = new Uri("memory://blah");
            var message        = new Message1();
            var sendDirectlyTo = new SendDirectlyTo(destination, message);

            var original = MockRepository.GenerateMock <Envelope>();
            var response = new Envelope();

            original.Stub(x => x.ForSend(message)).Return(response);

            sendDirectlyTo.CreateEnvelope(original).ShouldBeTheSameAs(response);
            response.Destination.ShouldBe(destination);
        }
        public void create_and_send_to_correct_destination()
        {
            var destination = new Uri("memory://blah");
            var message = new Events.Message1();
            var sendDirectlyTo = new SendDirectlyTo(destination, message);

            var original = MockRepository.GenerateMock<Envelope>();
            var response = new Envelope();

            original.Stub(x => x.ForSend(message)).Return(response);

            sendDirectlyTo.CreateEnvelope(original).ShouldBeTheSameAs(response);
            response.Destination.ShouldEqual(destination);
        }