public void TestAccepts() { SMILESWriter reader = new SMILESWriter(new StringWriter()); Assert.IsTrue(reader.Accepts(typeof(AtomContainer))); Assert.IsTrue(reader.Accepts(typeof(ChemObjectSet <IAtomContainer>))); }
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")); }
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")); }