コード例 #1
0
        public void WriteBytes()
        {
            using (var stream = new MemoryStream())
            {
                var bytes  = Encoding.UTF8.GetBytes("Hello");
                var writer = new CompressedBinaryWriter(stream);

                var total = writer.Write(bytes);
                stream.Position = 0;

                var reader = new CompressedBinaryReader(stream);

                var readBytes = reader.ReadBytes();
                Assert.IsTrue(readBytes.Length == bytes.Length);
                Assert.IsTrue(ByteExtensions.Equals(readBytes, bytes));
                Assert.IsTrue(stream.Length == total);
            }
        }