コード例 #1
0
ファイル: TestSBML.cs プロジェクト: dorchard/mucell
        public void testNonDataDuplicate()
        {
            MuCell.Model.SBML.Model model = new MuCell.Model.SBML.Model();
            MuCell.Model.SBML.Species species1 = new MuCell.Model.SBML.Species();
            MuCell.Model.SBML.Species species2 = new MuCell.Model.SBML.Species();
            MuCell.Model.SBML.Species species3 = new MuCell.Model.SBML.Species();

            model.listOfSpecies = new List<MuCell.Model.SBML.Species>();
            model.listOfSpecies.Add(species1);
            model.listOfSpecies.Add(species2);
            model.listOfSpecies.Add(species3);

            // Set some values for species1
            species1.ID = "species1";
            species1.InitialAmount = 4.0d;
            species1.InitialConcentration = 7.0d;
            species1.xPosition = 2.0f;

            // Set some values for species2 that has the same id and same values
            species2.ID = "species1";
            species2.InitialAmount = 4.0d;
            species2.InitialConcentration = 7.0d;
            species2.xPosition = 2.0f;

            // Set some values for species3 that has the same id but DIFFERENT values
            species3.ID = "species1";
            // Difference
            species3.InitialAmount = 5.0d;
            species3.InitialConcentration = 7.0d;
            species3.xPosition = 2.0f;

            // Add to the model
            model.AddId(species1.ID, species1);
            model.AddId(species2.ID, species2);
            model.AddId(species3.ID, species3);

            try
            {
                model.processDuplicates();
            }
            catch (MuCell.Model.SBML.DuplicateSBMLObjectIdException e)
            {
                // Assert that an exception has been thrown
                Assert.IsTrue(true);
            }
        }
コード例 #2
0
ファイル: TestSBML.cs プロジェクト: dorchard/mucell
        public void testDataDuplicate()
        {
            MuCell.Model.SBML.Model model = new MuCell.Model.SBML.Model();
            MuCell.Model.SBML.Species species1 = new MuCell.Model.SBML.Species();
            MuCell.Model.SBML.Species species2 = new MuCell.Model.SBML.Species();

            model.listOfSpecies = new List<MuCell.Model.SBML.Species>();
            model.listOfSpecies.Add(species1);
            model.listOfSpecies.Add(species2);

            // Set some values for species1
            species1.ID = "species1";
            species1.InitialAmount = 4.0d;
            species1.InitialConcentration = 7.0d;
            species1.xPosition = 2.0f;

            // Set some values for species2 that has the same id and same values
            species2.ID = "species1";
            species2.InitialAmount = 4.0d;
            species2.InitialConcentration = 7.0d;
            species2.xPosition = 2.0f;

            // Add to the model
            model.AddId(species1.ID, species1);
            model.AddId(species2.ID, species2);

            // Check that we have two species
            Assert.AreEqual(2, model.listOfSpecies.Count);

            // Should remove species2
            model.processDuplicates();

            // Check there is now only 1 species in the model
            Assert.AreEqual(1, model.listOfSpecies.Count);

            // Check that it is species1
            Assert.AreEqual(species1, model.listOfSpecies.ToArray()[0]);
        }