public void cdn_registration_with_file_name()
        {
            var cdn = new CdnAsset { File = "fubar.1.2.js", Url = "http://server/fubar.js" };
            var asset = AllAssets.RegisterCdnAsset(cdn);

            asset.Filename.ShouldEqual("fubar.1.2.js");
            asset.File.ShouldNotBeNull(); // just seeing that we match up on existing
            asset.CdnUrl.ShouldEqual("http://server/fubar.js");
            asset.Url.ShouldEqual("fubar.1.2.js");
        }
        public void add_cdn_that_does_match()
        {
            var cdn = new CdnAsset
            {
                Url = "http://cdn.server.com/foo.js",
                Fallback ="something == null"
            };

            var asset = AllAssets.RegisterCdnAsset(cdn);
            asset.File.ShouldNotBeNull();
            asset.FallbackTest.ShouldEqual("something == null");
            asset.CdnUrl.ShouldEqual("http://cdn.server.com/foo.js");
        }
Beispiel #3
0
        public Asset RegisterCdnAsset(CdnAsset cdn)
        {
            var file  = cdn.Filename();
            var asset = _searches[file];

            if (asset == null)
            {
                asset = new Asset(cdn.Url)
                {
                };
                _assets.Add(asset);
            }

            asset.CdnUrl       = cdn.Url;
            asset.FallbackTest = cdn.Fallback;

            return(asset);
        }
Beispiel #4
0
        public Asset RegisterCdnAsset(CdnAsset cdn)
        {
            var file = cdn.File ?? new Uri(cdn.Url).Segments.Last();
            var asset = _searches[file];
            if (asset == null)
            {
                asset = new Asset(cdn.Url)
                {

                };
                _assets.Add(asset);
            }

            asset.CdnUrl = cdn.Url;
            asset.FallbackTest = cdn.Fallback;

            return asset;
        }