Beispiel #1
0
        /// <summary>
        /// Writes a NameValuePair to the Stream.
        /// </summary>
        public void Write(NameValuePair nvp)
        {
            if (nvp == null)
            {
                throw new ArgumentNullException("nvp");
            }

            foreach (var seg in nvp.GetBytes())
            {
                ParamsStream.Write(seg.Array, seg.Offset, seg.Count);
            }
        }
Beispiel #2
0
        public void CreateBytesFromNvp11()
        {
            var rec = new NameValuePair("name", "value");

            int i = 0;

            byte[] buf = new byte[50];
            GetNVP11(buf, 0);
            foreach (var seg in rec.GetBytes())
            {
                Assert.That(ByteUtils.SegmentsEqual(seg, new ArraySegment <byte>(buf, i, seg.Count)));
                i += seg.Count;
            }
        }