public void GivenLocationAlreadyRenderedButHtmlRewrittingEnabled_WhenAddReferenceToThatLocation_ThenBundleStillAdded() { builder = new ReferenceBuilder( bundleContainer.Object, bundleFactories, Mock.Of<IPlaceholderTracker>(), new CassetteSettings("") { IsHtmlRewritingEnabled = true } ); var bundle = new ScriptBundle("~/test"); bundleContainer.Setup(c => c.FindBundleContainingPath<Bundle>("~/test")) .Returns(bundle); builder.Render<ScriptBundle>("test"); builder.Reference("~/test", "test"); builder.GetBundles("test").First().ShouldBeSameAs(bundle); }
/// <summary> /// Get the URLs for bundles that have been referenced during the current request. /// </summary> /// <typeparam name="T">The type of bundles.</typeparam> /// <param name="pageLocation">Optional. The page location of bundles to return.</param> public static IEnumerable <string> GetReferencedBundleUrls <T>(string pageLocation) where T : Bundle { var bundles = ReferenceBuilder.GetBundles(pageLocation).OfType <T>(); if (Application.Settings.IsDebuggingEnabled) { return(bundles .SelectMany(GetAllAssets) .Select(Application.Settings.UrlGenerator.CreateAssetUrl)); } else { return(bundles .Select(Application.Settings.UrlGenerator.CreateBundleUrl)); } }
/// <summary> /// Gets the bundles that have been referenced during the current request. /// </summary> /// <param name="pageLocation">Optional. The page location of bundles to return.</param> public static IEnumerable <Bundle> GetReferencedBundles(string pageLocation) { return(ReferenceBuilder.GetBundles(pageLocation)); }