Example #1
0
 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);
     }
 }
Example #2
0
        public void TestConvert()
        {
            Assert.AreEqual("", InstrumentInfoUtil.GetInstrumentInfoString(null));

            List <MsInstrumentConfigInfo> instrumentInfoList = new List <MsInstrumentConfigInfo>();

            Assert.AreEqual("", InstrumentInfoUtil.GetInstrumentInfoString(instrumentInfoList));

            instrumentInfoList.Add(new MsInstrumentConfigInfo("MS_TSQ_Vantage ", null, null, null));
            // trailing white space should have been removed from model name.
            Assert.AreEqual(INFO1_WRITE, InstrumentInfoUtil.GetInstrumentInfoString(instrumentInfoList));

            // Add an empty instrument info
            instrumentInfoList.Add(new MsInstrumentConfigInfo("  ", null, null, null));
            // The empty instrument info should not have been written
            Assert.AreEqual(INFO1_WRITE, InstrumentInfoUtil.GetInstrumentInfoString(instrumentInfoList));

            // Add another instrument info
            instrumentInfoList.Add(new MsInstrumentConfigInfo("MS_LTQ_FT", "MS ionization\ntype", null, null));
            // Internal \n in ionization type string should habe been removed
            Assert.AreEqual(INFO2_WRITE, InstrumentInfoUtil.GetInstrumentInfoString(instrumentInfoList));
        }
Example #3
0
        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);
        }