コード例 #1
0
        protected override void Context()
        {
            _valueToSet = 20;
            _oldValue   = 30;
            _unit       = A.Fake <Unit>();
            A.CallTo(() => _unit.Name).Returns("_unit");
            _dimension = A.Fake <IDimension>();
            var container         = new Container();
            var objectPathFactory = new ObjectPathFactoryForSpecs();
            var p1 = DomainHelperForSpecs.ConstantParameterWithValue(10).WithName("P1");

            container.Add(p1);
            _parameter = new PKSimParameter().WithFormula(new ExplicitFormula(_oldValue.ToString()))
                         .WithId("tralala")
                         .WithDimension(_dimension);
            container.Add(_parameter);
            _parameter.Formula.AddObjectPath(objectPathFactory.CreateRelativeFormulaUsablePath(_parameter, p1));

            A.CallTo(() => _dimension.Unit(_unit.Name)).Returns(_unit);
            _parameter.DisplayUnit = _unit;
            _executionContext      = A.Fake <IExecutionContext>();
            A.CallTo(() => _executionContext.Get <IParameter>(_parameter.Id)).Returns(_parameter);
            A.CallTo(() => _executionContext.BuildingBlockContaining(_parameter)).Returns(A.Fake <IPKSimBuildingBlock>());
            sut = new SetParameterValueCommand(_parameter, _valueToSet);
        }
コード例 #2
0
        protected override void Context()
        {
            _dimension = A.Fake <IDimension>();
            _oldValue  = 20;
            _parameter = new PKSimParameter()
                         .WithFormula(new ExplicitFormula(_oldValue.ToString()))
                         .WithId("tralala")
                         .WithDimension(_dimension);

            _newUnit = A.Fake <Unit>();
            A.CallTo(() => _newUnit.Name).Returns("_newUnit");
            _oldUnit = A.Fake <Unit>();
            A.CallTo(() => _oldUnit.Name).Returns("_oldUnit");

            A.CallTo(() => _dimension.Unit(_newUnit.Name)).Returns(_newUnit);
            A.CallTo(() => _dimension.Unit(_oldUnit.Name)).Returns(_oldUnit);

            _parameter.DisplayUnit = _oldUnit;
            _executionContext      = A.Fake <IExecutionContext>();
            A.CallTo(() => _executionContext.Get <IParameter>(_parameter.Id)).Returns(_parameter);
            A.CallTo(() => _executionContext.BuildingBlockContaining(_parameter)).Returns(A.Fake <IPKSimBuildingBlock>());

            _oldValueInGuiUnit = 250;
            _newValue          = 150;
            A.CallTo(() => _dimension.BaseUnitValueToUnitValue(_oldUnit, _parameter.Value)).Returns(_oldValueInGuiUnit);
            A.CallTo(() => _dimension.UnitValueToBaseUnitValue(_newUnit, _oldValueInGuiUnit)).Returns(_newValue);

            A.CallTo(() => _dimension.UnitValueToBaseUnitValue(_oldUnit, _oldValueInGuiUnit)).Returns(_oldValue);
            A.CallTo(() => _dimension.BaseUnitValueToUnitValue(_newUnit, _newValue)).Returns(_oldValueInGuiUnit);
            sut = new SetParameterUnitCommand(_parameter, _newUnit);
        }
コード例 #3
0
 protected override void Context()
 {
     _context             = A.Fake <IExecutionContext>();
     _parameterExpression = DomainHelperForSpecs.ConstantParameterWithValue(2);
     A.CallTo(() => _context.BuildingBlockContaining(_parameterExpression)).Returns(A.Fake <IPKSimBuildingBlock>());
     sut = new SetExpressionProfileValueCommand(_parameterExpression, _value);
 }
