Exemplo n.º 1
0
        public void TestDecodeThenEncodeTheSamString(string expected)
        {
            Bencode   bEncode = new Bencode();
            BNodeBase bNode   = bEncode.Decode(Encoding.ASCII.GetBytes(expected));

            byte[] actual = bEncode.Encode(bNode);
            Assert.Equal(Encoding.ASCII.GetBytes(expected), actual);
        }
Exemplo n.º 2
0
        public void TestMultiFileTorrentDecodeEncodeCheckTheSameAfter()
        {
            Bencode bEncode = new Bencode();

            byte[]    expected    = System.IO.File.ReadAllBytes(Constants.MultiFileTorrent);
            BNodeBase torrentBase = bEncode.Decode(expected);

            byte[] actual = bEncode.Encode(torrentBase);
            Assert.Equal(expected, actual);
        }