コード例 #1
0
        private void TestLocation(string id, string str, UriToStringDelegate toString, bool testRelative = true)
        {
            TestScheme(scheme => {
                string uri    = scheme + str;
                string actual = toString(new Uri(scheme + str, UriKind.Absolute));
                StringTester.Assert(scheme + id, actual);
            });

            if (!testRelative)
            {
                return;
            }

            string relActual = toString(new Uri("./" + str, UriKind.Relative));

            StringTester.Assert("./" + id, relActual);
        }
コード例 #2
0
        public void PercentageEncoding_Unescape()
        {
            TestChars(str => {
                var sbUpper = new StringBuilder();
                var sbLower = new StringBuilder();
                foreach (char c in str)
                {
                    sbUpper.Append(HexEscapeMultiByte(c, true));
                    sbLower.Append(HexEscapeMultiByte(c, false));
                }
                string escapedUpperStr = sbUpper.ToString();
                string escapedLowerStr = sbLower.ToString();

                StringTester.Assert(str + "[Unescaped]", UriEx.UnescapeString("file://a/", str));
                StringTester.Assert(escapedUpperStr + "[EscapedUpper]", UriEx.UnescapeString("file://a/", escapedUpperStr));
                StringTester.Assert(escapedLowerStr + "[EscapedLower]", UriEx.UnescapeString("file://a/", escapedLowerStr));
            });

            foreach (var str in specialCases)
            {
                StringTester.Assert(str, UriEx.UnescapeString("file://a/", str));
            }
        }
コード例 #3
0
 public void Teardown()
 {
     StringTester.Save();
 }