public void GetAbsolutePath_HttpRelative() { string path; var basePathList = new string[] { "http://example.com", "http://example.com/", "http://example.com/index.html", }; foreach (var basePath in basePathList) { path = FilePathUtility.GetAbsolutePath("./path", basePath); Assert.AreEqual($"{httpUrl}/path", path); } basePathList = new string[] { "http://example.com/sub/", "http://example.com/sub/index.html", }; foreach (var basePath in basePathList) { path = FilePathUtility.GetAbsolutePath("./path", basePath); Assert.AreEqual($"{httpUrl}/sub/path", path); } }
public void GetAbsolutePath_FileRelative() { string path; var basePath = @"C:\foo\bar\foobar.xml"; path = FilePathUtility.GetAbsolutePath("path", basePath); Assert.AreEqual(@"C:\foo\bar\path", path); path = FilePathUtility.GetAbsolutePath("C:\\path", basePath); Assert.AreEqual(@"C:\path", path); path = FilePathUtility.GetAbsolutePath("./path", basePath); Assert.AreEqual(@"C:\foo\bar\path", path); }