示例#1
0
        void AddHtmlAttribute(BundleManifest manifest, XElement attributeElement)
        {
            var name  = GetHtmlAttributeElementNameAttribute(attributeElement);
            var value = attributeElement.AttributeValueOrNull("Value");

            manifest.HtmlAttributes.Add(name, value);
        }
示例#2
0
        void AddHtmlAttributes(BundleManifest manifest)
        {
            var attributeElements = element.Elements("HtmlAttribute");

            foreach (var attributeElement in attributeElements)
            {
                AddHtmlAttribute(manifest, attributeElement);
            }
        }
示例#3
0
        void AddReferences(BundleManifest manifest)
        {
            var paths = GetReferencePaths();

            foreach (var path in paths)
            {
                manifest.References.Add(path);
            }
        }
        public ScriptBundleManifestBuilder_Tests()
        {
            bundle = new ScriptBundle("~/path") { PageLocation = "body", Hash = new byte[] { 1, 2, 3 } };
            asset = StubAsset();
            bundle.Assets.Add(asset);
            bundle.AddReference("~/reference/path");
            bundle.Process(new CassetteSettings(""));

            manifest = builder.BuildManifest(bundle);
        }
示例#5
0
        void AddAssets(BundleManifest manifest)
        {
            var assetElements  = element.Elements("Asset");
            var assetManifests = assetElements.Select(e => new AssetManifestReader(e).Read());

            foreach (var assetManifest in assetManifests)
            {
                manifest.Assets.Add(assetManifest);
            }
        }
        public ScriptBundleManifestBuilder_Tests()
        {
            bundle = new ScriptBundle("~/path")
            {
                PageLocation = "body",
                Hash = new byte[] { 1, 2, 3 },
                Processor = new ScriptPipeline()
            };
            asset = new StubAsset
            {
                CreateStream = () => new MemoryStream(bundleContent),
                References =
                    {
                        new AssetReference("~/path/asset/file", asset, 0, AssetReferenceType.RawFilename)
                    }
            };
            bundle.Assets.Add(asset);
            bundle.AddReference("~/reference/path");
            bundle.Process(new CassetteSettings(""));
            var urlModifier = Mock.Of<IUrlModifier>();
            bundle.Renderer = new ConstantHtmlRenderer<ScriptBundle>("", urlModifier);

            manifest = builder.BuildManifest(bundle);
        }
 public void GivenIncludeContentIsFalse_ThenManifestContentIsNull()
 {
     builder.IncludeContent = false;
     manifest = builder.BuildManifest(bundle);
     manifest.Content.ShouldBeNull();
 }
 public void GivenBundleWithNoAssetsThenManifestContentIsNull()
 {
     bundle.Assets.Clear();
     manifest = builder.BuildManifest(bundle);
     manifest.Content.ShouldBeNull();
 }
 public void GivenBundleWithHtmlAttributes_ThenManifestHasHtmlAttributes()
 {
     bundle.HtmlAttributes.Add("attribute", "value");
     manifest = builder.BuildManifest(bundle);
     manifest.HtmlAttributes["attribute"].ShouldEqual("value");
 }
示例#10
0
 Action <BundleManifest> GetWriteActionForBundleManifest(BundleManifest bundleManifest)
 {
     return(writeActions[bundleManifest.GetType()]);
 }
示例#11
0
        void WriteBundleManifest(BundleManifest bundleManifest)
        {
            var write = GetWriteActionForBundleManifest(bundleManifest);

            write(bundleManifest);
        }
 void ReadBundleManifest()
 {
     var reader = new ScriptBundleManifestReader(element);
     readManifest = reader.Read();
 }