public void ShouldThrowOn16BitCharacter() { Assert.That(() => B2UrlEncoder.Decode("abc\u263A"), Throws.Exception .TypeOf <ArgumentException>() .With.Message.EqualTo("Invalid URL encoded string 'abc\u263A': found 16-bit code point at position 3")); }
public void ShouldThrowOnInvalidAsciiCharacter() { Assert.That(() => B2UrlEncoder.Decode("abc\n"), Throws.Exception .TypeOf <ArgumentException>() .With.Message.EqualTo("Invalid URL encoded string 'abc\n' - invalid character '\n' at position 3")); }
public void ShouldThrowOnInvalidHexDigit() { Assert.That(() => B2UrlEncoder.Decode("%2!2"), Throws.Exception .TypeOf <ArgumentException>() .With.Message.EqualTo("Invalid URL encoded string '%2!2' at position 2 - Unable to parse '!' as a hex digit")); }
public void ShouldThrowOnTruncatedString() { Assert.That(() => B2UrlEncoder.Decode("%2"), Throws.Exception .TypeOf <ArgumentException>() .With.Message.EqualTo("Invalid URL encoded string '%2' - Expected hex digit but string was truncated")); }
public void UrlDecodeMinimal() { foreach (var testCase in testData.testCases) { var decoded = B2UrlEncoder.Decode(testCase.minimallyEncoded); Assert.AreEqual(testCase.s, decoded); } }