Azavea.Open.DAO.CSV.Tests.MiscCsvTests.AssertFileContentsSame C# (CSharp) Méthode

AssertFileContentsSame() private static méthode

private static AssertFileContentsSame ( string file1, string file2 ) : void
file1 string
file2 string
Résultat void
        private static void AssertFileContentsSame(string file1, string file2)
        {
            FileInfo info1 = new FileInfo(file1);
            FileInfo info2 = new FileInfo(file2);
            Assert.IsTrue(info1.Exists, file1 + " was not created.");
            Assert.IsTrue(info2.Exists, file2 + " was not created.");
            Assert.AreEqual(info1.Length, info2.Length,
                            file1 + " was not the same size as " + file2);

            StreamReader reader1 = new StreamReader(file1);
            StreamReader reader2 = new StreamReader(file2);
            int lineNum = 1;
            while (!reader1.EndOfStream)
            {
                Assert.AreEqual(reader1.ReadLine(), reader2.ReadLine(), "Line " + lineNum + ": " + file1 +
                                                                        " differs from " + file2);
                lineNum++;
            }
        }