public void UrlEncodeString() { var data = Enumerable.Range(0, 20).Select(v => (byte)v).ToArray(); var value = new BEncodedString(data); var encoded = value.UrlEncode(); var decoded = BEncodedString.UrlDecode(encoded); Assert.IsTrue(data.AsSpan().SequenceEqual(decoded.Span)); }
public void BEncodedString_FromUrlEncodedString() { Assert.Throws <System.ArgumentNullException> (() => BEncodedString.UrlDecode(null)); Assert.AreEqual(new BEncodedString(""), BEncodedString.UrlDecode("")); }