Exemple #1
0
        public void TestAccepts()
        {
            SMILESWriter reader = new SMILESWriter(new StringWriter());

            Assert.IsTrue(reader.Accepts(typeof(AtomContainer)));
            Assert.IsTrue(reader.Accepts(typeof(ChemObjectSet <IAtomContainer>)));
        }
Exemple #2
0
        public void TestWriteSMILESFile()
        {
            StringWriter   stringWriter = new StringWriter();
            IAtomContainer benzene      = TestMoleculeFactory.MakeBenzene();

            AddImplicitHydrogens(benzene);
            SMILESWriter smilesWriter = new SMILESWriter(stringWriter);

            smilesWriter.Write(benzene);
            smilesWriter.Close();
            Assert.IsTrue(stringWriter.ToString().Contains("C=C"));
        }
Exemple #3
0
        public void TestWriteAromatic()
        {
            StringWriter   stringWriter = new StringWriter();
            IAtomContainer benzene      = TestMoleculeFactory.MakeBenzene();

            AddImplicitHydrogens(benzene);
            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(benzene);
            Aromaticity.CDKLegacy.Apply(benzene);
            SMILESWriter smilesWriter = new SMILESWriter(stringWriter);
            var          prop         = new NameValueCollection();

            prop["UseAromaticity"] = "true";
            PropertiesListener listener = new PropertiesListener(prop);

            smilesWriter.Listeners.Add(listener);
            smilesWriter.CustomizeJob();
            smilesWriter.Write(benzene);
            smilesWriter.Close();
            Assert.IsFalse(stringWriter.ToString().Contains("C=C"));
            Assert.IsTrue(stringWriter.ToString().Contains("ccc"));
        }