private void Check_Lp_File(string fileName) { string fileNameWithPath = Path.Combine(path, fileName); Reader reader = new Reader(); ProcessorResult processorResult = reader.ProcessFile(fileNameWithPath); var lp_Data = Proc_Lp.Get_Data_Directly(fileNameWithPath); Assert.IsTrue(processorResult.Result.SequenceEqual(lp_Data)); }
public static IProcessor GetProcessor(string fileNameWithPath) { if (string.IsNullOrEmpty(fileNameWithPath)) { throw new ProcessorException("FileName is empty!"); } if (!File.Exists(fileNameWithPath)) { throw new ProcessorException($"File {fileNameWithPath} doesn't exist!"); } var fileName = Path.GetFileName(fileNameWithPath); if (string.IsNullOrEmpty(fileName)) { throw new ProcessorException("Unknown fileName!"); } IProcessor processor = null; if (fileName.StartsWith("LP")) { processor = new Proc_Lp(fileName); } else if (fileName.StartsWith("TOU")) { processor = new Proc_Tou(fileName); } if (processor == null) { throw new ProcessorException($"Processor hasn't been assigned due to unknown filename '{fileName}'!"); } return(processor); }