Ejemplo n.º 1
0
 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"));
 }
Ejemplo n.º 2
0
 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"));
 }
Ejemplo n.º 3
0
 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"));
 }
Ejemplo n.º 4
0
 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"));
 }
Ejemplo n.º 5
0
 public void UrlDecodeMinimal()
 {
     foreach (var testCase in testData.testCases)
     {
         var decoded = B2UrlEncoder.Decode(testCase.minimallyEncoded);
         Assert.AreEqual(testCase.s, decoded);
     }
 }