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); }
public void WhenAddReferenceToBundleDirectory_ThenGetBundlesReturnTheBundle() { var bundle = new ScriptBundle("~/test"); bundleContainer.Setup(c => c.FindBundleContainingPath <Bundle>("~/test")) .Returns(bundle); bundleContainer.Setup(c => c.IncludeReferencesAndSortBundles(It.IsAny <IEnumerable <Bundle> >())) .Returns(new[] { bundle }) .Verifiable(); builder.Reference("test", null); var bundles = builder.GetBundles(null).ToArray(); bundles[0].ShouldBeSameAs(bundle); bundleContainer.Verify(); }