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()); }
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")]); }
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")]); }
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); }