예제 #1
0
        public void TestClone_Isotopes()
        {
            MolecularFormulaRange mfRange = new MolecularFormulaRange();
            IIsotope carb = builder.NewIsotope("C");
            IIsotope flu  = builder.NewIsotope("F");
            IIsotope h1   = builder.NewIsotope("H");

            mfRange.AddIsotope(carb, 0, 5);
            mfRange.AddIsotope(flu, 2, 8);
            mfRange.AddIsotope(h1, 4, 10);

            Assert.AreEqual(3, mfRange.Count);
            Assert.AreEqual(0, mfRange.GetIsotopeCountMin(carb));
            Assert.AreEqual(2, mfRange.GetIsotopeCountMin(flu));
            Assert.AreEqual(4, mfRange.GetIsotopeCountMin(h1));
            Assert.AreEqual(5, mfRange.GetIsotopeCountMax(carb));
            Assert.AreEqual(8, mfRange.GetIsotopeCountMax(flu));
            Assert.AreEqual(10, mfRange.GetIsotopeCountMax(h1));

            object clone = mfRange.Clone();

            Assert.IsTrue(clone is MolecularFormulaRange);
            Assert.AreEqual(mfRange.Count, ((MolecularFormulaRange)clone).Count);

            Assert.AreEqual(3, ((MolecularFormulaRange)clone).Count);

            Assert.AreEqual(3, ((MolecularFormulaRange)clone).Count);
            Assert.AreEqual(0, ((MolecularFormulaRange)clone).GetIsotopeCountMin(carb));
            Assert.AreEqual(2, ((MolecularFormulaRange)clone).GetIsotopeCountMin(flu));
            Assert.AreEqual(4, ((MolecularFormulaRange)clone).GetIsotopeCountMin(h1));
            Assert.AreEqual(5, ((MolecularFormulaRange)clone).GetIsotopeCountMax(carb));
            Assert.AreEqual(8, ((MolecularFormulaRange)clone).GetIsotopeCountMax(flu));
            Assert.AreEqual(10, ((MolecularFormulaRange)clone).GetIsotopeCountMax(h1));
        }
예제 #2
0
        public void TestClone()
        {
            MolecularFormulaRange mfRange = new MolecularFormulaRange();
            object clone = mfRange.Clone();

            Assert.IsTrue(clone is MolecularFormulaRange);
            Assert.AreEqual(mfRange.Count, ((MolecularFormulaRange)clone).Count);
        }