public void TestException() { using (var reader = new OutsReader(@TestContext.CurrentContext.TestDirectory + "/../../../data//20030428_4_29L_15.outs")) { for (int i = 0; i < 731; i++) { reader.NextContent(); } //expect to throw exception reader.NextContent(); } }
public override List <IIdentifiedSpectrum> ReadFromFile(string fileName) { var result = new List <IIdentifiedSpectrum>(); using (var reader = new OutsReader(fileName)) { Progress.SetRange(1, reader.FileCount); int count = 0; while (reader.HasNext) { if (Progress.IsCancellationPending()) { throw new UserTerminatedException(); } List <string> context = reader.NextContent(); IIdentifiedSpectrum spectrum = this.parser.Parse(context); if (null != spectrum) { result.Add(spectrum); } Progress.SetPosition(count++); } Progress.End(); } return(result); }
public void TestAll() { using (var reader = new OutsReader(@TestContext.CurrentContext.TestDirectory + "/../../../data//20030428_4_29L_15.outs")) { Assert.AreEqual(731, reader.FileCount); for (int i = 0; i < 731; i++) { Assert.AreEqual(true, reader.HasNext); reader.NextContent(); } Assert.AreEqual(false, reader.HasNext); } }