public static IEnumerable <string> GetAllIDs(IChemModel chemModel) { if (chemModel.Id != null) { yield return(chemModel.Id); } var crystal = chemModel.Crystal; if (crystal != null) { foreach (var e in AtomContainerManipulator.GetAllIDs(crystal)) { yield return(e); } } var moleculeSet = chemModel.MoleculeSet; if (moleculeSet != null) { foreach (var e in MoleculeSetManipulator.GetAllIDs(moleculeSet)) { yield return(e); } } var reactionSet = chemModel.ReactionSet; if (reactionSet != null) { foreach (var e in ReactionSetManipulator.GetAllIDs(reactionSet)) { yield return(e); } } yield break; }
public void TestGetAllIDs_IAtomContainerSet() { som.Id = "som"; mol2.Id = "mol"; atomInMol2.Id = "atom"; bondInMol1.Id = "bond"; var list = MoleculeSetManipulator.GetAllIDs(som); Assert.AreEqual(4, list.Count()); }