コード例 #1
0
        public void PacksBytes()
        {
            var inputs = new[] { null, new byte[0], new byte[0xFF], new byte[0xFFFF], new byte[0x10000], new byte[] { 1, 2, 3 } };

            foreach (var i in inputs)
            {
                _stream.Position = 0;

                _packer.Pack(i);

                _stream.Position = 0;

                byte[] result;
                Assert.True(_unpacker.ReadBinary(out result));
                Assert.Equal(i, result);
            }
        }
コード例 #2
0
        public void PacksBytes()
        {
            var inputs = new[] { new byte[0xFF], /*new byte[0xFFFF], null, new byte[0], new byte[0x10000], new byte[] {1,2,3}*/ };

            foreach (var i in inputs)
            {
                _stream.Position = 0;

                _packer.Pack(i);
                _packer.Flush();

                _stream.Position = 0;

                byte[] result;
                Assert.True(_unpacker.ReadBinary(out result));
                if (i != null)
                {
                    Assert.Equal(i.Length, result.Length);
                }
                Assert.Equal(i, result);
            }
        }