コード例 #1
0
        public void benStringEncodingBuffered()
        {
            byte[] data = System.Text.Encoding.UTF8.GetBytes("22:this is my test string");

            BEncodedString benString = new BEncodedString("this is my test string");

            byte[] result = new byte[benString.LengthInBytes()];
            benString.Encode(result, 0);
            Assert.IsTrue(Toolbox.ByteMatch(data, result));
        }
コード例 #2
0
        public void benStringLengthInBytes()
        {
            string text = "thisisateststring";

            BEncodedString str    = text;
            int            length = text.Length;

            length += text.Length.ToString().Length;
            length++;

            Assert.AreEqual(length, str.LengthInBytes());
        }
コード例 #3
0
ファイル: BEncodingTest.cs プロジェクト: burris/monotorrent
        public void benStringEncodingBuffered()
        {
            byte[] data = System.Text.Encoding.UTF8.GetBytes("22:this is my test string");

            BEncodedString benString = new BEncodedString("this is my test string");
            byte[] result = new byte[benString.LengthInBytes()];
            benString.Encode(result, 0);
            Assert.IsTrue(Toolbox.ByteMatch(data, result));
        }
コード例 #4
0
        public void benStringEncodingBuffered()
        {
            var data = Encoding.UTF8.GetBytes("22:this is my test string");

            var benString = new BEncodedString("this is my test string");
            var result = new byte[benString.LengthInBytes()];
            benString.Encode(result, 0);
            Assert.True(Toolbox.ByteMatch(data, result));
        }