コード例 #4
0
        protected override void Context()
        {
            base.Context();
            _executionContext = A.Fake <IExecutionContext>();
            var container         = new Container();
            var objectPathFactory = new ObjectPathFactoryForSpecs();

            _paraWithValueUnchanged1 = DomainHelperForSpecs.ConstantParameterWithValue(1).WithName("para1").WithDimension(A.Fake <IDimension>());
            _paraWithValueUnchanged1.IsFixedValue = false;
            _paraWithValueChanged2         = DomainHelperForSpecs.ConstantParameterWithValue(2).WithName("para2").WithDimension(A.Fake <IDimension>());
            _paraWithValueChanged2.Id      = "tralala";
            _paraWithValueChanged2.Formula = new ExplicitFormula("15");
            _paraWithValueChanged2.Formula.AddObjectPath(objectPathFactory.CreateRelativeFormulaUsablePath(_paraWithValueChanged2, _paraWithValueUnchanged1));
            _paraWithValueChanged2.Value          = 20;
            _paraWithValueUnchanged3              = DomainHelperForSpecs.ConstantParameterWithValue(3).WithName("para3");
            _distributedParameter                 = DomainHelperForSpecs.NormalDistributedParameter().WithName("para4");
            _distributedParameter.Value           = 1.2;
            _distributedParameter.IsFixedValue    = false;
            _paraWithValueUnchanged3.IsFixedValue = false;
            container.Add(_paraWithValueChanged2);
            container.Add(_paraWithValueUnchanged1);
            container.Add(_paraWithValueUnchanged3);
            container.Add(_distributedParameter);
            _parameterToReset.Add(_paraWithValueUnchanged1);
            _parameterToReset.Add(_paraWithValueChanged2);
            _parameterToReset.Add(_paraWithValueUnchanged3);
            _parameterToReset.Add(_distributedParameter);
            A.CallTo(() => _executionContext.BuildingBlockContaining(_paraWithValueChanged2)).Returns(A.Fake <IPKSimBuildingBlock>());
        }
コード例 #5
0
 protected override void PerformExecuteWith(IExecutionContext context)
 {
     _oldMoleculeName             = _partialProcess.MoleculeName;
     _partialProcess.MoleculeName = _newMoleculeName;
     _partialProcess.Name         = CoreConstants.ContainerName.PartialProcessName(_partialProcess.MoleculeName, _partialProcess.DataSource);
     Description = PKSimConstants.Command.RenameEntityCommandDescripiton(PKSimConstants.UI.Molecule, _oldMoleculeName, _newMoleculeName);
     context.PublishEvent(new MoleculeRenamedInCompound(context.BuildingBlockContaining(_partialProcess).DowncastTo <Compound>()));
 }
コード例 #6
0
 public ChangeApplicationTypeCommand(ISchemaItem schemaItem, ApplicationType newApplicationType, IExecutionContext context)
 {
     _schemaItem         = schemaItem;
     _schemaItemId       = _schemaItem.Id;
     _newApplicationType = newApplicationType;
     ObjectType          = PKSimConstants.ObjectTypes.AdministrationProtocol;
     CommandType         = PKSimConstants.Command.CommandTypeEdit;
     BuildingBlockId     = context.BuildingBlockIdContaining(schemaItem);
     context.UpdateBuildinBlockProperties(this, context.BuildingBlockContaining(schemaItem));
 }
コード例 #7
0
 public SetSchemaItemTargetCompartmentCommand(ISchemaItem schemaItem, string newTargetCompartment, IExecutionContext context)
 {
     _schemaItem           = schemaItem;
     _newTargetCompartment = newTargetCompartment;
     _schemaItemId         = _schemaItem.Id;
     ObjectType            = PKSimConstants.ObjectTypes.AdministrationProtocol;
     CommandType           = PKSimConstants.Command.CommandTypeEdit;
     BuildingBlockId       = context.BuildingBlockIdContaining(schemaItem);
     context.UpdateBuildinBlockProperties(this, context.BuildingBlockContaining(schemaItem));
 }
