protected override void Context()
        {
            base.Context();
            var moleculeStartValuesBuildingBlock1 = new MoleculeStartValuesBuildingBlock().WithName("Tada");
            var moleculeStartValueA = new MoleculeStartValue().WithName("MSVa");

            moleculeStartValueA.ContainerPath = new ObjectPath("Root", "Liver", "Plasma");
            var moleculeStartValueB = new MoleculeStartValue().WithName("MSVb");

            moleculeStartValueB.ContainerPath = new ObjectPath("Root", "Liver", "Plasma");
            moleculeStartValuesBuildingBlock1.Add(moleculeStartValueA);
            moleculeStartValuesBuildingBlock1.Add(moleculeStartValueB);

            var moleculeStartValuesBuildingBlock2 = new MoleculeStartValuesBuildingBlock().WithName("Tada");

            moleculeStartValueA = new MoleculeStartValue().WithName("MSVa");
            moleculeStartValueA.ContainerPath = new ObjectPath("Root", "Liver", "Plasma");
            moleculeStartValueB = new MoleculeStartValue().WithName("MSVb");
            moleculeStartValueB.ContainerPath = new ObjectPath("Root", "Liver", "Cell");

            moleculeStartValuesBuildingBlock2.Add(moleculeStartValueA);
            moleculeStartValuesBuildingBlock2.Add(moleculeStartValueB);

            _object1 = moleculeStartValuesBuildingBlock1;
            _object2 = moleculeStartValuesBuildingBlock2;
        }
        protected override void Context()
        {
            base.Context();
            _buildConfiguration = A.Fake <IMoBiBuildConfiguration>();
            _templateStartValuesBuildingBlock = new MoleculeStartValuesBuildingBlock();
            _newMoleculeStartValues           = new MoleculeStartValuesBuildingBlock();

            _buildConfiguration.MoleculeStartValuesInfo = new MoleculeStartValuesBuildingBlockInfo {
                BuildingBlock = _templateStartValuesBuildingBlock, TemplateBuildingBlock = _templateStartValuesBuildingBlock
            };

            A.CallTo(_moleculeStartValuesCreator).WithReturnType <IMoleculeStartValuesBuildingBlock>().Returns(_newMoleculeStartValues);

            _newEndogenousValue = new MoleculeStartValue {
                ContainerPath = new ObjectPath("Organism", AppConstants.Organs.ENDOGENOUS_IGG, "Plasma"), Name = "M", IsPresent = true
            };
            _existingEndogenousValue = new MoleculeStartValue {
                ContainerPath = new ObjectPath("Organism", AppConstants.Organs.ENDOGENOUS_IGG, "Cell"), Name = "M", IsPresent = true
            };
            _otherStartValues = new MoleculeStartValue {
                ContainerPath = new ObjectPath("Organism", "Liver", "Cell"), Name = "M", IsPresent = true
            };
            _existingTemplateEndogenousValue = new MoleculeStartValue {
                ContainerPath = new ObjectPath("Organism", AppConstants.Organs.ENDOGENOUS_IGG, "Cell"), Name = "M", IsPresent = true
            };

            _templateStartValuesBuildingBlock.Add(_existingTemplateEndogenousValue);
            _newMoleculeStartValues.Add(_newEndogenousValue);
            _newMoleculeStartValues.Add(_existingEndogenousValue);
            _newMoleculeStartValues.Add(_otherStartValues);
        }
        protected override void Context()
        {
            base.Context();
            var moleculeStartValuesBuildingBlock1 = new MoleculeStartValuesBuildingBlock().WithName("Tada");
            var moleculeStartValueA = new MoleculeStartValue().WithName("MSVa");

            moleculeStartValueA.ContainerPath = new ObjectPath("Root", "Liver", "Plasma");
            var moleculeStartValueB = new MoleculeStartValue().WithName("MSVb");

            moleculeStartValueB.ContainerPath = new ObjectPath("Root", "Liver", "Plasma");
            moleculeStartValuesBuildingBlock1.Add(moleculeStartValueA);
            moleculeStartValuesBuildingBlock1.Add(moleculeStartValueB);


            var moleculeStartValuesBuildingBlock2 = new MoleculeStartValuesBuildingBlock().WithName("Toto");

            moleculeStartValueA = new MoleculeStartValue().WithName("MSVa");
            moleculeStartValueA.ContainerPath = new ObjectPath("Root", "Liver", "Plasma");
            moleculeStartValueB = new MoleculeStartValue().WithName("MSVb");
            moleculeStartValueB.ContainerPath = new ObjectPath("Root", "Liver", "Plasma");

            moleculeStartValuesBuildingBlock2.Add(moleculeStartValueA);
            moleculeStartValuesBuildingBlock2.Add(moleculeStartValueB);

            _object1 = moleculeStartValuesBuildingBlock1;
            _object2 = moleculeStartValuesBuildingBlock2;
            _comparerSettings.OnlyComputingRelevant = false;
        }
        protected override void Context()
        {
            base.Context();
            _templateMoleculeStartValues = new MoleculeStartValuesBuildingBlock();
            A.CallTo(_context.Context.ObjectRepository).WithReturnType <bool>().Returns(true);
            var moleculeBuildingBlock = new MoleculeBuildingBlock();

            A.CallTo(_context.Context).WithReturnType <IMoleculeBuildingBlock>().Returns(moleculeBuildingBlock);

            var spatialStructure = new SpatialStructure();

            A.CallTo(_context.Context).WithReturnType <ISpatialStructure>().Returns(spatialStructure);
            A.CallTo(() => _moleculeStartValuesCreator.CreateFrom(spatialStructure, moleculeBuildingBlock)).Returns(_templateMoleculeStartValues);

            _newEndogenousValue = new MoleculeStartValue {
                ContainerPath = new ObjectPath("Organism", AppConstants.Organs.ENDOGENOUS_IGG, "Plasma"), Name = "M", IsPresent = true
            };
            _existingEndogenousValue = new MoleculeStartValue {
                ContainerPath = new ObjectPath("Organism", AppConstants.Organs.ENDOGENOUS_IGG, "Cell"), Name = "M", IsPresent = true
            };
            _existingTemplateEndogenousValue = new MoleculeStartValue {
                ContainerPath = new ObjectPath("Organism", AppConstants.Organs.ENDOGENOUS_IGG, "Cell"), Name = "M", IsPresent = true
            };

            _templateMoleculeStartValues.Add(_newEndogenousValue);
            _templateMoleculeStartValues.Add(_existingTemplateEndogenousValue);

            _moleculeStartValueBuildingBlock.Add(_existingEndogenousValue);
        }
 protected override void Context()
 {
     base.Context();
     A.CallTo(() => _reactionDimensionRetriever.SelectedDimensionMode).Returns(ReactionDimensionMode.ConcentrationBased);
     _moleculeStartValue = new MoleculeStartValue {
         Formula = new ExplicitFormula("10"), Dimension = DomainHelperForSpecs.ConcentrationDimension
     };
 }
 protected override void Because()
 {
     _startValue = new MoleculeStartValue {
         ContainerPath = new ObjectPath("A", "B")
     };
     _moleculeStartValueBuildingBlock.Add(_startValue);
     sut.EditStartValueContainerPath(_moleculeStartValueBuildingBlock, _startValue, 5, "C");
 }
        protected override void Context()
        {
            base.Context();
            _dim = DimensionFactoryForSpecs.Factory.Dimension(DimensionFactoryForSpecs.DimensionNames.Mass);

            _startValue = new MoleculeStartValue {
                Dimension = _dim, StartValue = _targetDisplayValue, DisplayUnit = _dim.Unit("g")
            };
        }
