예제 #1
0
        public void WhenProcessBundle_ThenHashIsAssigned()
        {
            var pipeline = new ScriptPipeline();
            var bundle   = new ScriptBundle("~");

            pipeline.Process(bundle, new CassetteSettings(""));

            bundle.Hash.ShouldNotBeNull();
        }
예제 #2
0
        public ScriptPipeline_Tests()
        {
            minifier     = Mock.Of <IJavaScriptMinifier>();
            urlGenerator = Mock.Of <IUrlGenerator>();
            var container = new TinyIoCContainer();

            settings = new CassetteSettings();
            container.Register(minifier);
            container.Register(urlGenerator);
            container.Register(settings);
            pipeline = new ScriptPipeline(container, settings);
        }
예제 #3
0
        public void CreateBundleAssignsSettingsDefaultProcessor()
        {
            var processor = new ScriptPipeline();

            settings.SetDefaultBundleProcessor(processor);
            var factory = new ScriptBundleFactory(settings);
            var bundle  = factory.CreateBundle("~", Enumerable.Empty <IFile>(), new BundleDescriptor {
                AssetFilenames = { "*" }
            });

            bundle.Processor.ShouldBeSameAs(processor);
        }
예제 #4
0
        public void GivenCompileCoffeeScriptIsTrue_WhenProcessBundle_ThenCompileAssetTransformerIsAddedToAsset()
        {
            var pipeline = new ScriptPipeline().CompileCoffeeScript();
            var bundle   = new ScriptBundle("~");
            var asset    = StubCoffeeScriptAsset();

            bundle.Assets.Add(asset.Object);

            pipeline.Process(bundle, new CassetteSettings(""));

            asset.Verify(a => a.AddAssetTransformer(It.IsAny <CompileAsset>()));
        }
예제 #5
0
        public void GivenCompileCoffeeScriptIsFalse_WhenProcessBundle_ThenCompileAssetTransformerNotAddedToAsset()
        {
            var pipeline = new ScriptPipeline {
                CompileCoffeeScript = false
            };
            var bundle = new ScriptBundle("~");
            var asset  = StubCoffeeScriptAsset();

            bundle.Assets.Add(asset.Object);

            pipeline.Process(bundle, new CassetteSettings());

            asset.Verify(a => a.AddAssetTransformer(It.IsAny <CompileAsset>()), Times.Never());
        }
예제 #6
0
        public void GivenDebugMode_WhenProcessBundle_ThenRendererIsDebugScriptBundleHtmlRenderer()
        {
            var settings = new CassetteSettings {
                IsDebuggingEnabled = true
            };

            var bundle = new ScriptBundle("~/test");

            var pipeline = new ScriptPipeline();

            pipeline.Process(bundle, settings);

            bundle.Renderer.ShouldBeType <DebugScriptBundleHtmlRenderer>();
        }
예제 #7
0
        public void CompileCoffeeScriptDefaultsToTrue()
        {
            var pipeline = new ScriptPipeline();

            pipeline.CompileCoffeeScript.ShouldBeTrue();
        }
예제 #8
0
 public ScriptBundle(string applicationRelativePath)
     : base(applicationRelativePath)
 {
     ContentType = "text/javascript";
     Processor   = new ScriptPipeline();
 }