コード例 #1
0
        public void TransportHeadersIPAddressSerialization()
        {
            var ip = IPAddress.Parse("192.168.254.104");
            var th = new TransportHeaders();

            th[CommonTransportKeys.IPAddress]  = ip;
            th[CommonTransportKeys.RequestUri] = "localhost";

            var ms = TransportHeaderWrapper.Serialize(th);

            Assert.IsNotNull(ms);

            ms.Position = 0;
            var th2 = TransportHeaderWrapper.Deserialize(ms);

            foreach (System.Collections.DictionaryEntry pair in th)
            {
                Assert.AreEqual(th[pair.Key], th2[pair.Key]);
            }
        }
コード例 #2
0
        public void TransportHeadersSimpleTypesSerialization()
        {
            var th = new TransportHeaders();

            th["Hehe"] = 123;
            th["Hoho"] = DateTime.Now;
            th["Haha"] = "localhost";

            var ms = TransportHeaderWrapper.Serialize(th);

            Assert.IsNotNull(ms);

            ms.Position = 0;
            var th2 = TransportHeaderWrapper.Deserialize(ms);

            foreach (System.Collections.DictionaryEntry pair in th)
            {
                Assert.AreEqual(th[pair.Key], th2[pair.Key]);
            }
        }