static bool Compare(SourceExcel sourceExcel, ComparingFile comparingFile) { bool result = true; if (!sourceExcel.HRAE.Equals(comparingFile.HRAE)) { Console.WriteLine(string.Format("HRAE Final : {0} Production : {1}", sourceExcel.HRAE, comparingFile.HRAE)); result = false; } if (!sourceExcel.ResultType.Equals(comparingFile.ResultType)) { Console.WriteLine(string.Format("ResultType Final : {0} Production : {1}", sourceExcel.ResultType, comparingFile.ResultType)); result = false; } if (!sourceExcel.ScriptStep.Equals(comparingFile.ScriptStep)) { Console.WriteLine(string.Format("ScriptStep Final : {0} Production : {1}", sourceExcel.ScriptStep, comparingFile.ScriptStep)); result = false; } if (!sourceExcel.ScriptStepId.Equals(comparingFile.ScriptStepId)) { Console.WriteLine(string.Format("ScriptStepId Final : {0} Production : {1}", sourceExcel.ScriptStepId, comparingFile.ScriptStepId)); result = false; } if (!sourceExcel.Section.Equals(comparingFile.Section)) { Console.WriteLine(string.Format("Section Final : {0} Production : {1}", sourceExcel.Section, comparingFile.Section)); result = false; } if (!sourceExcel.Sequence.Equals(comparingFile.Sequence)) { Console.WriteLine(string.Format("HRAE Sequence : {0} Production : {1}", sourceExcel.Sequence, comparingFile.Sequence)); result = false; } if (!sourceExcel.ShowComments.Equals(comparingFile.ShowComments)) { Console.WriteLine(string.Format("ShowComments Final : {0} Production : {1}", sourceExcel.ShowComments, comparingFile.ShowComments)); result = false; } if (!sourceExcel.StepResultValues.Equals(comparingFile.StepResultValues)) { Console.WriteLine(string.Format("StepResultValues Final : {0} Production : {1}", sourceExcel.StepResultValues, comparingFile.StepResultValues)); result = false; } if (!sourceExcel.TestScript.Equals(comparingFile.TestScript)) { Console.WriteLine(string.Format("TestScript Final : {0} Production : {1}", sourceExcel.TestScript, comparingFile.TestScript)); result = false; } return(result); }
public void Compare() { string file = ""; string sequencFileLoc = @"C:\Users\syamrull\Downloads\Script Step templates\final\Sequence Advanced Find View 2019-01-26 06_26_59Z.xlsx"; string finalFilesFolder = @"C:\Users\syamrull\Downloads\Script Step templates\final"; string allSriptStepFileLoc = @"C:\Users\syamrull\Downloads\Script Step templates\final\Script Step Advanced Find View 1-25-2019 11-17-06 AM.xlsx"; //C:\Users\syamrull\Downloads\Script Step templates\final\Test Script Advanced Find View 1-25-2019 8-58-19 AM.csv CsvHelper.CsvReader destinationReader; List <ComparingFile> comparingFile; FetchProductionInfo(out file, allSriptStepFileLoc, out destinationReader, out comparingFile); List <SequenceInfo> sequenceFileInfo; FetchSequenceInfo(out file, sequencFileLoc, out sequenceFileInfo); var k = sequenceFileInfo; string[] files = System.IO.Directory.GetFiles(finalFilesFolder, "*.Final.xlsx"); foreach (var fileName in files) { ExcelToCSVCoversion(fileName, out file); if (string.IsNullOrEmpty(file)) { continue; } CsvHelper.CsvReader csvReader = new CsvHelper.CsvReader(File.OpenText(file + ".csv")); csvReader.Read(); csvReader.ReadHeader(); List <SourceExcel> sourceExcels = new List <SourceExcel>(); while (csvReader.Read()) { var source = new SourceExcel(csvReader); sourceExcels.Add(source); } CompareExcel(sourceExcels, comparingFile, sequenceFileInfo); } Console.ReadLine(); }