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 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");
        }
 public EnvelopeToken()
 {
     Headers = new NameValueHeaders();
     CorrelationId = Guid.NewGuid().ToString();
 }
예제 #4
0
        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");
        }
        // virtual for testing of course
        public virtual IHeaders Send(Envelope envelope, Uri replyUri = null)
        {
            var clone = new NameValueHeaders();
            envelope.Headers.Keys().Each(key => clone[key] = envelope.Headers[key]);

            clone[Envelope.DestinationKey] = Uri.ToString();
            clone[Envelope.ChannelKey] = Key;

            if (replyUri != null)
            {
                clone[Envelope.ReplyUriKey] = replyUri.ToString();
            }

            Channel.Send(envelope.Data, clone);

            return clone;
        }
        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();
        }