Exemplo n.º 1
0
 protected ReferenceBuilder_Reference_TestBase()
 {
     settings = new CassetteSettings();
     bundles  = new BundleCollection(settings, Mock.Of <IFileSearchProvider>(), Mock.Of <IBundleFactoryProvider>(), Mock.Of <IBundleCollectionInitializer>());
     bundleFactoryProvider = new Mock <IBundleFactoryProvider>();
     placeholderTracker    = new Mock <IPlaceholderTracker>();
     builder = new ReferenceBuilder(bundles, placeholderTracker.Object, bundleFactoryProvider.Object, settings);
 }
Exemplo n.º 2
0
        public ReferenceBuilder_Reference_Tests()
        {
            application     = new Mock <ICassetteApplication>();
            bundleFactories = new Dictionary <Type, IBundleFactory <Bundle> >();
            bundleContainer = new Mock <IBundleContainer>();
            bundleContainer.Setup(c => c.IncludeReferencesAndSortBundles(It.IsAny <IEnumerable <Bundle> >()))
            .Returns <IEnumerable <Bundle> >(ms => ms);

            builder = new ReferenceBuilder(bundleContainer.Object, bundleFactories, Mock.Of <IPlaceholderTracker>(), new CassetteSettings());
        }
Exemplo n.º 3
0
        public ReferenceBuilder_Render_Tests()
        {
            bundleContainer    = new Mock <IBundleContainer>();
            placeholderTracker = new Mock <IPlaceholderTracker>();
            application        = Mock.Of <ICassetteApplication>();
            bundleFactories    = new Dictionary <Type, IBundleFactory <Bundle> >();

            bundleContainer.Setup(c => c.IncludeReferencesAndSortBundles(It.IsAny <IEnumerable <Bundle> >()))
            .Returns <IEnumerable <Bundle> >(ms => ms);

            placeholderTracker.Setup(t => t.InsertPlaceholder(It.IsAny <Func <string> >()))
            .Returns(("output"));

            referenceBuilder = new ReferenceBuilder(bundleContainer.Object, bundleFactories, placeholderTracker.Object, new CassetteSettings());
        }
Exemplo n.º 4
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);
        }