public void does_not_override_an_existing_correlation_id()
        {
            var headers = new NameValueHeaders();

            headers[Envelope.IdKey] = "FOO";

            var envelope = new Envelope(headers);

            envelope.CorrelationId.ShouldEqual("FOO");
        }
示例#2
0
        public void if_no_content_type_is_specified_on_envelope_or_channel_use_graph_default()
        {
            theGraph.DefaultContentType = "text/json";
            theNode.DefaultContentType  = null;

            var headers = new NameValueHeaders();

            theReceiver.Receive(new byte[0], headers, MockRepository.GenerateMock <IMessageCallback>());

            headers[Envelope.ContentTypeKey].ShouldBe("text/json");
        }
        public void if_no_content_type_is_specified_use_channel_default_when_it_exists()
        {
            theGraph.DefaultContentType = "text/json";
            theNode.DefaultContentType  = "text/xml";


            var headers = new NameValueHeaders();

            theReceiver.Receive(new byte[0], headers, MockRepository.GenerateMock <IMessageCallback>());

            headers[Envelope.ContentTypeKey].ShouldEqual("text/xml");
        }
        public void get_keys_from_name_value_collection()
        {
            var values = new NameValueCollection();

            values["a"] = "1";
            values["b"] = "2";
            values["c"] = "3";

            var headers = new NameValueHeaders(values);

            headers.Keys().ShouldHaveTheSameElementsAs("a", "b", "c");
        }
        public void name_value_has()
        {
            var values = new NameValueCollection();

            values["a"] = "1";
            values["b"] = "2";

            var headers = new NameValueHeaders(values);

            headers.Has("a").ShouldBeTrue();
            headers.Has("c").ShouldBeFalse();
        }
示例#6
0
        public void the_envelope_content_type_wins()
        {
            theGraph.DefaultContentType = "text/json";
            theNode.DefaultContentType  = "text/xml";


            var headers = new NameValueHeaders();

            headers[Envelope.ContentTypeKey] = "text/plain";
            theReceiver.Receive(new byte[0], headers, MockRepository.GenerateMock <IMessageCallback>());

            headers[Envelope.ContentTypeKey].ShouldBe("text/plain");
        }
        public void get_and_set_with_name_value_collection()
        {
            var values = new NameValueCollection();

            values["a"] = "1";
            values["b"] = "2";

            var headers = new NameValueHeaders(values);

            headers["a"].ShouldEqual("1");
            headers["b"].ShouldEqual("2");

            headers["c"] = "3";

            values["c"].ShouldEqual("3");
        }
示例#8
0
        protected sealed override void beforeEach()
        {
            theData     = new byte[] { 1, 2, 3, 4 };
            theMessage  = new OneMessage();
            theCallback = MockFor <IMessageCallback>();
            theHeaders  = new NameValueHeaders();

            theLogger = new RecordingLogger();

            theEnvelope = new Envelope(theData, theHeaders, theCallback)
            {
                Message = theMessage
            };
            theEnvelope.Message.ShouldBeTheSameAs(theMessage);

            Services.Inject <ILogger>(theLogger);

            Services.PartialMockTheClassUnderTest();
            theContextIs();
        }
示例#9
0
        protected override void beforeEach()
        {
            theChannel = MockFor <IChannel>();
            theChannel.Stub(x => x.Address).Return(address);

            theNode = new ChannelNode
            {
                DefaultContentType = "application/json",
                Channel            = theChannel,
                Uri = address
            };

            Services.Inject(theNode);

            MockFor <IChainInvoker>().Stub(x => x.Invoke(null)).IgnoreArguments();

            theCallback = MockRepository.GenerateMock <IMessageCallback>();
            theData     = new byte[] { 1, 2, 3 };
            theHeaders  = new NameValueHeaders();
            theHeaders[Envelope.AttemptsKey] = "2";

            ClassUnderTest.Receive(theData, theHeaders, theCallback);
        }
示例#10
0
 public EnvelopeToken()
 {
     Headers       = new NameValueHeaders();
     CorrelationId = Guid.NewGuid().ToString();
 }