public void LoadStrikesTest_Should_Work() { var strikes = new List <BaseStrikeChina>(); var srcFile1 = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"data\2008_07_09.txt"); if (File.Exists(srcFile1)) { var fileProcessor = new LlsFileProcessor(srcFile1, Encoding.UTF8); strikes.AddRange(fileProcessor.ReturnStrikesChinaByProcess()); } Assert.IsTrue(strikes.Count > 0); }
/// <summary> /// 读取源文件,并获取数据到内存; /// </summary> private Task <List <BaseStrikeChina> > ReadDataAsync() { return(Task <List <BaseStrikeChina> > .Run(() => { var strikes = new List <BaseStrikeChina>(); var str = System.AppDomain.CurrentDomain.BaseDirectory; var srcFile1 = AppDomain.CurrentDomain.BaseDirectory + @"\data\2008_07_09.txt"; var srcFile2 = AppDomain.CurrentDomain.BaseDirectory + @"\data\2008_07_10.txt"; if (File.Exists(srcFile1)) { var fileProcessor = new LlsFileProcessor(srcFile1, Encoding.UTF8); strikes.AddRange(fileProcessor.ReturnStrikesChinaByProcess()); } if (File.Exists(srcFile2)) { var fileProcessor = new LlsFileProcessor(srcFile2, Encoding.UTF8); strikes.AddRange(fileProcessor.ReturnStrikesChinaByProcess()); } SrcFileLoadCompleted(this, new EventArgs()); return strikes; })); }