示例#1
0
        public void ReadFromResponse()
        {
            var fields = new Dictionary <string, string> {
                { "age", "15" },
                { "Name", "Andrew" },
                { "Location", "http://hostb/pathB" },
                { "Timestamp", XmlConvert.ToString(DateTime.UtcNow, XmlDateTimeSerializationMode.Utc) },
            };

            MemoryStream ms     = new MemoryStream();
            StreamWriter writer = new StreamWriter(ms);

            writer.Write(MessagingUtilities.CreateQueryString(fields));
            writer.Flush();
            ms.Seek(0, SeekOrigin.Begin);
            Channel_Accessor             channelAccessor    = Channel_Accessor.AttachShadow(this.channel);
            IDictionary <string, string> deserializedFields = channelAccessor.ReadFromResponseCore(new CachedDirectWebResponse {
                CachedResponseStream = ms
            });

            Assert.AreEqual(fields.Count, deserializedFields.Count);
            foreach (string key in fields.Keys)
            {
                Assert.AreEqual(fields[key], deserializedFields[key]);
            }
        }
        private static IMessageFactory GetMessageFactory(Channel channel)
        {
            Contract.Requires <ArgumentNullException>(channel != null);

            Channel_Accessor accessor = Channel_Accessor.AttachShadow(channel);

            return(accessor.MessageFactory);
        }
示例#3
0
        public void TooManyBindingElementsProvidingSameProtection()
        {
            Channel channel = new TestChannel(
                new TestMessageFactory(),
                new MockSigningBindingElement(),
                new MockSigningBindingElement());
            Channel_Accessor accessor = Channel_Accessor.AttachShadow(channel);

            accessor.ProcessOutgoingMessage(new TestSignedDirectedMessage());
        }
        protected override void ProcessIncomingMessage(IProtocolMessage message)
        {
            Channel_Accessor accessor = Channel_Accessor.AttachShadow(this.wrappedChannel);

            accessor.ProcessIncomingMessage(message);
        }
        protected override IDictionary <string, string> ReadFromResponseCore(IncomingWebResponse response)
        {
            Channel_Accessor accessor = Channel_Accessor.AttachShadow(this.wrappedChannel);

            return(accessor.ReadFromResponseCore(response));
        }