Ejemplo n.º 1
0
        public void TestMethod1()
        {
            var basePath = @"C:\Users\Administrator\source\repos\DwrUtility";
            var fullPath = @"C:\Users\Administrator\source\repos";

            var relativePath = RelativeHelper.FullPathToRelativePath(basePath, fullPath);

            Assert.IsTrue(relativePath.IsEquals("../repos"));
        }
Ejemplo n.º 2
0
        public void TestMethod5()
        {
            string basePath = null;
            var    fullPath = @"C:/Users/Administrator/source/repos";

            var relativePath = RelativeHelper.FullPathToRelativePath(basePath, fullPath);

            Assert.IsTrue(relativePath.IsEquals(@""));
        }
Ejemplo n.º 3
0
        public void TestMethod6()
        {
            var    basePath = @"C:/Users/Administrator";
            string fullPath = null;

            var relativePath = RelativeHelper.FullPathToRelativePath(basePath, fullPath);

            Assert.IsTrue(relativePath.IsEquals(@""));
        }
Ejemplo n.º 4
0
        public void TestMethod9()
        {
            var baseUrl     = "http://www.demo.com/test/index.html";
            var relativeUrl = "/Next/default.html";

            var baseUri = baseUrl.ToUri();

            var url = RelativeHelper.RelativePathToUrl(baseUri, relativeUrl);

            Assert.IsTrue(url.IsEquals("http://www.demo.com/Next/default.html"));
        }
Ejemplo n.º 5
0
        public void TestMethod4()
        {
            var    baseUrl     = "http://www.demo.com/index.html";
            string relativeUrl = null;

            var baseUri = baseUrl.ToUri();

            var url = RelativeHelper.RelativePathToUrl(baseUri, relativeUrl);

            Assert.IsTrue(url.IsEquals("http://www.demo.com/index.html"));
        }
Ejemplo n.º 6
0
        public void TestMethod3()
        {
            var baseUrl     = "http://www.demo.com/index.html";
            var relativeUrl = "Home/Index";

            var baseUri = baseUrl.ToUri();

            var url = RelativeHelper.RelativePathToUrl(baseUri, relativeUrl);

            Assert.IsTrue(url.IsEquals("http://www.demo.com/Home/Index"));
        }
Ejemplo n.º 7
0
        public void TestMethod18()
        {
            var baseUrl     = "http://www.demo.com/demo/test/index.html";
            var relativeUrl = "../../../td/rr/ww/def.html";

            var baseUri = baseUrl.ToUri();

            var url = RelativeHelper.RelativePathToUrl(baseUri, relativeUrl);

            Assert.IsTrue(url.IsEquals("http://www.demo.com/td/rr/ww/def.html"));
        }
Ejemplo n.º 8
0
        public void TestMethod22()
        {
            var baseUrl = "http://www.demo.com/demo/test/index.html";
            var url     = "http://www.demo.com/demo/rr//ww/def.html";

            var baseUri = baseUrl.ToUri();
            var uri     = url.ToUri();

            var toUrl = RelativeHelper.UriToRelativePath(baseUri, uri);

            Assert.IsTrue(toUrl.IsEquals("../rr//ww/def.html"));
        }