示例#1
0
        public void TestMixedNamespaces()
        {
            var ins    = ResourceLoader.GetAsStream(this.GetType(), "US06358966-20020319-C00001-enr.cml");
            var reader = new CMLReader(ins);

            try
            {
                IChemFile cfile = reader.Read(ChemObjectBuilder.Instance.NewChemFile());
                Assert.AreEqual(34, ChemFileManipulator.GetAtomCount(cfile));
                Assert.AreEqual(39, ChemFileManipulator.GetBondCount(cfile));
            }
            finally
            {
                reader.Close();
            }
        }
 void AssertBondCount(int expectedBondCount, IChemObject chemObject)
 {
     if (expectedBondCount != -1)
     {
         if (chemObject is IChemFile)
         {
             Assert.AreEqual(expectedBondCount, ChemFileManipulator.GetBondCount((IChemFile)chemObject));
         }
         else if (chemObject is IChemModel)
         {
             Assert.AreEqual(expectedBondCount, ChemModelManipulator.GetBondCount((IChemModel)chemObject));
         }
         else if (chemObject is IAtomContainer)
         {
             Assert.AreEqual(expectedBondCount, ((IAtomContainer)chemObject).Bonds.Count);
         }
         else if (chemObject is IReaction)
         {
             Assert.AreEqual(expectedBondCount, ReactionManipulator.GetBondCount((IReaction)chemObject));
         }
     }
 }