Exemple #1
0
        public void benListEncoding()
        {
            byte[]       data = Encoding.UTF8.GetBytes("l4:test5:tests6:testede");
            BEncodedList list = new BEncodedList {
                new BEncodedString("test"),
                new BEncodedString("tests"),
                new BEncodedString("tested")
            };

            Assert.IsTrue(data.AsSpan().SequenceEqual(list.Encode()));
        }
Exemple #2
0
        public void benListEncodingBuffered()
        {
            byte[]       data = Encoding.UTF8.GetBytes("l4:test5:tests6:testede");
            BEncodedList list = new BEncodedList {
                new BEncodedString("test"),
                new BEncodedString("tests"),
                new BEncodedString("tested")
            };

            byte[] result = new byte[list.LengthInBytes()];
            list.Encode(result);
            Assert.IsTrue(data.AsSpan().SequenceEqual(result));
        }