示例#1
0
        public void Insert_BeginningOfStream_SetsCorrectData()
        {
            var stream = new HttpResponseStream ();
            var write_buffer = new byte [10];
            var write_buffer2 = new byte [10];

            stream.Write (write_buffer, 0, 10);
            stream.Position = 0;

            write_buffer2 [2] = 0xFA;
            stream.Insert (write_buffer2, 0, 10);

            stream.Position = 2;
            var data = stream.ReadByte ();
            Assert.AreEqual (0xFA, data);
        }
示例#2
0
        public void Insert_BeginningOfStream_SetsCorrectData()
        {
            var stream        = new HttpResponseStream();
            var write_buffer  = new byte [10];
            var write_buffer2 = new byte [10];


            stream.Write(write_buffer, 0, 10);
            stream.Position = 0;

            write_buffer2 [2] = 0xFA;
            stream.Insert(write_buffer2, 0, 10);

            stream.Position = 2;
            var data = stream.ReadByte();

            Assert.AreEqual(0xFA, data);
        }
        public void ReadByteThrows()
        {
            var stream = new HttpResponseStream(Mock.Of <IHttpBodyControlFeature>(), new MockHttpResponseControl());

            Assert.Throws <NotSupportedException>(() => stream.ReadByte());
        }