Exemple #8
0
 protected override void Context()
 {
     base.Context();
     _valueOrigin = new ValueOrigin();
     _startValue  = new MoleculeStartValue {
         Name = "startValue"
     };
     _moleculeStartValueBuildingBlock.Add(_startValue);
     sut.Edit(_moleculeStartValueBuildingBlock);
 }
 protected override void Context()
 {
     base.Context();
     _unit = A.Fake <Unit>();
     A.CallTo(() => _reactionDimensionRetriever.SelectedDimensionMode).Returns(ReactionDimensionMode.ConcentrationBased);
     _moleculeStartValue = new MoleculeStartValue {
         StartValue = 5, Dimension = DomainHelperForSpecs.AmountDimension
     };
     A.CallTo(() => _displayUnitRetriever.PreferredUnitFor(_moleculeStartValue)).Returns(_unit);
 }
Exemple #10
0
        protected override void Context()
        {
            _fakeDimension = A.Fake <IDimension>();
            _context       = A.Fake <IMoBiContext>();
            _buildingBlock = new MoleculeStartValuesBuildingBlock();

            _moleculeStartValue = new MoleculeStartValue {
                Path = new ObjectPath("path1"), Dimension = _fakeDimension, StartValue = -1, DisplayUnit = new Unit("Dimensionless", 1.0, 1)
            };
            sut = new AddMoleculeStartValueToBuildingBlockCommand(_buildingBlock, _moleculeStartValue);

            A.CallTo(() => _context.Get <IStartValuesBuildingBlock <IMoleculeStartValue> >(A <string> ._)).Returns(_buildingBlock);
        }
        protected override void Context()
        {
            base.Context();
            var molecule = new MoleculeBuilder {
                Name = "Mol", Dimension = Constants.Dimension.NO_DIMENSION
            };
            var nanStartValue = new MoleculeStartValue {
                Name = molecule.Name, StartValue = null, Dimension = Constants.Dimension.NO_DIMENSION
            };

            _moleculeStartValueBuildingBlock.Add(nanStartValue);
            A.CallTo(_moleculeResolver).WithReturnType <IMoleculeBuilder>().Returns(molecule);
        }
        public void TestSerialization()
        {
            var x1 = new MoleculeStartValue {
                ContainerPath = new ObjectPath("aa", "bb"), Name = "H2", Dimension = new Dimension(new BaseDimensionRepresentation(), Constants.Dimension.AMOUNT, "mol")
            };

            x1.IsPresent    = true;
            x1.StartValue   = 2.5;
            x1.ScaleDivisor = 1e-2;

            IMoleculeStartValue x2 = SerializeAndDeserialize(x1);

            AssertForSpecs.AreEqualMoleculeStartValue(x1, x2);
        }
        protected override void Context()
        {
            base.Context();
            var builder = new MoleculeBuilder {
                Name = "molecule", Dimension = Constants.Dimension.NO_DIMENSION, DefaultStartFormula = new ExplicitFormula("50")
            };
            var startValue = new MoleculeStartValue {
                Name = builder.Name, StartValue = 45, Dimension = Constants.Dimension.NO_DIMENSION, Formula = null
            };

            _moleculeStartValueBuildingBlock.Add(startValue);
            A.CallTo(() => _cloneManagerForBuildingBlock.Clone(builder.DefaultStartFormula, _moleculeStartValueBuildingBlock.FormulaCache)).Returns(new ExplicitFormula("M/V"));
            A.CallTo(_moleculeResolver).WithReturnType <IMoleculeBuilder>().Returns(builder);
        }
