public void TildePrefixedPathMorphAsSiteRootPrependedByDefault() { var manager = new DefaultResourcePathManager(new SparkSettings()); var path = manager.GetResourcePath("/my/webapp", "~/content/js/jquery.1.2.6.js"); Assert.AreEqual("/my/webapp/content/js/jquery.1.2.6.js", path); }
public void NormalUrlPathsAreUnchanged() { var manager = new DefaultResourcePathManager(new SparkSettings()); var path = manager.GetResourcePath("", "/content/js/jquery.1.2.6.js"); Assert.AreEqual("/content/js/jquery.1.2.6.js", path); }
public void SiteRootPrependedByDefaultEnsureSlashBetweenSiteRootAndPath() { var manager = new DefaultResourcePathManager(new SparkSettings()); var path = manager.GetResourcePath("/my/webapp", "content/js/jquery.1.2.6.js"); Assert.AreEqual("/my/webapp/content/js/jquery.1.2.6.js", path); path = manager.GetResourcePath("/my/webapp/", "/content/js/jquery.1.2.6.js"); Assert.AreEqual("/my/webapp/content/js/jquery.1.2.6.js", path); }
public void SiteRootPrependedByDefaultEnsureSlashBetweenSiteRootAndPath() { var manager = new DefaultResourcePathManager(new SparkSettings()); var path = manager.GetResourcePath("/my/webapp", "content/js/jquery.1.2.6.js"); Assert.AreEqual("/my/webapp/content/js/jquery.1.2.6.js", path); path = manager.GetResourcePath("/my/webapp/", "/content/js/jquery.1.2.6.js"); Assert.AreEqual("/my/webapp/content/js/jquery.1.2.6.js", path); }
public void ReplacingJustSomePrefixesThatHaveTildeNoStop() { var settings = new SparkSettings() .AddResourceMapping("~/content/js", "http://my.cdn.com/myaccount/content/js", false); var manager = new DefaultResourcePathManager(settings); var path = manager.GetResourcePath("/my/webapp", "~/content/js/jquery.1.2.6.js"); Assert.AreEqual("http://my.cdn.com/myaccount/content/js/jquery.1.2.6.js", path); var path2 = manager.GetResourcePath("/my/webapp", "~/content/css/yadda.css"); Assert.AreEqual("/my/webapp/content/css/yadda.css", path2); }
public void AllTypesOfPathSlashesShouldCombineWithSingleForwardSlash() { var manager = new DefaultResourcePathManager(new SparkSettings()); var path1 = manager.PathConcat("foo", "bar"); var path2 = manager.PathConcat("foo/", "bar"); var path3 = manager.PathConcat("foo", "/bar"); var path4 = manager.PathConcat("foo/", "/bar"); Assert.That(path1, Is.EqualTo("foo/bar")); Assert.That(path2, Is.EqualTo("foo/bar")); Assert.That(path3, Is.EqualTo("foo/bar")); Assert.That(path4, Is.EqualTo("foo/bar")); }
public void AllTypesOfPathSlashesShouldCombineWithSingleForwardSlash() { var manager = new DefaultResourcePathManager(new SparkSettings()); var path1 = manager.PathConcat("foo", "bar"); var path2 = manager.PathConcat("foo/", "bar"); var path3 = manager.PathConcat("foo", "/bar"); var path4 = manager.PathConcat("foo/", "/bar"); Assert.That(path1, Is.EqualTo("foo/bar")); Assert.That(path2, Is.EqualTo("foo/bar")); Assert.That(path3, Is.EqualTo("foo/bar")); Assert.That(path4, Is.EqualTo("foo/bar")); }
public void ReplacingJustSomePrefixes() { var settings = new SparkSettings() .AddResourceMapping("/content/js", "http://my.cdn.com/myaccount/content/js"); var manager = new DefaultResourcePathManager(settings); var path = manager.GetResourcePath("/my/webapp", "/content/js/jquery.1.2.6.js"); Assert.AreEqual("http://my.cdn.com/myaccount/content/js/jquery.1.2.6.js", path); var path2 = manager.GetResourcePath("/my/webapp", "/content/css/yadda.css"); Assert.AreEqual("/my/webapp/content/css/yadda.css", path2); }
public void WhenResourceMappingWithNoStopAttributeThenNextMatchOrDefaultMatchWillBeProcessedWithItOutput() { var settings = new SparkSettings() .AddResourceMapping("/js", "~/content/js", false); var manager = new DefaultResourcePathManager(settings); var path = manager.GetResourcePath("/my/webapp", "/js/jquery.1.2.6.js"); Assert.AreEqual("/my/webapp/content/js/jquery.1.2.6.js", path); settings.AddResourceMapping("/ftpmirror", "/ftp/mymyrror.com", false); settings.AddResourceMapping("/ftp/", "ftp://"); var path2 = manager.GetResourcePath("/my/webapp", "/ftpmirror/1.zip"); Assert.AreEqual("ftp://mymyrror.com/1.zip", path2); }
public void NormalUrlPathsAreUnchanged() { var manager = new DefaultResourcePathManager(new SparkSettings()); var path = manager.GetResourcePath("", "/content/js/jquery.1.2.6.js"); Assert.AreEqual("/content/js/jquery.1.2.6.js", path); }
public void WhenResourceMappingWithNoStopAttributeThenNextMatchOrDefaultMatchWillBeProcessedWithItOutput() { var settings = new SparkSettings() .AddResourceMapping("/js", "~/content/js", false); var manager = new DefaultResourcePathManager(settings); var path = manager.GetResourcePath("/my/webapp", "/js/jquery.1.2.6.js"); Assert.AreEqual("/my/webapp/content/js/jquery.1.2.6.js", path); settings.AddResourceMapping("/ftpmirror", "/ftp/mymyrror.com", false); settings.AddResourceMapping("/ftp/", "ftp://"); var path2 = manager.GetResourcePath("/my/webapp", "/ftpmirror/1.zip"); Assert.AreEqual("ftp://mymyrror.com/1.zip", path2); }
public void TildePrefixedPathMorphAsSiteRootPrependedByDefault() { var manager = new DefaultResourcePathManager(new SparkSettings()); var path = manager.GetResourcePath("/my/webapp", "~/content/js/jquery.1.2.6.js"); Assert.AreEqual("/my/webapp/content/js/jquery.1.2.6.js", path); }