public void ShouldOnlyCopyNonMarkdownFilesGivenExtensions() { // Arrange var mockOptions = new Mock <IMarkdownBuildOptions>(); mockOptions.SetReturnsDefault <IEnumerable <string> >(new string[] { "foo", "bar" }); Subject.Options = mockOptions.Object; var src = TestSubdirectory("S"); var dst = TestSubdirectory("D"); WriteText(src, "a.foo", "_a_"); WriteText(src, "b.bar", "_b_"); var justCopyFileName = "ignore.txt"; var expected = "_not transformed_"; WriteText(src, justCopyFileName, expected); // Act Subject.TransformFiles(src, dst); // Assert AssertFileContains(dst, "a.html", "<em>a"); AssertFileContains(dst, "b.html", "<em>b"); AssertFileContains(dst, justCopyFileName, expected); TextFileAssert.AreEqual(Path.Combine(src, justCopyFileName), Path.Combine(dst, justCopyFileName)); }
private void FileCompare(string fileName, string fileExtension) { string output = FileOutput(fileName + fileExtension); string expected = FileExpected(fileName + fileExtension); TextFileAssert.AreEqual(output, expected, fileName + " in " + fileExtension); }
public void MakeTest2() { MergeCss target = new MergeCss(); // TODO: Initialize to an appropriate value string css = Common.PathCombine(_inputBasePath, "MergeFile5.css"); // TODO: Initialize to an appropriate value string actual = target.Make(css, "Temp1.css"); string expected = Common.PathCombine(_expectBasePath, "MergeMissingFile.css"); // TODO: Initialize to an appropriate value TextFileAssert.AreEqual(expected, actual, "Make Funtion missing file test failed"); }
public void CreateCssFile() { string fileName = "CreateCssFile.css"; _configTool._cToolBL.CreateCssFile(fileName); string expectedFileWithPath = Common.PathCombine(_expectBasePath, fileName); string outputFileWithPath = Common.PathCombine(_outputBasePath, fileName); TextFileAssert.AreEqual(expectedFileWithPath, outputFileWithPath, "CreateCssFile Test fails"); }
public void AddChaptersTest() { const string fileName = "DEU.SFM"; string inputFullName = _testFiles.Input(fileName); string outputFullName = _testFiles.SubOutput("SFM", fileName); File.Copy(inputFullName, outputFullName); PartialBooks.AddChapters(_testFiles.Output("SFM")); TextFileAssert.AreEqual(_testFiles.Expected(fileName), outputFullName); }
public void LaunchTest() { Common.Testing = true; PublicationInformation projInfo = new PublicationInformation(); projInfo.DefaultXhtmlFileWithPath = _testFiles.Copy("sena3-imba.xhtml"); projInfo.DefaultCssFileWithPath = _testFiles.Copy("sena3-imba.css"); projInfo.IsLexiconSectionExist = true; projInfo.ProjectInputType = "Dictionary"; Launch(projInfo); Assert.True(File.Exists(_testFiles.Output("DfM copyright notice.txt"))); TextFileAssert.AreEqual(_testFiles.Expected("main.txt"), _testFiles.Output("main.txt"), "main.txt"); }
public void WriteCssClass() { string fileName = "WriteCss.css"; string outputFileWithPath = Common.PathCombine(_outputBasePath, fileName); StreamWriter writeCss = new StreamWriter(outputFileWithPath); var value = new Dictionary <string, string>(); value["column-gap"] = "5pt"; _configTool._cToolBL.WriteCssClass(writeCss, "letData", value); writeCss.Close(); string expectedFileWithPath = Common.PathCombine(_expectBasePath, fileName); TextFileAssert.AreEqual(expectedFileWithPath, outputFileWithPath, "WriteCss Test fails"); }
public void MakeTest3() { MergeCss target = new MergeCss { OutputLocation = "Preprocess" }; var workDir = Common.PathCombine(Path.GetTempPath(), "Preprocess"); Common.CleanDirectory(new DirectoryInfo(workDir)); string css = Common.PathCombine(_inputBasePath, "MergeFile4.css"); // TODO: Initialize to an appropriate value string actual = target.Make(css, "Temp1.css"); string expected = Common.PathCombine(_expectBasePath, "MergeFile.css"); // TODO: Initialize to an appropriate value TextFileAssert.AreEqual(expected, actual, "Make Funtion test failed"); }
public void StytoCSSTest() { const string TestName = "default"; var cssFile = TestName + ".css"; string cssFileOutput = FileOutput(cssFile); StyToCss styToCssObj = new StyToCss(); styToCssObj.ConvertStyToCss(cssFileOutput); string expectedFile = FileExpected(cssFile); string outputFile = FileOutput(cssFile); TextFileAssert.AreEqual(expectedFile, outputFile, FileData.Get(FileOutput(cssFile))); }
public void Line1AndLine2StytoCSSTest() { const string TestName = "Line1AndLine2Indent"; var cssFile = TestName + ".css"; string cssFileOutput = FileOutput(cssFile); StyToCss styToCssObj = new StyToCss(); styToCssObj.StyFullPath = FileInput(TestName + ".sty"); styToCssObj.ConvertStyToCss(cssFileOutput); string expectedFile = FileExpected(cssFile); string outputFile = FileOutput(cssFile); TextFileAssert.AreEqual(expectedFile, outputFile, FileData.Get(FileOutput(cssFile))); }
public void MergeMainandCustomCssStylesTest() { const string TestName = "uitrans"; var cssFile = TestName + ".css"; string cssFileOutput = FileOutput(cssFile); StyToCss styToCssObj = new StyToCss(); styToCssObj.ConvertStyToCss("uitrans", cssFileOutput); string expectedFile = FileExpected(cssFile); string outputFile = FileOutput(cssFile); TextFileAssert.AreEqual(expectedFile, outputFile, FileData.Get(FileOutput(cssFile))); }
public void WriteCssClassForMirrored() { string fileName = "WriteCssMirrored.css"; string outputFileWithPath = Common.PathCombine(_outputBasePath, fileName); StreamWriter writeCss = new StreamWriter(outputFileWithPath); var value = new Dictionary <string, string>(); value["font-size"] = "5pt"; value["font-weight"] = "bold"; _configTool._cToolBL.WriteCssClass(writeCss, "page:left-top-center", value); writeCss.Close(); string expectedFileWithPath = Common.PathCombine(_expectBasePath, fileName); TextFileAssert.AreEqual(expectedFileWithPath, outputFileWithPath, "WriteCssClassForMirrored Test fails"); }
public void para() { UsxToSFM _usxToSfm = new UsxToSFM(); const string file = "para"; string input = Common.PathCombine(_inputPath, file + ".usx"); string output = Common.PathCombine(_outputPath, file + ".sfm"); string expected = Common.PathCombine(_expectedPath, file + ".sfm"); Common.BookNameCollection.Clear(); Common.BookNameTag = string.Empty; _usxToSfm.ConvertUsxToSFM(input, output); TextFileAssert.AreEqual(expected, output, file + " test fails"); Assert.AreEqual(1, Common.BookNameCollection.Count); Assert.AreEqual("h", Common.BookNameTag); }
public void WriteAtImport() { TreeView TvFeatures = new TreeView(); _configTool._cToolBL.PopulateFeatureLists(TvFeatures); string fileName = "WriteAtImport.css"; string outputFileWithPath = Common.PathCombine(_outputBasePath, fileName); StreamWriter writeCss = new StreamWriter(outputFileWithPath); string attrib = "Page Size"; string key = "A4"; _configTool._cToolBL.WriteAtImport(writeCss, attrib, key); writeCss.Close(); string expectedFileWithPath = Common.PathCombine(_expectBasePath, fileName); TextFileAssert.AreEqual(expectedFileWithPath, outputFileWithPath, "WriteCss Test fails"); }
public void WriteLanguageFontDirectionTest() { const string TestName = "WriteLanguageFontDirectionTest"; var cssFile = TestName + ".css"; DataCreator.Creator = DataCreator.CreatorProgram.Paratext7; using (Common.CallerSetting = new CallerSetting { SettingsFullPath = FileInput(TestName + ".ssf") }) { TextWriter sw = new StreamWriter(FileOutput(cssFile)); WriteLanguageFontDirection(sw); sw.Close(); } string expectedFile = FileExpected(cssFile); string outputFile = FileOutput(cssFile); TextFileAssert.AreEqual(expectedFile, outputFile, FileData.Get(FileOutput(cssFile))); }
public void MakeTest4() { MergeCss target = new MergeCss { OutputLocation = "Preprocess" }; var workDir = Common.PathCombine(Path.GetTempPath(), "Preprocess"); Common.CleanDirectory(new DirectoryInfo(workDir)); string css = Common.PathCombine(_inputBasePath, "MergeFile7.css"); string actual = target.Make(css, "Temp1.css"); var fileName = "MergeBottomImportFile.css"; if (Common.UsingMonoVM) { fileName = fileName.Replace(".css", "_Linux.css"); } string expected = Common.PathCombine(_expectBasePath, fileName); TextFileAssert.AreEqual(expected, actual, "Make Funtion test failed"); }
/// <summary> /// Do a single test. /// </summary> /// <param name="testName">Test name is also the folder containing the test.</param> /// <param name="msg">Message to display if failure occurs.</param> protected void OneTest(string testName, string msg) { // Create input file name for test var inpFileName = Common.PathCombine(_inpPath, testName + ".css"); var ctp = new CssTreeParser(); ctp.Parse(inpFileName); var strResult = ctp.StringTree(); // Output result to disk var outFileName = Common.PathCombine(_outPath, testName + ".txt"); var sw = new StreamWriter(outFileName); sw.Write(strResult); sw.Close(); var expFileName = Common.PathCombine(_expPath, testName + ".txt"); TextFileAssert.AreEqual(expFileName, outFileName, msg); if (ctp.Errors.Count != 0) { var strError = ctp.ErrorText(); var outErrorName = Common.PathCombine(_outPath, testName + "Err.txt"); var swe = new StreamWriter(outErrorName); var strGenericError = Regex.Replace(strError, @"[\\/a-zA-Z0-9\:]+src", "src"); swe.Write(strGenericError.Replace(@"\", "/")); swe.Close(); var expErrorName = Common.PathCombine(_expPath, testName + "Err.txt"); var msgErr = msg + " in Error text"; TextFileAssert.AreEqual(expErrorName, outErrorName, msgErr); } else { Assert.AreEqual(File.Exists(testName + "Err.txt"), false, msg + " error not generated"); } }