コード例 #8
0
 public SetTissueLocationCommand(IndividualProtein protein, TissueLocation tissueLocation, IExecutionContext context)
 {
     _protein            = protein;
     BuildingBlockId     = context.BuildingBlockIdContaining(protein);
     _newTissuleLocation = tissueLocation;
     ObjectType          = PKSimConstants.ObjectTypes.Protein;
     CommandType         = PKSimConstants.Command.CommandTypeEdit;
     _proteinId          = _protein.Id;
     context.UpdateBuildinBlockProperties(this, context.BuildingBlockContaining(protein));
 }
 public SetProteinIntracellularVascularEndoLocationCommand(IndividualProtein protein, IntracellularVascularEndoLocation newVascularEndoLocation, IExecutionContext context)
 {
     _protein = protein;
     _newVascularEndoLocation = newVascularEndoLocation;
     BuildingBlockId          = context.BuildingBlockIdContaining(protein);
     ObjectType  = PKSimConstants.ObjectTypes.Protein;
     CommandType = PKSimConstants.Command.CommandTypeEdit;
     _proteinId  = _protein.Id;
     context.UpdateBuildinBlockProperties(this, context.BuildingBlockContaining(_protein));
 }
コード例 #10
0
 public SetSchemaItemFormulationKeyCommand(ISchemaItem schemaItem, string newFormulationKey, IExecutionContext context)
 {
     _schemaItem        = schemaItem;
     _newFormulationKey = newFormulationKey;
     _schemaItemId      = _schemaItem.Id;
     ObjectType         = PKSimConstants.ObjectTypes.AdministrationProtocol;
     CommandType        = PKSimConstants.Command.CommandTypeEdit;
     BuildingBlockId    = context.BuildingBlockIdContaining(schemaItem);
     context.UpdateBuildinBlockPropertiesInCommand(this, context.BuildingBlockContaining(schemaItem));
 }
コード例 #11
0
        public RenameMoleculeInPartialProcessesCommand(IEnumerable <PartialProcess> partialProcesses, string moleculeName, IExecutionContext context)
        {
            _partialProcesses = partialProcesses.ToList();
            _moleculeName     = moleculeName;
            ObjectType        = PKSimConstants.ObjectTypes.Parameter;
            CommandType       = PKSimConstants.Command.CommandTypeEdit;
            Description       = PKSimConstants.Command.RenameMoleculeInPartialProcessesCommandDescription(moleculeName);

            context.UpdateBuildinBlockProperties(this, context.BuildingBlockContaining(_partialProcesses.FirstOrDefault()));
        }
コード例 #12
0
 public SetProteinMembraneLocationCommand(PKSim.Core.Model.IndividualProtein protein, MembraneLocation membraneLocation, IExecutionContext context)
 {
     _protein             = protein;
     BuildingBlockId      = context.BuildingBlockIdContaining(protein);
     _newMembraneLocation = membraneLocation;
     ObjectType           = PKSimConstants.ObjectTypes.Protein;
     CommandType          = PKSimConstants.Command.CommandTypeEdit;
     _proteinId           = _protein.Id;
     context.UpdateBuildinBlockPropertiesInCommand(this, context.BuildingBlockContaining(_protein));
 }
コード例 #13
0
 public RenameMoleculeInPartialProcessCommand(PKSim.Core.Model.PartialProcess partialProcess, string newMoleculeName, IExecutionContext context)
 {
     _partialPocessId = partialProcess.Id;
     BuildingBlockId  = context.BuildingBlockIdContaining(partialProcess);
     _newMoleculeName = newMoleculeName;
     _partialProcess  = partialProcess;
     ObjectType       = PKSimConstants.ObjectTypes.PartialProcess;
     CommandType      = PKSimConstants.Command.CommandTypeEdit;
     context.UpdateBuildinBlockPropertiesInCommand(this, context.BuildingBlockContaining(partialProcess));
 }
コード例 #14
0
 public RenameDataSourceCommand(CompoundProcess compoundProcess, string newDataSource, IExecutionContext context)
 {
     _processId       = compoundProcess.Id;
     BuildingBlockId  = context.BuildingBlockIdContaining(compoundProcess);
     _newDataSource   = newDataSource;
     _compoundProcess = compoundProcess;
     ObjectType       = context.TypeFor(compoundProcess);
     CommandType      = PKSimConstants.Command.CommandTypeEdit;
     context.UpdateBuildingBlockPropertiesInCommand(this, context.BuildingBlockContaining(compoundProcess));
 }
