private void PrintOutIdDiffs() { var EdtIds = EdtDocumentRepository.GetDocumentNumbers(); var IdxIds = new IdxDocumentsRepository().GetDocumentIds(); var edtExceptIdx = EdtIds.Except(IdxIds); var IdxExceptEdt = IdxIds.Except(EdtIds); using (var sw = new StreamWriter($"{Settings.ReportingDirectory}\\DocumentCountDifferences_IdLists.csv")) { sw.WriteLine("In Edt but not in Idx:"); foreach (var id in edtExceptIdx) { sw.WriteLine(id); } sw.WriteLine("In Idx but not Edt"); foreach (var id in IdxExceptEdt) { sw.WriteLine(id); } } TestLogger.Info( $"Document Id differences output to <a href=\"DocumentCountDifferences_IdLists.csv\"> DocumentCountDifferences_IdLists.csv</a>"); }
public void TextCountsAreEqualBetweenIdxAndEdtFileStore() { //For each Document in Batch, Count where Body is not null var edtDocsWithBody = EdtDocumentRepository.GetDocuentNumbersWithABody(); //compare against Text count in microfocus dir var edtIds = EdtDocumentRepository.GetDocumentNumbers(); var textFileDocsIds = Directory .GetFiles(Settings.MicroFocusStagingDirectoryTextPath, "*.txt", SearchOption.AllDirectories) .Select(x => GetDocumentIdFromFilePath(x)).Where(x => edtIds.Contains(x)); var mircoFocusDocCount = textFileDocsIds.Count(); //output counts string[][] data = { new[] { "Item Evaluated", "Count of Documents" }, new[] { "MicroFocus Export text(s)", mircoFocusDocCount.ToString() }, new[] { "Edt Document.Body", edtDocsWithBody.Count().ToString() } }; TestLogger.Log(AventStack.ExtentReports.Status.Info, MarkupHelper.CreateTable(data)); if (mircoFocusDocCount != edtDocsWithBody.Count()) { //output diff list var outputFile = Path.Combine(Settings.ReportingDirectory, "TextContentMissing.csv"); using (var sw = new StreamWriter(outputFile)) { var missingBodies = textFileDocsIds.Where(x => !edtDocsWithBody.Contains(x)); foreach (var missing in missingBodies) { sw.WriteLine(missing); } TestLogger.Info($"List of Ids without body output to: {new FileInfo(outputFile).FullName}"); } } Assert.AreEqual(mircoFocusDocCount, edtDocsWithBody.Count(), "File counts should be equal for Microfocus load and EDT"); }