public void DeletingSomeLines() { const int totalLines = 10000; var filename = Path.Combine(Path.GetTempPath(), string.Format("{0}.txt", DateTime.Now.Ticks)); var lineFileWriter = new LineFile(filename); var linesToAdd = new List <string>(); for (int i = 0; i < totalLines; i++) { linesToAdd.Add(string.Format("This is a medium lenght line, and, incidentally, this is the {0} line :)", i)); } lineFileWriter.AddLines(linesToAdd.ToArray()); var linesToDelete = new List <string>(); for (int i = 0; i < totalLines; i += 10) { linesToDelete.Add(string.Format("This is a medium lenght line, and, incidentally, this is the {0} line :)", i)); } lineFileWriter.DeleteLines(linesToDelete.ToArray()); var readLines = lineFileWriter.ReadAllLines(); Assert.AreEqual(totalLines - (totalLines / 10), readLines.Count); }
public void ReadAllLines() { var filename = Path.Combine(Path.GetTempPath(), string.Format("{0}.txt", DateTime.Now.Ticks)); var lineFileWriter = new LineFile(filename); var lines = new List <string>(); for (int i = 0; i < 1000000; i++) { lines.Add(string.Format("This is a medium lenght line, and, incidentally, this is the {0} line :)", i)); } lineFileWriter.AddLines(lines.ToArray()); var readLines = lineFileWriter.ReadAllLines(); Assert.AreEqual(1000000, readLines.Count); }