public void TestLandedTitleFilesIntegrity() { List <string> files = FileProvider.GetFilesInDirectory(ApplicationPaths.LandedTitlesDirectory).ToList(); foreach (string file in files) { string fileName = PathExt.GetFileNameWithoutRootDirectory(file); List <string> lines = FileProvider .ReadAllLines(FileEncoding.Windows1252, file) .ToList(); IEnumerable <LandedTitle> landedTitles = LandedTitlesFile .ReadAllTitles(file) .ToDomainModels(); string content = string.Join(Environment.NewLine, lines); int openingBrackets = content.Count(x => x == '{'); int closingBrackets = content.Count(x => x == '}'); Assert.AreEqual(openingBrackets, closingBrackets, $"There are mismatching brackets in {fileName}"); AssertLandedTitlesQuotes(lines, file); AssertLandedTitlesEqualSigns(lines, file); AssertLandedTitleDynamicNames(landedTitles, file); } }
public void TestLandedTitlesFilesFormatConventions() { List <string> landedTitlesFiles = FileProvider.GetFilesInDirectory(ApplicationPaths.LandedTitlesDirectory).ToList(); foreach (string file in landedTitlesFiles) { List <string> lines = FileProvider.ReadAllLines(FileEncoding.Windows1252, file).ToList(); List <string> fullLines = FileProvider.ReadAllLines(FileEncoding.Windows1252, file, true).ToList(); IEnumerable <LandedTitle> landedTitles = LandedTitlesFile .ReadAllTitles(file) .ToDomainModels(); AssertIndentation(lines, file); AssertTrailingWhitespaces(fullLines, file); AssertRepeatedBlankLines(fullLines, file); AssertSpacingsAroundEquals(lines, file); } }