Esempio n. 1
0
        public void RunFormat(IITraqResultFileFormat format)
        {
            Setup();

            var tmpFilename = @TestContext.CurrentContext.TestDirectory + "/../../../data//temp.xml";

            format.WriteToFile(tmpFilename, tr);

            FileAssert.AreEqual(@TestContext.CurrentContext.TestDirectory + "/../../../data//ITraqResult.xml", tmpFilename);

            var newtr = format.ReadFromFile(tmpFilename);

            CheckExtension.CheckEquals(tr, newtr);

            format.ReadPeaks = false;
            var newstr2 = format.ReadFromFile(tmpFilename);

            Assert.IsEmpty(newstr2[0].RawPeaks);
            Assert.IsEmpty(newstr2[0].PeakInIsolationWindow);
            Assert.IsEmpty(newstr2[1].RawPeaks);
            Assert.IsEmpty(newstr2[1].PeakInIsolationWindow);

            format.Accept = (m => 355 == m.Scan.Scan);
            var newstr3 = format.ReadFromFile(tmpFilename);

            Assert.AreEqual(1, newstr3.Count);
            Assert.AreEqual(355, newstr3[0].Scan.Scan);

            var lines = File.ReadAllText(tmpFilename);
            ITraqResultXmlFormatReader reader = new ITraqResultXmlFormatReader();

            reader.OpenByContent(lines);
            var item = reader.Next();

            CheckExtension.CheckEquals(tr[0], item);
            item = reader.Next();
            CheckExtension.CheckEquals(tr[1], item);

            File.Delete(tmpFilename);
            if (File.Exists(tmpFilename + ".index"))
            {
                File.Delete(tmpFilename + ".index");
            }
        }
    public void RunFormat(IITraqResultFileFormat format)
    {
      Setup();

      var tmpFilename = @"../../../data/temp.xml";
      format.WriteToFile(tmpFilename, tr);

      FileAssert.AreEqual(@"../../../data/ITraqResult.xml", tmpFilename);

      var newtr = format.ReadFromFile(tmpFilename);

      CheckExtension.CheckEquals(tr, newtr);

      format.ReadPeaks = false;
      var newstr2 = format.ReadFromFile(tmpFilename);
      Assert.IsEmpty(newstr2[0].RawPeaks);
      Assert.IsEmpty(newstr2[0].PeakInIsolationWindow);
      Assert.IsEmpty(newstr2[1].RawPeaks);
      Assert.IsEmpty(newstr2[1].PeakInIsolationWindow);

      format.Accept = (m => 355 == m.Scan.Scan);
      var newstr3 = format.ReadFromFile(tmpFilename);
      Assert.AreEqual(1, newstr3.Count);
      Assert.AreEqual(355, newstr3[0].Scan.Scan);

      var lines = File.ReadAllText(tmpFilename);
      ITraqResultXmlFormatReader reader = new ITraqResultXmlFormatReader();
      reader.OpenByContent(lines);
      var item = reader.Next();
      CheckExtension.CheckEquals(tr[0], item);
      item = reader.Next();
      CheckExtension.CheckEquals(tr[1], item);

      File.Delete(tmpFilename);
      if (File.Exists(tmpFilename + ".index"))
      {
        File.Delete(tmpFilename + ".index");
      }
    }