public void ManagedStream() { managedStream.ResetRead(m_byteBuf); for (int i = 0; i < AMOUNT; i++) { int result = managedStream.Read <int>(); } }
public void ReadWriteTest() { bs.ResetWrite(m_buffer); bs.Write(123); bs.ResetRead(); int res = 0; bs.Read(ref res); Assert.AreEqual(123, res); }
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); }
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)); }
public void ResetReadFault() { ManagedStream bs = new ManagedStream(); Assert.Catch <InvalidOperationException>(() => { bs.ResetRead(); }); }