Exemplo n.º 1
0
        public void CanRenderOnlyIfFileMissing()
        {
            //fileReaderFactory.SetFileExists(false);

            javaScriptBundle
            .Add(Test1Path)
            .RenderOnlyIfOutputFileMissing()
            .Render(currentOutputFile);

            using (var fr = fileReaderFactory.GetFileReader(currentOutputFile))
            {
                Assert.AreEqual(TEST1_MINIFIED, fr.ReadToEnd());
            }

            //fileReaderFactory.SetContents(javaScript2);
            //fileReaderFactory.SetFileExists(true);
            javaScriptBundle.ClearCache();

            javaScriptBundle
            .Add(Test2Path)
            .RenderOnlyIfOutputFileMissing()
            .Render(currentOutputFile);

            // Assert.AreEqual("function product(a,b){return a*b}function sum(a,b){return a+b}", fileReaderFactory.GetFileReader(TestUtilities.PreparePathRelativeToWorkingDirectory(@"\js\output_9.js")).ReadToEnd());
        }
Exemplo n.º 2
0
        public void CanRenderOnlyIfFileMissing()
        {
            fileReaderFactory.SetFileExists(false);

            javaScriptBundle
            .Add("~/js/test.js")
            .RenderOnlyIfOutputFileMissing()
            .Render("~/js/output_9.js");

            Assert.AreEqual("function product(a,b){return a*b}function sum(a,b){return a+b}", fileWriterFactory.Files[TestUtilities.PreparePathRelativeToWorkingDirectory(@"C:\js\output_9.js")]);

            fileReaderFactory.SetContents(javaScript2);
            fileReaderFactory.SetFileExists(true);
            javaScriptBundle.ClearCache();

            javaScriptBundle
            .Add("~/js/test.js")
            .RenderOnlyIfOutputFileMissing()
            .Render("~/js/output_9.js");

            Assert.AreEqual("function product(a,b){return a*b}function sum(a,b){return a+b}", fileWriterFactory.Files[TestUtilities.PreparePathRelativeToWorkingDirectory(@"C:\js\output_9.js")]);
        }
Exemplo n.º 3
0
        public void CanRenderOnlyIfFileMissing()
        {
            fileReaderFactory.SetFileExists(false);

            javaScriptBundle
            .Add("~/js/test.js")
            .RenderOnlyIfOutputFileMissing()
            .Render("~/js/output_9.js");

            Assert.AreEqual(minifiedJavaScript, fileWriterFactory.Files[TestUtilities.PrepareRelativePath(@"js\output_9.js")]);

            fileReaderFactory.SetContents(javaScript2);
            fileReaderFactory.SetFileExists(true);
            javaScriptBundle.ClearCache();

            javaScriptBundle
            .Add("~/js/test.js")
            .RenderOnlyIfOutputFileMissing()
            .Render("~/js/output_9.js");

            Assert.AreEqual(minifiedJavaScript, fileWriterFactory.Files[TestUtilities.PrepareRelativePath(@"js\output_9.js")]);
        }
Exemplo n.º 4
0
        public void CanRenderArbitraryStringsInDebugAsCached()
        {
            var content = debugJavaScriptBundle
                          .AddString(javaScript)
                          .Add("~/js/test.js")
                          .AsCached("Test3", "~/js/output_2.js");

            var cachedContent = debugJavaScriptBundle.RenderCached("Test3");

            debugJavaScriptBundle.ClearCache();

            var generatedContent = debugJavaScriptBundle.RenderCached("Test3");

            Assert.AreEqual(cachedContent, content);
            Assert.AreEqual(cachedContent, generatedContent);
        }