Пример #1
0
        public void CanEncode_NumbersAndSpecialCharacters()
        {
            var bstring = new BString("123:?!#{}'|<>");
            var bencode = bstring.EncodeAsString();

            bencode.Should().Be("13:123:?!#{}'|<>");
        }
Пример #2
0
        public void CanEncode_EmptyString()
        {
            var bstring = new BString("");
            var bencode = bstring.EncodeAsString();

            bencode.Should().Be("0:");
        }
Пример #3
0
        public void CanEncode_UTF8()
        {
            var bstring = new BString("æøå äö èéê ñ", Encoding.UTF8);
            var bencode = bstring.EncodeAsString();

            bencode.Should().Be("21:æøå äö èéê ñ");
        }
Пример #4
0
        public void CanEncode(string str, int length)
        {
            var bstring = new BString(str);
            var bencode = bstring.EncodeAsString();

            bencode.Should().Be($"{length}:{str}");
        }
Пример #5
0
        public void CanEncode_ISO88591()
        {
            var encoding = Encoding.GetEncoding("ISO-8859-1");
            var bstring  = new BString("æøå äö èéê ñ", encoding);

            var bencode = bstring.EncodeAsString(encoding);

            bencode.Should().Be("12:æøå äö èéê ñ");
        }
Пример #6
0
        public void CanEncode_ISO88591()
        {
            var encoding = Encoding.GetEncoding("ISO-8859-1");
            var bstring = new BString("æøå äö èéê ñ", encoding);

            var bencode = bstring.EncodeAsString(encoding);

            bencode.Should().Be("12:æøå äö èéê ñ");
        }
Пример #7
0
        public void CanEncode_ISO88591_WithoutSpecifyingEncoding()
        {
            var encoding = Encoding.GetEncoding("ISO-8859-1");
            var bytes    = encoding.GetBytes("æøå äö èéê ñ");
            var bstring  = new BString(bytes);

            var bencode = bstring.EncodeAsString(encoding);

            bencode.Should().Be("12:æøå äö èéê ñ");
        }
Пример #8
0
        public void CanEncode_ISO88591_WithoutSpecifyingEncoding()
        {
            var encoding = Encoding.GetEncoding("ISO-8859-1");
            var bytes = encoding.GetBytes("æøå äö èéê ñ");
            var bstring = new BString(bytes);

            var bencode = bstring.EncodeAsString(encoding);

            bencode.Should().Be("12:æøå äö èéê ñ");
        }
Пример #9
0
 public void CanEncode_UTF8()
 {
     var bstring = new BString("æøå äö èéê ñ", Encoding.UTF8);
     var bencode = bstring.EncodeAsString();
     bencode.Should().Be("21:æøå äö èéê ñ");
 }
Пример #10
0
 public void CanEncode_NumbersAndSpecialCharacters()
 {
     var bstring = new BString("123:?!#{}'|<>");
     var bencode = bstring.EncodeAsString();
     bencode.Should().Be("13:123:?!#{}'|<>");
 }
Пример #11
0
 public void CanEncode_EmptyString()
 {
     var bstring = new BString("");
     var bencode = bstring.EncodeAsString();
     bencode.Should().Be("0:");
 }
Пример #12
0
 public void CanEncode(string str, int length)
 {
     var bstring = new BString(str);
     var bencode = bstring.EncodeAsString();
     bencode.Should().Be($"{length}:{str}");
 }