コード例 #1
0
        protected UrlGeneratorTestsBase()
        {
            UrlModifier.Setup(m => m.Modify(It.IsAny<string>()))
                       .Returns<string>(url => url);

            UrlGenerator = new UrlGenerator(UrlModifier.Object, SourceDirectory, "cassette.axd/");
        }
コード例 #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);
        }
コード例 #3
0
 public void ItRemovesTildeSlashPrefix()
 {
     UrlGenerator.CreateAbsolutePathUrl("~/test.png").ShouldEqual("test.png");
 }
コード例 #4
0
 public void ItCallsUrlModifier()
 {
     UrlModifier.Setup(m => m.Modify("test.png")).Returns("/app/test.png");
     UrlGenerator.CreateAbsolutePathUrl("~/test.png").ShouldEqual("/app/test.png");
 }
コード例 #5
0
ファイル: UrlGenerator.cs プロジェクト: Zocdoc/cassette
        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");
        }
コード例 #6
0
        public void CreateStylesheetBundleUrlReturnsUrlWithRoutePrefixAndBundleTypeAndPathAndHash()
        {
            var url = UrlGenerator.CreateBundleUrl(StubStylesheetBundle("~/test/foo"));

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

            url.ShouldEqual("_cassette/file/test/foo_hash.png");
        }
コード例 #9
0
        public void CreateRawFileUrlReturnsUrlWithRoutePrefixAndPathWithoutTildeAndHash()
        {
            var url = UrlGenerator.CreateRawFileUrl("~/test.png", "hash");

            url.ShouldStartWith("_cassette/file/test_hash.png");
        }
コード例 #10
0
        public void CreateStylesheetBundleUrlReturnsUrlWithRoutePrefixAndBundleTypeAndHashAndPath()
        {
            var url = UrlGenerator.CreateBundleUrl(StubStylesheetBundle("~/test/foo"));

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

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

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

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