/// <summary> /// Implements the common test method for most of the unit tests. /// </summary> /// <param name="input"> /// </param> /// <param name="expected"> /// </param> /// <param name="xmlId"> /// </param> /// <param name="parseEpigraphs"> /// </param> private void TestConvert( string[] input, string[] expected, string xmlId = null, bool parseEpigraphs = false) { // Execute the process to convert it. string inputBuffer = string.Join(Environment.NewLine, input); var stringReader = new StringReader(inputBuffer); var stringWriter = new StringWriter(); var process = new ConvertToDocBookProcess { Input = stringReader, Output = stringWriter, OutputSettings = new XmlWriterSettings { OmitXmlDeclaration = true, Indent = true, IndentChars = string.Empty, }, TitleOutsideInfo = true, XmlId = xmlId, ParseEpigraphs = parseEpigraphs, }; process.Run(); // Compare the results. string actual = stringWriter.ToString(); this.CompareText( expected, actual); }
/// <summary> /// Retrieves an IProcess represented by the options. /// </summary> /// <returns> /// A process object associated with the options. /// </returns> public ProcessBase GetProcess() { FileStream outputStream = File.Open(this.RemainingArguments[1], FileMode.Create); var outputWriter = new StreamWriter(outputStream); FileStream inputStream = File.OpenRead(this.RemainingArguments[0]); var inputReader = new StreamReader(inputStream); var process = new ConvertToDocBookProcess { ParseAttributions = this.ParseAttributions, ParseBackticks = this.ParseBackticks, ParseEpigraphs = this.ParseEpigraphs, ParseLanguages = this.ParseLanguages, ParseNotes = this.ParseNotes, ParseQuotes = this.ParseQuotes, RootElement = this.RootElement, XmlId = this.XmlId, Input = inputReader, Output = outputWriter, }; return(process); }