Exemplo n.º 1
0
        public void ManagedStream()
        {
            managedStream.ResetRead(m_byteBuf);

            for (int i = 0; i < AMOUNT; i++)
            {
                int result = managedStream.Read <int>();
            }
        }
Exemplo n.º 2
0
        public void ReadWriteTest()
        {
            bs.ResetWrite(m_buffer);

            bs.Write(123);

            bs.ResetRead();

            int res = 0;

            bs.Read(ref res);
            Assert.AreEqual(123, res);
        }
Exemplo n.º 3
0
        public void ResetStreamer()
        {
            ManagedStream bs = new ManagedStream();

            bs.ResetWrite(new byte[8], true);

            bs.Write <int>(333);

            Assert.AreEqual(4, bs.Offset);
            Assert.IsTrue(bs.IsWriting);

            bs.ResetRead();

            Assert.AreEqual(0, bs.Offset);
            Assert.IsTrue(bs.IsReading);
        }
Exemplo n.º 4
0
        public void LargeStringWrite()
        {
            ManagedStream ms = new ManagedStream();

            ms.ResetWrite(2);

            StringBuilder sb = new StringBuilder(50);

            for (int i = 0; i < 50; i++)
            {
                sb.Append(i);
            }

            var str = sb.ToString();

            ms.WriteString(str, Encoding.Default);

            Assert.IsTrue(ms.Length >= 64);

            ms.ResetRead();

            Assert.AreEqual(str, ms.ReadString(Encoding.Default));
        }
Exemplo n.º 5
0
        public void ResetReadFault()
        {
            ManagedStream bs = new ManagedStream();

            Assert.Catch <InvalidOperationException>(() => { bs.ResetRead(); });
        }