public void TestGetFormat()
        {
            var filename = "NCDK.Data.Smiles.test2.smi";

            Trace.TraceInformation("Testing: " + filename);
            var ins = ResourceLoader.GetAsStream(filename);
            EnumerableSMILESReader reader = new EnumerableSMILESReader(ins, ChemObjectBuilder.Instance);
            IResourceFormat        format = reader.Format;

            Assert.IsTrue(format is SMILESFormat);
        }
        public void TestSMILESTitles()
        {
            var filename = "NCDK.Data.Smiles.tabs.smi";

            Trace.TraceInformation("Testing: " + filename);
            var ins = ResourceLoader.GetAsStream(filename);
            EnumerableSMILESReader reader = new EnumerableSMILESReader(ins, ChemObjectBuilder.Instance);

            foreach (var mol in reader)
            {
                string title = (string)mol.Title;
                Assert.IsNotNull(title);
            }
        }
        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());
        }
        public void TestRemove()
        {
            var filename = "NCDK.Data.Smiles.test2.smi";
            var ins1     = ResourceLoader.GetAsStream(filename);
            EnumerableSMILESReader reader = new EnumerableSMILESReader(ins1, ChemObjectBuilder.Instance);
            int molCount = 0;

            foreach (var mol in reader)
            {
                molCount++;
                if (molCount > 2)
                {
                    break;
                }
            }
            reader.Remove();
        }
        public void TestSMILESFile()
        {
            var filename = "NCDK.Data.Smiles.test2.smi";

            Trace.TraceInformation("Testing: " + filename);
            var ins = ResourceLoader.GetAsStream(filename);
            EnumerableSMILESReader reader = new EnumerableSMILESReader(ins, ChemObjectBuilder.Instance);

            int molCount = 0;

            foreach (var obj in reader)
            {
                Assert.IsNotNull(obj);
                Assert.IsTrue(obj is IAtomContainer);
                molCount++;
            }

            Assert.AreEqual(5, molCount);
        }
        public void TestSetReader1()
        {
            var filename = "NCDK.Data.Smiles.test2.smi";
            var ins1     = ResourceLoader.GetAsStream(filename);
            EnumerableSMILESReader reader1 = new EnumerableSMILESReader(ins1, ChemObjectBuilder.Instance);
            int molCount = 0;

            foreach (var mol in reader1)
            {
                molCount++;
            }
            filename = "NCDK.Data.Smiles.tabs.smi";
            var ins2 = ResourceLoader.GetAsStream(filename);
            EnumerableSMILESReader reader2 = new EnumerableSMILESReader(ins2, ChemObjectBuilder.Instance);

            molCount = 0;
            foreach (var mol in reader2)
            {
                molCount++;
            }
            Assert.AreEqual(5, molCount);
        }
        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());
        }