コード例 #1
0
        public void IsEmptyTest()
        {
            TextReader reader = new StringReader(" empty1\n empty2");
            var        smis   = new EnumerableSMILESReader(reader, CDK.Builder).GetEnumerator();

            Assert.IsTrue(smis.MoveNext());
            IAtomContainer m1 = smis.Current;

            Assert.AreEqual(0, m1.Atoms.Count);
            Assert.AreEqual("empty1", m1.Title);
            Assert.IsTrue(smis.MoveNext());
            IAtomContainer m2 = smis.Current;

            Assert.AreEqual(0, m2.Atoms.Count);
            Assert.AreEqual("empty2", m2.Title);
            Assert.IsFalse(smis.MoveNext());
        }
コード例 #2
0
        public void ProblemSmiles()
        {
            TextReader reader = new StringReader(" okay\nn1cccc1 bad\n okay");
            var        smis   = new EnumerableSMILESReader(reader, CDK.Builder).GetEnumerator();

            Assert.IsTrue(smis.MoveNext());
            IAtomContainer m1 = smis.Current;

            Assert.AreEqual(0, m1.Atoms.Count);
            Assert.AreEqual("okay", m1.Title);
            Assert.IsTrue(smis.MoveNext());
            IAtomContainer m2 = smis.Current;

            Assert.AreEqual(0, m2.Atoms.Count);
            Assert.AreEqual("bad", m2.Title);
            Assert.AreEqual("n1cccc1 bad", m2.GetProperty <string>(EnumerableSMILESReader.BadSmilesInput));
            smis.MoveNext();
            IAtomContainer m3 = smis.Current;

            Assert.AreEqual(0, m3.Atoms.Count);
            Assert.AreEqual("okay", m3.Title);
            Assert.IsFalse(smis.MoveNext());
        }