public void CopyToBytesTest(int value) { byte[] buf = new byte[8]; BinaryHelper.Write(m_buffer, 4, value); var pw = new PtrWriter(m_buffer, 64); pw.CopyTo(buf, 0, 8); Assert.AreEqual(value, BinaryHelper.Read <int>(buf, 4)); }
public void CopyToPtrTest(int value) { BinaryHelper.Write(m_buffer, 4, value); var pw = new PtrWriter(m_buffer, 64); var newBuf = Marshal.AllocHGlobal(8); pw.CopyTo(newBuf, 0, 8); Assert.AreEqual(value, BinaryHelper.Read <int>(newBuf, 4)); Marshal.FreeHGlobal(newBuf); }