private void SearchDefinitions(string file) { LogHelper.Debug($"Searching definitions in {_document.FullName}..."); LogHelper.Debug("Clearing results from the previous scan..."); LogHelper.Debug("Checking if the file has the docx extension..."); if (file.EndsWith("docx")) { var stopwatch = Stopwatch.StartNew(); _definitionFinder.TokenizeFile(file); stopwatch.Stop(); DiagnosticInformation.OpenXmlTotalTime = stopwatch.Elapsed; } else { var stopwatch = Stopwatch.StartNew(); var openXml = _document.Content.WordOpenXML; stopwatch.Stop(); DiagnosticInformation.WordRetrieveOpenXmlTimeSpan = stopwatch.Elapsed; stopwatch.Restart(); _definitionFinder.TokenizeOpenXml(openXml); stopwatch.Stop(); DiagnosticInformation.OpenXmlTotalTime = stopwatch.Elapsed; } DiagnosticInformation.DefinitionsCount = _tokenContext.GetAll().Count(); }
public void TestInitialize() { _definitionContext = new TokenContext(); _definitionFinder = new DefineTokenizer(_definitionContext); _definitionFinder.TokenizeFile(TestFile); }
public void Paragraph_Amount_Is_Correct(string file, int expectedParagraphCount) { var definitionContext = new TokenContext(); var definitionFinder = new DefineTokenizer(definitionContext); definitionFinder.TokenizeFile(file); Assert.AreEqual(expectedParagraphCount, DiagnosticInformation.OpenXmlParagraphCount); }