コード例 #15
0
 public NormalizeSimulationRelativeExpressionCommand(IParameter parameter, IExecutionContext context)
 {
     _parameter      = parameter;
     ParameterId     = parameter.Id;
     CommandType     = PKSimConstants.Command.CommandTypeEdit;
     ObjectType      = PKSimConstants.ObjectTypes.Protein;
     BuildingBlockId = context.BuildingBlockIdContaining(parameter);
     context.UpdateBuildingBlockPropertiesInCommand(this, context.BuildingBlockContaining(parameter));
     //This command is necessary to insure consitency but does not need to be seen
     Visible = false;
 }
コード例 #16
0
 public ChangeCompoundProcessInternalNameCommand(CompoundProcess compoundProcess, string internalName, IExecutionContext context)
 {
     _compoundProcess = compoundProcess;
     _internalName    = internalName;
     _processId       = compoundProcess.Id;
     _oldInternalName = _compoundProcess.InternalName;
     BuildingBlockId  = context.BuildingBlockIdContaining(_compoundProcess);
     //This command is necessary to insure consitency but does not need to be seen
     context.UpdateBuildinBlockPropertiesInCommand(this, context.BuildingBlockContaining(_compoundProcess));
     Visible = false;
 }
コード例 #17
0
 public SetTransportTypeCommand(IndividualTransporter individualTransporter, TransportType transportType, IExecutionContext context)
 {
     _expressionProfile     = context.BuildingBlockContaining(individualTransporter).DowncastTo <ExpressionProfile>();
     _individualTransporter = individualTransporter;
     _transportType         = transportType;
     BuildingBlockId        = _expressionProfile.Id;
     _transporterId         = _individualTransporter.Id;
     ObjectType             = PKSimConstants.ObjectTypes.Transporter;
     CommandType            = PKSimConstants.Command.CommandTypeEdit;
     context.UpdateBuildingBlockPropertiesInCommand(this, _expressionProfile);
 }
コード例 #18
0
 public SetSpeciesInSpeciesDependentEntityCommand(ISpeciesDependentEntity entity, Species species, IExecutionContext context)
 {
     _entity         = entity;
     _entityId       = entity.Id;
     BuildingBlockId = context.BuildingBlockIdContaining(entity);
     ObjectType      = context.TypeFor(entity);
     CommandType     = PKSimConstants.Command.CommandTypeEdit;
     _oldSpecies     = entity.Species;
     _newSpecies     = species;
     Description     = PKSimConstants.Command.SetSpeciesInSpeciesDependentEntityDescription(context.TypeFor(_entity), entity.Name, _oldSpecies.Name, _newSpecies.Name);
     context.UpdateBuildingBlockPropertiesInCommand(this, context.BuildingBlockContaining(entity));
 }
コード例 #19
0
        public SetTransportTypeInAllContainerCommand(IndividualTransporter individualTransporter, TransportType transportType, IExecutionContext context)
        {
            _individualTransporter = individualTransporter;
            _individual            = context.BuildingBlockContaining(individualTransporter).DowncastTo <Individual>();

            NewTransportType = transportType;
            OldTransportType = _individualTransporter.TransportType;
            ObjectType       = PKSimConstants.ObjectTypes.Transporter;
            CommandType      = PKSimConstants.Command.CommandTypeEdit;
            Description      = PKSimConstants.Command.SetTransportTypeCommandDescription(_individualTransporter.Name, OldTransportType.ToString(), NewTransportType.ToString());
            context.UpdateBuildingBlockPropertiesInCommand(this, _individual);
        }
コード例 #20
0
        public ChangeEnzymaticProcessMetaboliteNameCommand(EnzymaticProcess process, string newMetabolite, IExecutionContext context)
        {
            _process        = process;
            BuildingBlockId = context.BuildingBlockIdContaining(_process);
            _processId      = process.Id;
            _newMetabolite  = newMetabolite;
            CommandType     = PKSimConstants.Command.CommandTypeEdit;
            Description     = PKSimConstants.Command.SetMetaboliteForProcess(_newMetabolite, process.Name, process.MetaboliteName);
            ObjectType      = PKSimConstants.ObjectTypes.MetabolizingEnzyme;

            context.UpdateBuildinBlockProperties(this, context.BuildingBlockContaining(_process));
        }
