Ejemplo n.º 1
0
        public void TestFormatRandom()
        {
            Setup();

            var format = new ITraqResultXmlFormatRandomReader();

            format.Open(@TestContext.CurrentContext.TestDirectory + "/../../../data//ITraqResult.xml");
            CheckExtension.CheckEquals(t2, format.Read("S2", 355));
            CheckExtension.CheckEquals(t1, format.Read("S1", 255));

            Assert.AreEqual(1281, format.ReadXmlBytes("S1", 255).Length);
            Assert.AreEqual(1386, format.ReadXmlBytes("S2", 355).Length);
        }
Ejemplo n.º 2
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 TestReadWrite()
        {
            List <FileIndexItem> items = new List <FileIndexItem>();

            items.Add(new FileIndexItem(12, 54, "TEST1"));
            items.Add(new FileIndexItem(122, 776, "TEST2"));
            items.Add(new FileIndexItem(12483, 39484, "TEST3"));
            items.Add(new FileIndexItem(121111111111111, 38948392309484, "TEST4"));

            var format      = new FileIndexFormat();
            var tmpFilename = TestContext.CurrentContext.TestDirectory + "/../../../data//fif.txt";

            format.WriteToFile(tmpFilename, items);

            var newitems = format.ReadFromFile(tmpFilename);

            CheckExtension.CheckEquals(items, newitems);

            File.Delete(tmpFilename);
        }