Exemple #14
0
        protected override void Context()
        {
            sut         = new MoleculeStartValue();
            _comparable = new MoleculeStartValue();

            sut.IsPresent         = true;
            _comparable.IsPresent = true;

            sut.Path         = new ObjectPath("A", "B", "MoleculeName");
            _comparable.Path = new ObjectPath("A", "B", "MoleculeName");

            sut.ScaleDivisor         = 1.0;
            _comparable.ScaleDivisor = 1.0;
        }
        protected override void Context()
        {
            _fakeDimension = A.Fake <IDimension>();
            _context       = A.Fake <IMoBiContext>();
            _buildingBlock = new MoleculeStartValuesBuildingBlock();

            _msv = new MoleculeStartValue {
                Path = new ObjectPath("path1"), Dimension = _fakeDimension, StartValue = -1, DisplayUnit = new Unit("Dimensionless", 1.0, 1)
            };
            _buildingBlock.Add(_msv);
            sut = new RemoveMoleculeStartValueFromBuildingBlockCommand(_buildingBlock, _msv.Path);

            A.CallTo(() => _context.Get <IStartValuesBuildingBlock <IMoleculeStartValue> >(_buildingBlock.Id)).Returns(_buildingBlock);
        }
        protected override void Context()
        {
            base.Context();
            var moleculeBuindingBlock = new MoleculeBuildingBlock();
            var molecule = new MoleculeBuilder {
                Name = "Mol", Dimension = Constants.Dimension.NO_DIMENSION
            };

            moleculeBuindingBlock.Add(molecule);
            _nullStartValue = new MoleculeStartValue {
                Name = molecule.Name, StartValue = 1, Dimension = Constants.Dimension.NO_DIMENSION
            };
            _moleculeStartValueBuildingBlock.Add(_nullStartValue);
            A.CallTo(_context.Context).WithReturnType <IMoleculeBuildingBlock>().Returns(moleculeBuindingBlock);
        }
        public IMoleculeStartValue CreateMoleculeStartValue(IObjectPath containerPath, string moleculeName, IDimension dimension, Unit displayUnit = null, ValueOrigin valueOrigin = null)
        {
            var msv = new MoleculeStartValue
            {
                Id                    = _idGenerator.NewId(),
                IsPresent             = true,
                ContainerPath         = containerPath,
                Name                  = moleculeName,
                Dimension             = dimension,
                DisplayUnit           = displayUnit ?? dimension.DefaultUnit,
                NegativeValuesAllowed = false,
            };

            msv.ValueOrigin.UpdateAllFrom(valueOrigin);
            return(msv);
        }
