示例#1
0
        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);
        }
示例#2
0
        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();
        }