public virtual void TestGetMonomerNames() { IPolymer oPolymer = (IPolymer)NewChemObject(); Assert.AreEqual(0, oPolymer.GetMonomerNames().Count()); IMonomer oMono1 = oPolymer.Builder.NewMonomer(); oMono1.MonomerName = "TRP279"; IMonomer oMono2 = oPolymer.Builder.NewMonomer(); oMono2.MonomerName = "HOH"; IAtom oAtom1 = oPolymer.Builder.NewAtom("C"); IAtom oAtom2 = oPolymer.Builder.NewAtom("C"); IAtom oAtom3 = oPolymer.Builder.NewAtom("C"); oPolymer.Atoms.Add(oAtom1); oPolymer.AddAtom(oAtom2, oMono1); oPolymer.AddAtom(oAtom3, oMono2); IDictionary <string, IMonomer> monomers = new Dictionary <string, IMonomer> { //IMonomer oMon = Builder.NewMonomer(); { "TRP279", oMono1 }, { "HOH", oMono2 } }; Assert.AreEqual(2, oPolymer.GetMonomerNames().Count()); Assert.IsTrue(oPolymer.GetMonomerNames().Contains(oMono1.MonomerName)); Assert.IsTrue(oPolymer.GetMonomerNames().Contains(oMono2.MonomerName)); Assert.IsTrue(Compares.AreDeepEqual(monomers.Keys, oPolymer.GetMonomerNames())); }
public virtual void TestRemoveMonomer_String() { IPolymer oPolymer = (IPolymer)NewChemObject(); IMonomer oMono1 = oPolymer.Builder.NewMonomer(); oMono1.MonomerName = "TRP279"; IAtom oAtom1 = oPolymer.Builder.NewAtom("C"); oPolymer.AddAtom(oAtom1, oMono1); Assert.IsTrue(oPolymer.GetMonomerNames().Contains(oMono1.MonomerName)); Assert.AreEqual(1, oPolymer.Atoms.Count); oPolymer.RemoveMonomer("TRP279"); Assert.IsFalse(oPolymer.GetMonomerNames().Contains(oMono1.MonomerName)); Assert.AreEqual(0, oPolymer.Atoms.Count); }