Exemple #18
0
        protected override void Context()
        {
            _fakeDimension = A.Fake <IDimension>();
            _context       = A.Fake <IMoBiContext>();
            _buildingBlock = new MoleculeStartValuesBuildingBlock();

            var msv = new MoleculeStartValue {
                Path = new ObjectPath("path1"), Dimension = _fakeDimension, StartValue = -1, DisplayUnit = new Unit("Dimensionless", 1.0, 1), IsPresent = false
            };

            _buildingBlock.Add(msv);
            _path = msv.Path;

            sut = new UpdateMoleculeStartValueInBuildingBlockCommand(_buildingBlock, _path, 1.0, true, 22.0, true);
            A.CallTo(() => _context.Get <IMoleculeStartValuesBuildingBlock>(_buildingBlock.Id)).Returns(_buildingBlock);
        }
Exemple #19
0
        protected override void Context()
        {
            base.Context();

            var msv1 = new MoleculeStartValue().WithName("Tada").WithFormula(new ConstantFormula(2));

            msv1.Path      = new ObjectPath("Root", "Liver", "Plasma");
            msv1.IsPresent = true;
            var msv2 = new MoleculeStartValue().WithName("Tada").WithFormula(new ConstantFormula(2));

            msv2.Path      = new ObjectPath("Root", "Liver", "Plasma");
            msv2.IsPresent = false;

            _object1 = msv1;
            _object2 = msv2;
        }
Exemple #20
0
        protected override void Context()
        {
            _context = A.Fake <IMoBiContext>();

            _moleculeStartValue = new MoleculeStartValue {
                Path = new ObjectPath("Path1", "Path2", "Name")
            };
            _buildingBlock = new MoleculeStartValuesBuildingBlock {
                _moleculeStartValue
            };
            sut = new ChangeMoleculeStartValueNameCommand(
                _buildingBlock,
                _moleculeStartValue.Path,
                "Name2");

            A.CallTo(() => _context.Get <IMoleculeStartValuesBuildingBlock>(_buildingBlock.Id)).Returns(_buildingBlock);
        }
        protected override void Context()
        {
            base.Context();
            _project = new MoBiProject();
            var molecule          = new MoleculeBuilder().WithName(_moleculeName);
            var moleculeParameter = new Parameter().WithName(_moleculeParameterName);

            molecule.Add(moleculeParameter);
            var molecules = new MoleculeBuildingBlock()
            {
                molecule
            };

            _project.AddBuildingBlock(molecules);
            var parameter = new Parameter().WithName(_parameterName);
            var root      = new Container().WithName("Root");

            root.Add(parameter);
            var spatialStructure = new MoBiSpatialStructure().WithTopContainer(root);

            _project.AddBuildingBlock(spatialStructure);
            var reactionBuilder = new ReactionBuilder().WithName(_reactionName);
            var reactions       = new MoBiReactionBuildingBlock()
            {
                reactionBuilder
            };

            _project.AddBuildingBlock(reactions);
            var msv = new MoleculeStartValue {
                Path = new ObjectPath("A", _msvName)
            };
            var msv2 = new MoleculeStartValue {
                Path = new ObjectPath("A", _moleculeName)
            };
            var moleculeStartValues = new MoleculeStartValuesBuildingBlock()
            {
                msv, msv2
            };

            _project.AddBuildingBlock(moleculeStartValues);

            A.CallTo(() => _context.CurrentProject).Returns(_project);
        }
Exemple #22
0
        protected override void Context()
        {
            base.Context();
            _startValue1 = new MoleculeStartValue {
                Name = "startValue1"
            };
            _startValue2 = new MoleculeStartValue {
                Name = "startValue2"
            };
            _startValue3 = new MoleculeStartValue {
                Name = "startValue3"
            };
            _moleculeStartValueBuildingBlock.Add(_startValue1);
            _moleculeStartValueBuildingBlock.Add(_startValue2);
            _moleculeStartValueBuildingBlock.Add(_startValue3);

            A.CallTo(() => _mapper.MapFrom(_startValue1, _moleculeStartValueBuildingBlock)).Returns(new MoleculeStartValueDTO(_startValue1, _moleculeStartValueBuildingBlock));
            A.CallTo(() => _mapper.MapFrom(_startValue2, _moleculeStartValueBuildingBlock)).Returns(new MoleculeStartValueDTO(_startValue2, _moleculeStartValueBuildingBlock));
            A.CallTo(() => _mapper.MapFrom(_startValue3, _moleculeStartValueBuildingBlock)).Returns(new MoleculeStartValueDTO(_startValue3, _moleculeStartValueBuildingBlock));

            sut.Edit(_moleculeStartValueBuildingBlock);
        }
