Ejemplo n.º 1
0
        protected UrlGeneratorTestsBase()
        {
            UrlModifier.Setup(m => m.Modify(It.IsAny<string>()))
                       .Returns<string>(url => url);

            UrlGenerator = new UrlGenerator(UrlModifier.Object, SourceDirectory, "cassette.axd/");
        }
Ejemplo n.º 2
0
        protected UrlGeneratorTestsBase(bool isFileNameWithHashDisabled)
        {
            UrlModifier.Setup(m => m.Modify(It.IsAny<string>()))
                       .Returns<string>(url => url);

            UrlGenerator = new UrlGenerator(UrlModifier.Object, SourceDirectory, "cassette.axd/", isFileNameWithHashDisabled);
        }
 public void ItRemovesTildeSlashPrefix()
 {
     UrlGenerator.CreateAbsolutePathUrl("~/test.png").ShouldEqual("test.png");
 }
 public void ItCallsUrlModifier()
 {
     UrlModifier.Setup(m => m.Modify("test.png")).Returns("/app/test.png");
     UrlGenerator.CreateAbsolutePathUrl("~/test.png").ShouldEqual("/app/test.png");
 }
Ejemplo n.º 5
0
        protected UrlGenerator_Tests()
        {
            UrlModifier.Setup(m => m.PreCacheModify(It.IsAny<string>()))
                       .Returns<string>(url => url);

            var container = new Mock<ICassetteApplicationContainer<ICassetteApplication>>();
            container.SetupGet(c => c.Application.Bundles).Returns(Enumerable.Empty<Bundle>());
            UrlGenerator = new UrlGenerator(UrlModifier.Object, "_cassette");
        }
Ejemplo n.º 6
0
        public void CreateStylesheetBundleUrlReturnsUrlWithRoutePrefixAndBundleTypeAndPathAndHash()
        {
            var url = UrlGenerator.CreateBundleUrl(StubStylesheetBundle("~/test/foo"));

            url.ShouldEqual("_cassette/stylesheetbundle/test/foo_010203");
        }
Ejemplo n.º 7
0
 public void UrlModifierModifyIsCalled()
 {
     UrlGenerator.CreateBundleUrl(StubScriptBundle("~/test"));
     UrlModifier.Verify(m => m.Modify("_cassette/scriptbundle/test_010203"));
 }
Ejemplo n.º 8
0
        public void ConvertsToForwardSlashes()
        {
            var url = UrlGenerator.CreateRawFileUrl("~\\test\\foo.png", "hash");

            url.ShouldEqual("_cassette/file/test/foo_hash.png");
        }
Ejemplo n.º 9
0
        public void CreateRawFileUrlReturnsUrlWithRoutePrefixAndPathWithoutTildeAndHash()
        {
            var url = UrlGenerator.CreateRawFileUrl("~/test.png", "hash");

            url.ShouldStartWith("_cassette/file/test_hash.png");
        }
        public void CreateStylesheetBundleUrlReturnsUrlWithRoutePrefixAndBundleTypeAndHashAndPath()
        {
            var url = UrlGenerator.CreateBundleUrl(StubStylesheetBundle("~/test/foo"));

            url.ShouldEqual("cassette.axd/stylesheet/" + expectedHash + "/test/foo");
        }
        public void CreateRawFileUrlReturnsUrlWithRoutePrefixAndHashAndPathWithoutTilde()
        {
            var url = UrlGenerator.CreateRawFileUrl("~/test.png", "hash");

            url.ShouldEqual("cassette.axd/file/test-hash.png");
        }
        public void InsertsHashBeforeLastPeriod()
        {
            var url = UrlGenerator.CreateRawFileUrl("~\\test\\foo.bar.png", "hash");

            url.ShouldEqual("cassette.axd/file/test/foo.bar-hash.png");
        }
        public void ToleratesFilenameWithoutExtension()
        {
            var url = UrlGenerator.CreateRawFileUrl("~\\test\\foo", "hash");

            url.ShouldEqual("cassette.axd/file/test/foo-hash");
        }