public void Parse_OneLineFile_ExpectedWords() { var parser = GetNewParser(); var fileVersion = new FileVersion(TestTextFiles.OneLineFile, DateTime.UtcNow, DateTime.UtcNow); var parsedWords = parser.Parse(fileVersion); var expectedWords = OneLineFileContent.Split(); foreach (var parsedWord in parsedWords) { Assert.True(expectedWords.Contains(parsedWord.Word)); } }
public void Parse_OneLineFile_ExpectedPositions() { var parser = GetNewParser(); var fileVersion = new FileVersion(TestTextFiles.OneLineFile, DateTime.UtcNow, DateTime.UtcNow); var parsedWords = parser.Parse(fileVersion); var expectedWords = OneLineFileContent.Split(' ').Select(w => new { Word = w, Position = OneLineFileContent.IndexOf(w, StringComparison.Ordinal) + 1 }).ToList(); foreach (var parsedWord in parsedWords) { var expectedPosition = expectedWords.FirstOrDefault(w => w.Word.Equals(parsedWord.Word))?.Position; Assert.NotNull(expectedPosition); Assert.Equal(expectedPosition, parsedWord.Entry.Position); } }