コード例 #21
0
        public SetTransportTypeInTransporterCommand(IndividualTransporter individualTransporter, TransportType transportType, IExecutionContext context)
        {
            var individual = context.BuildingBlockContaining(individualTransporter).DowncastTo <Individual>();

            _individualTransporter = individualTransporter;
            _transportType         = transportType;
            BuildingBlockId        = individual.Id;
            _transporterId         = _individualTransporter.Id;
            ObjectType             = PKSimConstants.ObjectTypes.Transporter;
            CommandType            = PKSimConstants.Command.CommandTypeEdit;
            context.UpdateBuildinBlockPropertiesInCommand(this, individual);
        }
コード例 #22
0
 public SetTransportDirectionCommand(TransporterExpressionContainer transporterContainer, TransportDirectionId newTransportDirection,
                                     IExecutionContext context)
 {
     _transporterContainer   = transporterContainer;
     _newTransportDirection  = newTransportDirection;
     _transporterContainerId = _transporterContainer.Id;
     _expressionProfile      = context.BuildingBlockContaining(_transporterContainer).DowncastTo <ExpressionProfile>();
     BuildingBlockId         = _expressionProfile.Id;
     _oldTransportDirection  = _transporterContainer.TransportDirection;
     ObjectType  = PKSimConstants.ObjectTypes.Transporter;
     CommandType = PKSimConstants.Command.CommandTypeEdit;
     context.UpdateBuildingBlockPropertiesInCommand(this, _expressionProfile);
 }
コード例 #23
0
 public SetExpressionLocalizationCommand(
     IndividualProtein protein,
     Localization localization,
     ISimulationSubject simulationSubject,
     IExecutionContext context)
 {
     _protein           = protein;
     _simulationSubject = simulationSubject;
     _localization      = localization;
     ObjectType         = PKSimConstants.ObjectTypes.Protein;
     CommandType        = PKSimConstants.Command.CommandTypeEdit;
     context.UpdateBuildingBlockPropertiesInCommand(this, context.BuildingBlockContaining(protein));
 }
コード例 #24
0
 public SetMembraneTypeCommand(TransporterExpressionContainer transporterContainer, TransportType transportType, MembraneLocation newMembraneLocation, IExecutionContext context)
 {
     _transporterContainer   = transporterContainer;
     _transportType          = transportType;
     _transporterContainerId = _transporterContainer.Id;
     _newMembraneLocation    = newMembraneLocation;
     _individual             = context.BuildingBlockContaining(_transporterContainer).DowncastTo <Individual>();
     BuildingBlockId         = _individual.Id;
     _oldMembraneLocation    = _transporterContainer.MembraneLocation;
     ObjectType  = PKSimConstants.ObjectTypes.Transporter;
     CommandType = PKSimConstants.Command.CommandTypeEdit;
     context.UpdateBuildinBlockPropertiesInCommand(this, _individual);
 }
コード例 #25
0
        protected override void Context()
        {
            _parameter        = DomainHelperForSpecs.NormalDistributedParameter();
            _oldPercentile    = _parameter.Percentile;
            _parameter.Id     = "tralala";
            _executionContext = A.Fake <IExecutionContext>();
            A.CallTo(() => _executionContext.Get <IParameter>(_parameter.Id)).Returns(_parameter);
            A.CallTo(() => _executionContext.BuildingBlockContaining(_parameter)).Returns(A.Fake <IPKSimBuildingBlock>());
            _percentile             = 0.4;
            _parameter.IsFixedValue = true;

            sut = new SetParameterPercentileCommand(_parameter, _percentile);
        }
 public SetDefaultAlternativeParameterCommand(ParameterAlternativeGroup parameterGroup, ParameterAlternative parameterAlternative, IExecutionContext context)
 {
     _parameterGroup          = parameterGroup;
     _parameterGroupId        = _parameterGroup.Id;
     _parameterAlternative    = parameterAlternative;
     _oldDefaultAlternative   = parameterGroup.DefaultAlternative;
     _oldDefaultAlternativeId = _oldDefaultAlternative.Id;
     ObjectType          = PKSimConstants.ObjectTypes.Compound;
     CommandType         = PKSimConstants.Command.CommandTypeEdit;
     BuildingBlockId     = context.BuildingBlockIdContaining(parameterGroup);
     Description         = PKSimConstants.Command.SetDefaultAlternativeParameterDescription(context.DisplayNameFor(parameterGroup), _oldDefaultAlternative.Name, parameterAlternative.Name);
     ShouldChangeVersion = false;
     context.UpdateBuildingBlockPropertiesInCommand(this, context.BuildingBlockContaining(parameterGroup));
 }
