public void CanEncode_NumbersAndSpecialCharacters() { var bstring = new BString("123:?!#{}'|<>"); var bencode = bstring.EncodeAsString(); bencode.Should().Be("13:123:?!#{}'|<>"); }
public void CanEncode_EmptyString() { var bstring = new BString(""); var bencode = bstring.EncodeAsString(); bencode.Should().Be("0:"); }
public void CanEncode_UTF8() { var bstring = new BString("æøå äö èéê ñ", Encoding.UTF8); var bencode = bstring.EncodeAsString(); bencode.Should().Be("21:æøå äö èéê ñ"); }
public void CanEncode(string str, int length) { var bstring = new BString(str); var bencode = bstring.EncodeAsString(); bencode.Should().Be($"{length}:{str}"); }
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:æøå äö èéê ñ"); }
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:æøå äö èéê ñ"); }