Esempio n. 1
0
        public void UriUtil_ValidUri_Test()
        {
            var relativeUrl = "test/1.html";

            Assert.True(UriUtil.IsValidUri(relativeUrl));
            var absoluteUrl = "/test/1.html";

            Assert.True(UriUtil.IsValidUri(absoluteUrl));
            Assert.True(UriUtil.IsValidUri(dataUrl));
            var httpUrl = "http://test.com/1";

            Assert.True(UriUtil.IsValidUri(httpUrl));
            if (UriUtil.IsWin())
            {
                var windowsUrl = @"c:\1\2\";
                Assert.True(UriUtil.IsValidUri(windowsUrl));
                var windowsUrl2 = @"\1\2\";
                Assert.True(UriUtil.IsValidUri(windowsUrl2));
            }
            else
            {
                var unixUrl = "/1/2/";
                Assert.True(UriUtil.IsValidUri(unixUrl));
            }

            var fileUrl = "file:///d:/1/2";

            Assert.True(UriUtil.IsValidUri(fileUrl));
        }