using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.IO;
using System.Threading;
namespace testLab4
{
class Program
{
[STAThread]
private static void Main(string[] args)
{
string pathin, pathresult;
for (int g = 0; g < 2; g++)
{
pathin = @"D:\tests\in" + g + ".txt";
pathresult = @"D:\tests\result" + g + ".txt";
File.Copy(pathin, @"D:\recin.txt", true);
File.Copy(pathresult, @"D:\\result.txt", true);
//Запуск программы
System.Diagnostics.Process MyProc = new System.Diagnostics.Process();
MyProc.StartInfo.FileName = @"C:\hello.exe";
MyProc.Start();
Thread.Sleep(1000);
//сравнение 2 файлов
bool isNotEqual = false;
int lineNumber = 0;
int k = 0;
StreamReader sr1 = new StreamReader("D:\\recout.txt ");
StreamReader sr2 = new StreamReader("D:\\result.txt");
StreamWriter report = new StreamWriter("D:\\report.txt", true);
report.WriteLine("Test number {0}", g);
while (!sr1.EndOfStream && !sr2.EndOfStream)
{
k++;
string line1 = sr1.ReadLine();
string line2 = sr2.ReadLine();
if (line1 != line2)
{
isNotEqual = true;
lineNumber = k;
}
}
if (isNotEqual)
{
report.WriteLine("bad test");
report.WriteLine();
}
else
{
report.WriteLine("good test");
report.WriteLine();
}
sr1.Close();
sr2.Close();
report.Close();
}
// Console.ReadLine();
}
}
}