public void WithPreprocessor_Uses_Instance_Preprocessors()
        {
            var scriptPreprocessor = new StubScriptPreprocessor();
            var globalPreprocessor = new StubGlobalPreprocessor();

            JavaScriptBundle javaScriptBundle = javaScriptBundleFactory
                                                .WithHasher(hasher)
                                                .WithDebuggingEnabled(false)
                                                .WithContents("start")
                                                .Create();

            string tag = javaScriptBundle
                         .WithPreprocessor(scriptPreprocessor)
                         .WithPreprocessor(globalPreprocessor)
                         .Add("~/js/test.script.fake.global.bogus")
                         .Render("~/js/output.js");

            string contents =
                javaScriptBundleFactory.FileWriterFactory.Files[TestUtilities.PrepareRelativePath(@"js\output.js")];

            Assert.AreEqual("<script type=\"text/javascript\" src=\"js/output.js?r=A87E7F7EA72FD18FC3E75FACD850E2EB\"></script>", tag);
            Assert.AreEqual("scripty", contents);

            Assert.AreEqual("globey", scriptPreprocessor.CalledWith);
            Assert.AreEqual("start", globalPreprocessor.CalledWith);

            Assert.IsEmpty(Bundle.Preprocessors);
        }
        public void WithPreprocessor_Uses_Instance_Preprocessors()
        {
            var scriptPreprocessor = new StubScriptPreprocessor();
            var globalPreprocessor = new StubGlobalPreprocessor();

            JavaScriptBundle javaScriptBundle = javaScriptBundleFactory
                                                .WithHasher(hasher)
                                                .WithDebuggingEnabled(false)
                                                .WithContents("start")
                                                .Create();

            string tag = javaScriptBundle
                         .WithPreprocessor(scriptPreprocessor)
                         .WithPreprocessor(globalPreprocessor)
                         .Add("~/js/test.script.global")
                         .Render("~/js/output.js");

            string contents =
                javaScriptBundleFactory.FileWriterFactory.Files[TestUtilities.PrepareRelativePath(@"js\output.js")];

            Assert.AreEqual("<script type=\"text/javascript\" src=\"js/output.js?r=hash\"></script>", tag);
            Assert.AreEqual("scripty;\n", contents);

            Assert.AreEqual("globey", scriptPreprocessor.CalledWith);
            Assert.AreEqual("start", globalPreprocessor.CalledWith);

            Assert.IsEmpty(Configuration.Instance.Preprocessors.Where(x => !(x is NullPreprocessor)));
        }