Esempio n. 1
0
        public virtual void TestAddAtom_IAtom_IMonomer()
        {
            IPolymer oPolymer = (IPolymer)NewChemObject();
            IMonomer oMono1   = oPolymer.Builder.NewMonomer();

            oMono1.MonomerName = "TRP279";
            IMonomer oMono2 = null;
            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);
            Assert.IsNotNull(oPolymer.Atoms[0]);
            Assert.IsNotNull(oPolymer.Atoms[1]);
            Assert.IsNotNull(oPolymer.Atoms[2]);
            Assert.AreEqual(oAtom1, oPolymer.Atoms[0]);
            Assert.AreEqual(oAtom2, oPolymer.Atoms[1]);
            Assert.AreEqual(oAtom3, oPolymer.Atoms[2]);
            Assert.AreEqual(3, oPolymer.Atoms.Count);
            Assert.AreEqual(1, oPolymer.GetMonomer("TRP279").Atoms.Count);
            Assert.AreEqual(1, oPolymer.GetMonomerMap().Count());

            Assert.IsNotNull(oPolymer.GetMonomer("TRP279"));
            Assert.AreEqual(oMono1, oPolymer.GetMonomer("TRP279"));
        }
Esempio n. 2
0
        public override void TestClone()
        {
            IPolymer polymer = (IPolymer)NewChemObject();
            object   clone   = polymer.Clone();

            Assert.IsTrue(clone is IPolymer);
        }
Esempio n. 3
0
        public override void TestToString()
        {
            IPolymer polymer = (IPolymer)NewChemObject();
            IMonomer oMono1  = polymer.Builder.NewMonomer();

            oMono1.MonomerName = "TRP279";
            IMonomer oMono2 = polymer.Builder.NewMonomer();

            oMono2.MonomerName = "HOH";
            IAtom oAtom2 = polymer.Builder.NewAtom("C");
            IAtom oAtom3 = polymer.Builder.NewAtom("C");

            polymer.AddAtom(oAtom2, oMono1);
            polymer.AddAtom(oAtom3, oMono2);
            IDictionary <string, IMonomer> monomers = new Dictionary <string, IMonomer>
            {
                { "TRP279", oMono1 },
                { "HOH", oMono2 }
            };
            string description = polymer.ToString();

            for (int i = 0; i < description.Length; i++)
            {
                Assert.IsTrue('\n' != description[i]);
                Assert.IsTrue('\r' != description[i]);
            }
        }
Esempio n. 4
0
        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()));
        }
Esempio n. 5
0
        public void TestNewPolymer()
        {
            IChemObjectBuilder builder = RootObject.Builder;
            IPolymer           polymer = builder.NewPolymer();

            Assert.IsNotNull(polymer);
        }
Esempio n. 6
0
        public override void TestAddAtom_IAtom()
        {
            IPolymer oPolymer = (IPolymer)NewChemObject();

            IAtom oAtom1 = oPolymer.Builder.NewAtom("C");
            IAtom oAtom2 = oPolymer.Builder.NewAtom("C");

            oPolymer.Atoms.Add(oAtom1);
            oPolymer.Atoms.Add(oAtom2);

            Assert.AreEqual(2, oPolymer.Atoms.Count);
            Assert.AreEqual(0, oPolymer.GetMonomerMap().Count());
        }
Esempio n. 7
0
        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);
        }
Esempio n. 8
0
        public virtual void TestGetMonomer_String()
        {
            IPolymer oPolymer = (IPolymer)NewChemObject();

            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.AddAtom(oAtom1, oMono1);
            oPolymer.AddAtom(oAtom2, oMono1);
            oPolymer.AddAtom(oAtom3, oMono2);

            Assert.AreEqual(oMono1, oPolymer.GetMonomer("TRP279"));
            Assert.AreEqual(oMono2, oPolymer.GetMonomer("HOH"));
            Assert.IsNull(oPolymer.GetMonomer("Mek"));
        }
Esempio n. 9
0
        public virtual void TestGetMonomerCount()
        {
            IPolymer oPolymer = (IPolymer)NewChemObject();

            Assert.AreEqual(0, oPolymer.GetMonomerMap().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);

            Assert.AreEqual(3, oPolymer.Atoms.Count);
            Assert.AreEqual(2, oPolymer.GetMonomerMap().Count());
        }