Exemple #1
0
        public void TestSerializationEmptyReaction()
        {
            Reaction        x1     = CreateObject <Reaction>().WithName("Regina").WithDimension(DimensionLength);
            IContainer      c1     = CreateObject <Container>().WithName("Conrad");
            IMoleculeAmount educt1 = CreateObject <MoleculeAmount>().WithName("Eduard").WithParentContainer(c1);
            IMoleculeAmount educt2 = CreateObject <MoleculeAmount>().WithName("Edward").WithParentContainer(c1);

            x1.AddEduct(new ReactionPartner(1.1, educt1));
            x1.AddEduct(new ReactionPartner(1.2, educt2));

            IMoleculeAmount product1 = CreateObject <MoleculeAmount>().WithName("Proton").WithParentContainer(c1);
            IMoleculeAmount product2 = CreateObject <MoleculeAmount>().WithName("Prosit").WithParentContainer(c1);

            x1.AddProduct(new ReactionPartner(1.1, product1));
            x1.AddProduct(new ReactionPartner(1.2, product2));
            x1.AddModifier("mod");

            var cont1 = new Container {
                c1, x1
            }.WithId("toto");
            var cont2 = SerializeAndDeserialize(cont1);
            var x2    = cont2.FindByName(x1.Name).DowncastTo <Reaction>();

            AssertForSpecs.AreEqualReaction(x2, x1);
        }
        protected override void Context()
        {
            base.Context();
            var f1 = new ExplicitFormula("CL*conc").WithName("formula");
            var r1 = new Reaction().WithName("Reaction").WithFormula(f1);

            r1.AddEduct(new ReactionPartner(1, new MoleculeAmount().WithName("Drug")));
            r1.AddEduct(new ReactionPartner(1, new MoleculeAmount().WithName("Metab")));
            r1.AddModifier("Cyp");
            var p11 = new Parameter().WithName("P1").WithFormula(new ConstantFormula(2)).WithParentContainer(r1);

            var f2 = new ExplicitFormula("CL*conc").WithName("formula");
            var r2 = new Reaction().WithName("Reaction").WithFormula(f2);

            r2.AddEduct(new ReactionPartner(1, new MoleculeAmount().WithName("Drug")));
            r2.AddEduct(new ReactionPartner(1, new MoleculeAmount().WithName("Metab")));
            r2.AddModifier("Cyp");
            var p12 = new Parameter().WithName("P1").WithFormula(new ConstantFormula(2)).WithParentContainer(r2);

            _object1 = r1;
            _object2 = r2;
        }