public void TestInvalidInfo() { try { InstrumentInfoUtil.GetInstrumentInfo(INFO5); Assert.Fail("Expected IOException parsing invalid instrument info string"); } catch (IOException e) { AssertEx.AreComparableStrings(Resources.InstrumentInfoUtil_ReadInstrumentConfig_Unexpected_line_in_instrument_config__0__, e.Message, 1); } }
public void TestParse() { var instrumentConfigList = InstrumentInfoUtil.GetInstrumentInfo(null).ToList(); Assert.AreEqual(0, instrumentConfigList.Count()); instrumentConfigList = InstrumentInfoUtil.GetInstrumentInfo("").ToList(); Assert.AreEqual(0, instrumentConfigList.Count()); var str = "\n\n"; instrumentConfigList = InstrumentInfoUtil.GetInstrumentInfo(str).ToList(); Assert.AreEqual(0, instrumentConfigList.Count(), str); str = "\n" + InstrumentInfoUtil.MODEL; instrumentConfigList = InstrumentInfoUtil.GetInstrumentInfo(str).ToList(); Assert.AreEqual(0, instrumentConfigList.Count(), str); instrumentConfigList = InstrumentInfoUtil.GetInstrumentInfo(INFO1).ToList(); Assert.AreEqual(0, instrumentConfigList.Count(), INFO1); instrumentConfigList = InstrumentInfoUtil.GetInstrumentInfo(INFO2).ToList(); Assert.AreEqual(1, instrumentConfigList.Count(), INFO2); // check instrument model Assert.AreEqual("MS_TSQ_Vantage", instrumentConfigList[0].Model); // check ionization type Assert.AreEqual("", instrumentConfigList[0].Ionization); // check analyzer Assert.AreEqual("", instrumentConfigList[0].Analyzer); // check detector Assert.AreEqual("", instrumentConfigList[0].Detector); instrumentConfigList = InstrumentInfoUtil.GetInstrumentInfo(INFO3).ToList(); Assert.AreEqual(1, instrumentConfigList.Count(), INFO3); instrumentConfigList = InstrumentInfoUtil.GetInstrumentInfo(INFO4).ToList(); Assert.AreEqual(2, instrumentConfigList.Count(), INFO4); // check instrument model 1 Assert.AreEqual("MS_TSQ_Vantage", instrumentConfigList[0].Model); // check instrument model 2 Assert.AreEqual("MS_LTQ_FT", instrumentConfigList[1].Model); // check ionization type 1 Assert.AreEqual("", instrumentConfigList[0].Ionization); // check ionization type 2 Assert.AreEqual("MS_ionization_type", instrumentConfigList[1].Ionization); // check analyzer 1 Assert.AreEqual("", instrumentConfigList[0].Analyzer); // check analyzer 2 Assert.AreEqual("", instrumentConfigList[1].Analyzer); // check detector 1 Assert.AreEqual("", instrumentConfigList[0].Detector); // check detector 2 Assert.AreEqual("", instrumentConfigList[1].Detector); }