コード例 #1
0
        public void ReadByteArrayTest()
        {
            string           filePath = "RAFReadByteArrayTest.arr";
            RandomAccessFile target   = InitRAF(filePath);

            byte[] buffer = new byte[2];
            target.ReadByteArray(buffer);
            for (int i = 0; i < buffer.Length; i++)
            {
                Assert.AreEqual(0, buffer[i]);
            }

            target.Close();
        }
コード例 #2
0
        public void WriteByteArrayTest()
        {
            string           filePath = "RAFWriteByteArrayTest.arr";
            RandomAccessFile target   = InitRAF(filePath);

            byte[] buffer = new byte[] { 5, 6, 7, };
            target.WriteByteArray(buffer);
            target.Seek(0);

            byte[] actual = new byte[buffer.Length];
            target.ReadByteArray(actual);

            for (int i = 0; i < buffer.Length; i++)
            {
                Assert.AreEqual(buffer[i], actual[i]);
            }

            target.Close();
        }