Exemple #23
0
        protected override void Context()
        {
            base.Context();

            var msv1 = new MoleculeStartValue().WithName("Tada").WithFormula(new ConstantFormula(2));

            msv1.Path                    = new ObjectPath("Root", "Liver", "Plasma");
            msv1.IsPresent               = true;
            msv1.ScaleDivisor            = 1;
            msv1.ValueOrigin.Description = "DESC1";
            var msv2 = new MoleculeStartValue().WithName("Tada").WithFormula(new ConstantFormula(2));

            msv2.Path                    = new ObjectPath("Root", "Liver", "Plasma");
            msv2.IsPresent               = true;
            msv2.ScaleDivisor            = 10;
            msv2.ValueOrigin.Description = "DESC2";

            _object1 = msv1;
            _object2 = msv2;

            _comparerSettings.ShowValueOrigin = true;
        }
 protected override void Context()
 {
     _builder = new MoleculeStartValue();
     sut      = new MoleculeStartValueToObjectBaseSummaryDTOMapper();
 }
Exemple #25
0
        protected override void Context()
        {
            base.Context();
            _returnedBuildingBlocks = new List <IBuildingBlock>();
            _childReactionBuilder   = new ReactionBuilder().WithName("Test").WithId("FindME");
            _reactionBuildingBlock  = new MoBiReactionBuildingBlock()
            {
                _childReactionBuilder
            };
            _allBuildingBlocks.Add(_reactionBuildingBlock);
            _moleculeBuilder       = new MoleculeBuilder();
            _moleculeBuildingBlock = new MoleculeBuildingBlock()
            {
                _moleculeBuilder
            };
            _allBuildingBlocks.Add(_moleculeBuildingBlock);
            _obseverBuilder        = new ObserverBuilder();
            _observerBuildingBlock = new ObserverBuildingBlock()
            {
                _obseverBuilder
            };
            _allBuildingBlocks.Add(_observerBuildingBlock);
            _passiveTranportBuilder       = new TransportBuilder();
            _passiveTranportBuildingBlock = new PassiveTransportBuildingBlock()
            {
                _passiveTranportBuilder
            };
            _allBuildingBlocks.Add(_passiveTranportBuildingBlock);
            _applicationBuilder      = new ApplicationBuilder();
            _eventGroupBuildingBlock = new EventGroupBuildingBlock()
            {
                _applicationBuilder
            };
            _allBuildingBlocks.Add(_eventGroupBuildingBlock);
            _parameter = new Parameter().WithName("Para");
            var container = new Container().WithName("Cont");

            container.Add(_parameter);
            _objectBaseFactory = A.Fake <IObjectBaseFactory>();
            _parmaeterFactory  = A.Fake <IParameterFactory>();
            A.CallTo(() => _objectBaseFactory.Create <IContainer>()).Returns(A.Fake <IContainer>());
            A.CallTo(() => _objectBaseFactory.Create <IMoBiSpatialStructure>()).Returns(new MoBiSpatialStructure());
            var diagramManagerFactory = A.Fake <IDiagramManagerFactory>();

            _spatialStructure = new MoBiSpatialStructureFactory(_objectBaseFactory, _parmaeterFactory, A.Fake <IconRepository>(), diagramManagerFactory).Create().DowncastTo <IMoBiSpatialStructure>();
            _spatialStructure.AddTopContainer(container);
            _allBuildingBlocks.Add(_spatialStructure);
            _formula = new ExplicitFormula();
            _moleculeBuildingBlock.AddFormula(_formula);
            _parameterStartValue = new ParameterStartValue {
                Path = new ObjectPath {
                    "test"
                }, StartValue = 1, Dimension = A.Fake <IDimension>()
            };
            _parameterStartValueBuildingBlock = new ParameterStartValuesBuildingBlock()
            {
                _parameterStartValue
            };
            _allBuildingBlocks.Add(_parameterStartValueBuildingBlock);
            _moleculeStartValue = new MoleculeStartValue {
                ContainerPath = new ObjectPath {
                    "test"
                }, Name = "drug"
            };
            _moleculeStartValuesBuildingBlock = new MoleculeStartValuesBuildingBlock()
            {
                _moleculeStartValue
            };
            _allBuildingBlocks.Add(_moleculeStartValuesBuildingBlock);
        }