Example #1
0
        public void EscapeAsciiStringTest()
        {
            var value  = "hello";
            var actual = PctEncoding.Escape(value, CharSpec.Safe);

            Assert.AreSame(value, actual);
        }
Example #2
0
        public void EscapeStringTest()
        {
            var value  = "ha+ха+ho+хо";
            var actual = PctEncoding.Escape(value, CharSpec.Safe);

            Assert.AreEqual("ha%2B%D1%85%D0%B0%2Bho%2B%D1%85%D0%BE", actual);
        }
Example #3
0
        public void EscapeFirstNonAsciiPartOfStringTest()
        {
            var value  = "привет, world!";
            var actual = PctEncoding.Escape(value, CharSpec.ExtendedSafe);

            Assert.AreEqual("%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82,%20world!", actual);
        }
Example #4
0
        public void EscapeLastNonAsiiPartOfStringTest()
        {
            var value  = "hello, мир!";
            var actual = PctEncoding.Escape(value, CharSpec.ExtendedSafe);

            Assert.AreEqual("hello,%20%D0%BC%D0%B8%D1%80!", actual);
        }
Example #5
0
        public void EscapeNonAsciiStringTest()
        {
            var value  = "мир";
            var actual = PctEncoding.Escape(value, CharSpec.ExtendedSafe);

            Assert.AreEqual("%D0%BC%D0%B8%D1%80", actual);
        }
Example #6
0
        public void EscapeAsciiStringWithoutReservedCharsTest()
        {
            var value  = "hello, world!";
            var actual = PctEncoding.Escape(value, CharSpec.Safe);

            Assert.AreEqual("hello%2C%20world%21", actual);
        }