|
|
|
|
@@ -31,4 +31,87 @@ public class WebPathTests
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void Combine_must_handle_null() => Assert.Throws<ArgumentNullException>(() => WebPath.Combine(null));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
[TestCase("ftp://hello.com/", UriKind.Absolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("file:///hello.com/", UriKind.Absolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("ws://hello.com/", UriKind.Absolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("wss://hello.com/", UriKind.Absolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("https://hello.com:8080/", UriKind.Absolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("http://hello.com:8080/", UriKind.Absolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("https://hello.com/path", UriKind.Absolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("http://hello.com/path", UriKind.Absolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("https://hello.com/path?query=param", UriKind.Absolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("http://hello.com/path?query=param", UriKind.Absolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("https://hello.com/path#fragment", UriKind.Absolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("http://hello.com/path#fragment", UriKind.Absolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("https://hello.com/path?query=param#fragment", UriKind.Absolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("http://hello.com/path?query=param#fragment", UriKind.Absolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("https://hello.com:8080/path?query=param#fragment", UriKind.Absolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("http://hello.com:8080/path?query=param#fragment", UriKind.Absolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("//hello.com:8080/path?query=param#fragment", UriKind.Absolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("//hello.com:8080/path", UriKind.Absolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("//hello.com:8080", UriKind.Absolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("//hello.com", UriKind.Absolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("/test/test.jpg", UriKind.Absolute, ExpectedResult = false)]
|
|
|
|
|
[TestCase("/test", UriKind.Absolute, ExpectedResult = false)]
|
|
|
|
|
[TestCase("test", UriKind.Absolute, ExpectedResult = false)]
|
|
|
|
|
[TestCase("", UriKind.Absolute, ExpectedResult = false)]
|
|
|
|
|
[TestCase(null, UriKind.Absolute, ExpectedResult = false)]
|
|
|
|
|
[TestCase("this is not welformed", UriKind.Absolute, ExpectedResult = false)]
|
|
|
|
|
[TestCase("ftp://hello.com/", UriKind.Relative, ExpectedResult = false)]
|
|
|
|
|
[TestCase("file:///hello.com/", UriKind.Relative, ExpectedResult = false)]
|
|
|
|
|
[TestCase("ws://hello.com/", UriKind.Relative, ExpectedResult = false)]
|
|
|
|
|
[TestCase("wss://hello.com/", UriKind.Relative, ExpectedResult = false)]
|
|
|
|
|
[TestCase("https://hello.com:8080/", UriKind.Relative, ExpectedResult = false)]
|
|
|
|
|
[TestCase("http://hello.com:8080/", UriKind.Relative, ExpectedResult = false)]
|
|
|
|
|
[TestCase("https://hello.com/path", UriKind.Relative, ExpectedResult = false)]
|
|
|
|
|
[TestCase("http://hello.com/path", UriKind.Relative, ExpectedResult = false)]
|
|
|
|
|
[TestCase("https://hello.com/path?query=param", UriKind.Relative, ExpectedResult = false)]
|
|
|
|
|
[TestCase("http://hello.com/path?query=param", UriKind.Relative, ExpectedResult = false)]
|
|
|
|
|
[TestCase("https://hello.com/path#fragment", UriKind.Relative, ExpectedResult = false)]
|
|
|
|
|
[TestCase("http://hello.com/path#fragment", UriKind.Relative, ExpectedResult = false)]
|
|
|
|
|
[TestCase("https://hello.com/path?query=param#fragment", UriKind.Relative, ExpectedResult = false)]
|
|
|
|
|
[TestCase("http://hello.com/path?query=param#fragment", UriKind.Relative, ExpectedResult = false)]
|
|
|
|
|
[TestCase("https://hello.com:8080/path?query=param#fragment", UriKind.Relative, ExpectedResult = false)]
|
|
|
|
|
[TestCase("http://hello.com:8080/path?query=param#fragment", UriKind.Relative, ExpectedResult = false)]
|
|
|
|
|
[TestCase("//hello.com:8080/path?query=param#fragment", UriKind.Relative, ExpectedResult = false)]
|
|
|
|
|
[TestCase("//hello.com:8080/path", UriKind.Relative, ExpectedResult = false)]
|
|
|
|
|
[TestCase("//hello.com:8080", UriKind.Relative, ExpectedResult = false)]
|
|
|
|
|
[TestCase("//hello.com", UriKind.Relative, ExpectedResult = false)]
|
|
|
|
|
[TestCase("/test/test.jpg", UriKind.Relative, ExpectedResult = true)]
|
|
|
|
|
[TestCase("/test", UriKind.Relative, ExpectedResult = true)]
|
|
|
|
|
[TestCase("test", UriKind.Relative, ExpectedResult = true)]
|
|
|
|
|
[TestCase("", UriKind.Relative, ExpectedResult = false)]
|
|
|
|
|
[TestCase(null, UriKind.Relative, ExpectedResult = false)]
|
|
|
|
|
[TestCase("this is not welformed", UriKind.Relative, ExpectedResult = false)]
|
|
|
|
|
[TestCase("ftp://hello.com/", UriKind.RelativeOrAbsolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("file:///hello.com/", UriKind.RelativeOrAbsolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("ws://hello.com/", UriKind.RelativeOrAbsolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("wss://hello.com/", UriKind.RelativeOrAbsolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("https://hello.com:8080/", UriKind.RelativeOrAbsolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("http://hello.com:8080/", UriKind.RelativeOrAbsolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("https://hello.com/path", UriKind.RelativeOrAbsolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("http://hello.com/path", UriKind.RelativeOrAbsolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("https://hello.com/path?query=param", UriKind.RelativeOrAbsolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("http://hello.com/path?query=param", UriKind.RelativeOrAbsolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("https://hello.com/path#fragment", UriKind.RelativeOrAbsolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("http://hello.com/path#fragment", UriKind.RelativeOrAbsolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("https://hello.com/path?query=param#fragment", UriKind.RelativeOrAbsolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("http://hello.com/path?query=param#fragment", UriKind.RelativeOrAbsolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("https://hello.com:8080/path?query=param#fragment", UriKind.RelativeOrAbsolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("http://hello.com:8080/path?query=param#fragment", UriKind.RelativeOrAbsolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("//hello.com:8080/path?query=param#fragment", UriKind.RelativeOrAbsolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("//hello.com:8080/path", UriKind.RelativeOrAbsolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("//hello.com:8080", UriKind.RelativeOrAbsolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("//hello.com", UriKind.RelativeOrAbsolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("/test/test.jpg", UriKind.RelativeOrAbsolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("/test", UriKind.RelativeOrAbsolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("test", UriKind.RelativeOrAbsolute, ExpectedResult = true)]
|
|
|
|
|
[TestCase("", UriKind.RelativeOrAbsolute, ExpectedResult = false)]
|
|
|
|
|
[TestCase(null, UriKind.RelativeOrAbsolute, ExpectedResult = false)]
|
|
|
|
|
[TestCase("this is not welformed", UriKind.RelativeOrAbsolute, ExpectedResult = false)]
|
|
|
|
|
public bool IsWellFormedWebPath(string? webPath, UriKind uriKind) => WebPath.IsWellFormedWebPath(webPath, uriKind);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|