Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
vlada-shubina committed Jun 30, 2021
1 parent 4583090 commit 1a6caf3
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/Microsoft.TemplateEngine.TestHelper/TestUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,25 @@ public static void DirectoryCopy(string sourceDirName, string destDirName, bool
}
}
}

public static bool CompareFiles(string file1, string file2)
{
using var fs1 = new FileStream(file1, FileMode.Open);
using var fs2 = new FileStream(file2, FileMode.Open);
if (fs1.Length != fs2.Length)
{
return false;
}

int file1byte;
int file2byte;
do
{
file1byte = fs1.ReadByte();
file2byte = fs2.ReadByte();
}
while ((file1byte == file2byte) && (file1byte != -1));
return ((file1byte - file2byte) == 0);
}
}
}

0 comments on commit 1a6caf3

Please sign in to comment.