コード例 #27
0
 protected override void Context()
 {
     _formulaTypeMapper  = A.Fake <IParameterToFomulaTypeMapper>();
     _executionContext   = A.Fake <IExecutionContext>();
     _entityPathResolver = A.Fake <IEntityPathResolver>();
     _favoriteTask       = A.Fake <IFavoriteTask>();
     _parameterTask      = new ParameterTask(_entityPathResolver, _executionContext, _favoriteTask);
     sut = new ParameterUpdater(_formulaTypeMapper, _parameterTask);
     _sourceParameter = DomainHelperForSpecs.ConstantParameterWithValue(0);
     _sourceParameter.BuildingBlockType = PKSimBuildingBlockType.Individual;
     _targetParameter = DomainHelperForSpecs.ConstantParameterWithValue(1);
     _targetParameter.BuildingBlockType = PKSimBuildingBlockType.Individual;
     A.CallTo(() => _executionContext.BuildingBlockContaining(_targetParameter)).Returns(A.Fake <IPKSimBuildingBlock>());
 }
コード例 #28
0
 public SetTransportTypeCommand(TransporterExpressionContainer transporterContainer, TransportType oldTransportType, TransportType newTransportType, MembraneLocation membraneLocationToUse, IExecutionContext context)
 {
     _transporterContainer   = transporterContainer;
     _membraneLocationToUse  = membraneLocationToUse;
     _transporterContainerId = _transporterContainer.Id;
     _individual             = context.BuildingBlockContaining(transporterContainer).DowncastTo <Individual>();
     BuildingBlockId         = _individual.Id;
     _newTransportType       = newTransportType;
     _oldTransportType       = oldTransportType;
     ObjectType  = PKSimConstants.ObjectTypes.Transporter;
     CommandType = PKSimConstants.Command.CommandTypeEdit;
     context.UpdateBuildinBlockPropertiesInCommand(this, _individual);
     Visible = false;
 }
コード例 #29
0
        protected override void Context()
        {
            _executionContext = A.Fake <IExecutionContext>();
            _favoriteTask     = A.Fake <IFavoriteTask>();
            _project          = A.Fake <IProject>();
            sut = new ParameterTask(new EntityPathResolver(new ObjectPathFactoryForSpecs()), _executionContext, _favoriteTask);
            var dimensionFactory = new DimensionFactory();

            _volumeDimension = dimensionFactory.AddDimension(new BaseDimensionRepresentation {
                LengthExponent = 3
            }, "Volume", "L");
            _volumeDimension.AddUnit("mL", 1e-3, 0);
            _parameter           = DomainHelperForSpecs.ConstantParameterWithValue(10);
            _parameter.Dimension = _volumeDimension;
            A.CallTo(() => _executionContext.BuildingBlockContaining(_parameter)).Returns(A.Fake <IPKSimBuildingBlock>());
        }
コード例 #30
0
        public EditObjectBaseDescriptionCommand(IObjectBase objectBase, string newDescription, IExecutionContext context)
        {
            _objectBase     = objectBase;
            _newDescription = newDescription;
            _objectBaseId   = objectBase.Id;
            var entity = objectBase as IEntity;

            if (entity != null)
            {
                _buildingBlockId = context.BuildingBlockIdContaining(entity);
                context.UpdateBuildingBlockPropertiesInCommand(this, context.BuildingBlockContaining(entity));
            }

            ObjectType  = context.TypeFor(objectBase);
            CommandType = PKSimConstants.Command.CommandTypeEdit;
            Description = PKSimConstants.Command.EditEntityDescriptionCommandDescripiton(ObjectType, objectBase.Name);
        }