Exemplo n.º 1
0
 protected override void Context()
 {
     _settings   = new ComparerSettings();
     _parameter1 = DomainHelperForSpecs.ConstantParameterWithValue(visible: true);
     _parameter2 = DomainHelperForSpecs.ConstantParameterWithValue(visible: true);
     _comparison = new Comparison <IParameter>(_parameter1, _parameter2, _settings, new DiffReport(), null);
 }
Exemplo n.º 2
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);
 }
        protected override void Context()
        {
            base.Context();
            _pkValues = new PKValues();
            _pkValues.AddValue("P1", 10f);
            _pkValues.AddValue("P2", 10f);
            _mode     = PKParameterMode.Single;
            _drugName = "TOTO";
            _pk1      = new PKParameter {
                Mode = _mode, Name = "P1", Dimension = DomainHelperForSpecs.ConcentrationDimensionForSpecs()
            };
            _pk2 = new PKParameter {
                Mode = _mode, Name = "P2", Dimension = DomainHelperForSpecs.ConcentrationDimensionForSpecs()
            };
            _pk3 = new PKParameter {
                Mode = PKParameterMode.Multi, Name = "P3"
            };
            var baseGrid = new BaseGrid("Time", DomainHelperForSpecs.TimeDimensionForSpecs());

            _col = new DataColumn("COL", DomainHelperForSpecs.ConcentrationDimensionForSpecs(), baseGrid)
            {
                DataInfo = { MolWeight = 150 }
            };
            A.CallTo(() => _pkParameterRepository.All()).Returns(new [] { _pk1, _pk2, _pk3 });
            A.CallTo(() => _parameterFactory.CreateFor(A <string> ._, A <double> ._, A <string> ._, PKSimBuildingBlockType.Simulation))
            .ReturnsLazily(x => DomainHelperForSpecs.ConstantParameterWithValue(x.GetArgument <double>(1)).WithName(x.GetArgument <string>(0)));
        }
Exemplo n.º 4
0
        protected override void Context()
        {
            base.Context();

            //Simulate calculated results by setting the DataRepository
            _aucIVSimulation = new IndividualSimulation {
                DataRepository = _simulation.DataRepository
            };

            _pkAnalysis = new PKAnalysis();
            _pkAnalysis.Add(DomainHelperForSpecs.ConstantParameterWithValue(2).WithName(Constants.PKParameters.AUC_inf));

            A.CallTo(() => _globalPKAnalysisRunner.RunForBioavailability(_protocol, _simulation, _compound)).Returns(_aucIVSimulation);
            A.CallTo(() => _pkAnalysisTask.CalculateFor(_aucIVSimulation, _venousBloodPlasma)).Returns(new IndividualPKAnalysis(_venousBloodPlasma, _pkAnalysis));

            A.CallTo(() => _protocolFactory.Create(ProtocolMode.Simple, ApplicationTypes.Intravenous)).Returns(_protocol);
            _protocol.AddParameter(DomainHelperForSpecs.ConstantParameterWithValue(1).WithName(Constants.Parameters.INFUSION_TIME));
            _protocol.AddParameter(DomainHelperForSpecs.ConstantParameterWithValue(1).WithName(CoreConstants.Parameters.INPUT_DOSE));
            _protocol.AddParameter(DomainHelperForSpecs.ConstantParameterWithValue(1).WithName(Constants.Parameters.START_TIME));

            //single dosing
            var schemaItem = A.Fake <SchemaItem>();
            var inputDose  = DomainHelperForSpecs.ConstantParameterWithValue(10);
            var startTime  = DomainHelperForSpecs.ConstantParameterWithValue(3);

            A.CallTo(() => schemaItem.Dose).Returns(inputDose);
            A.CallTo(() => schemaItem.StartTime).Returns(startTime);
            _simulationSchemaItems.Add(schemaItem);
        }
Exemplo n.º 5
0
        protected override void Context()
        {
            _cloneManager = new DummyCloneManager();
            sut           = new Schema();
            //2 hours delay
            sut.Add(DomainHelperForSpecs.ConstantParameterWithValue(120).WithName(Constants.Parameters.START_TIME));
            //6hours between repetitions
            sut.Add(DomainHelperForSpecs.ConstantParameterWithValue(360).WithName(CoreConstants.Parameter.TIME_BETWEEN_REPETITIONS));
            //repeat the schema 4 times
            sut.Add(DomainHelperForSpecs.ConstantParameterWithValue(4).WithName(CoreConstants.Parameter.NUMBER_OF_REPETITIONS));


            var schemaItem1 = new SchemaItem().WithName("SchemaItem1");

            schemaItem1.Add(DomainHelperForSpecs.ConstantParameterWithValue(0).WithName(Constants.Parameters.START_TIME));
            schemaItem1.Add(DomainHelperForSpecs.ConstantParameterWithValue(1).WithName(CoreConstants.Parameter.INPUT_DOSE));
            schemaItem1.ApplicationType = ApplicationTypes.Intravenous;

            var schemaItem2 = new SchemaItem().WithName("SchemaItem2");

            schemaItem2.Add(DomainHelperForSpecs.ConstantParameterWithValue(180).WithName(Constants.Parameters.START_TIME));
            schemaItem2.Add(DomainHelperForSpecs.ConstantParameterWithValue(2).WithName(CoreConstants.Parameter.INPUT_DOSE));
            schemaItem2.ApplicationType = ApplicationTypes.Intravenous;


            sut.AddSchemaItem(schemaItem1);
            sut.AddSchemaItem(schemaItem2);
        }
        protected override void Context()
        {
            _relExp1 = DomainHelperForSpecs.ConstantParameterWithValue(10);
            _relExp1.Info.GroupName    = CoreConstants.Groups.RELATIVE_EXPRESSION;
            _relExp1.BuildingBlockType = PKSimBuildingBlockType.Individual;
            _relExp1.Name = CoreConstants.Parameter.RelExp + "1";

            _relExp2 = DomainHelperForSpecs.ConstantParameterWithValue(20);
            _relExp2.Info.GroupName    = CoreConstants.Groups.RELATIVE_EXPRESSION;
            _relExp2.BuildingBlockType = PKSimBuildingBlockType.Individual;
            _relExp2.Name = CoreConstants.Parameter.RelExp + "2";

            _context = A.Fake <IExecutionContext>();
            var container = new Container();

            container.Add(_relExp1);
            container.Add(_relExp2);

            _normParameters = new Cache <IParameter, IParameter>();
            _relExpNorm1    = DomainHelperForSpecs.ConstantParameterWithValue(0.5);
            _normParameters.Add(_relExp1, _relExpNorm1);
            _relExpNorm2 = DomainHelperForSpecs.ConstantParameterWithValue(1);
            _normParameters.Add(_relExp2, _relExpNorm2);

            _parameterTask = A.Fake <IParameterTask>();
            A.CallTo(() => _parameterTask.GroupExpressionParameters(A <IEnumerable <IParameter> > .Ignored)).Returns(_normParameters);
            A.CallTo(() => _context.Resolve <IParameterTask>()).Returns(_parameterTask);
            sut = new NormalizeSimulationRelativeExpressionCommand(_relExp1, _context);
        }
Exemplo n.º 7
0
        protected override void Context()
        {
            _createIndvidualAlgorithm             = A.Fake <ICreateIndividualAlgorithm>();
            _entityBaseFactory                    = A.Fake <IObjectBaseFactory>();
            _individualModelTask                  = A.Fake <IIndividualModelTask>();
            _speciesRepository                    = A.Fake <ISpeciesRepository>();
            _entityValidator                      = A.Fake <IEntityValidator>();
            _reportGenerator                      = A.Fake <IReportGenerator>();
            _genderRepository                     = A.Fake <IGenderRepository>();
            _moleculeOntogenyVariabilityUpdater   = A.Fake <IMoleculeOntogenyVariabilityUpdater>();
            _diseaseStateImplementationRepository = A.Fake <IDiseaseStateImplementationFactory>();

            sut = new IndividualFactory(
                _individualModelTask,
                _entityBaseFactory,
                _createIndvidualAlgorithm,
                _speciesRepository,
                _entityValidator,
                _reportGenerator,
                _moleculeOntogenyVariabilityUpdater,
                _genderRepository,
                _diseaseStateImplementationRepository
                );

            _age            = DomainHelperForSpecs.ConstantParameterWithValue().WithName(CoreConstants.Parameters.AGE);
            _gestationalAge = DomainHelperForSpecs.ConstantParameterWithValue().WithName(Constants.Parameters.GESTATIONAL_AGE);
            _height         = DomainHelperForSpecs.ConstantParameterWithValue().WithName(CoreConstants.Parameters.HEIGHT);
            _weight         = DomainHelperForSpecs.ConstantParameterWithValue().WithName(CoreConstants.Parameters.WEIGHT);
            _bmi            = DomainHelperForSpecs.ConstantParameterWithValue().WithName(CoreConstants.Parameters.BMI);
        }
Exemplo n.º 8
0
        protected override Task Context()
        {
            _parameterMapper  = A.Fake <ParameterMapper>();
            _schemaItemMapper = A.Fake <SchemaItemMapper>();
            _schemaFactory    = A.Fake <ISchemaFactory>();

            sut = new SchemaMapper(_parameterMapper, _schemaItemMapper, _schemaFactory);

            _schemaItem = new SchemaItem().WithName("Item1");
            _schema     = new Schema
            {
                Description = "Hello",
                Name        = "Tralala"
            };
            _schema.AddSchemaItem(_schemaItem);

            _parameter = DomainHelperForSpecs.ConstantParameterWithValue(3).WithName("Param1");
            _schema.Add(_parameter);

            A.CallTo(() => _parameterMapper.MapToSnapshot(_parameter)).Returns(new Snapshots.Parameter().WithName(_parameter.Name));

            A.CallTo(() => _schemaItemMapper.MapToSnapshot(_schemaItem)).Returns(new Snapshots.SchemaItem().WithName(_schemaItem.Name));

            return(Task.FromResult(true));
        }
Exemplo n.º 9
0
        protected override Task Context()
        {
            _solverSettingsFactory = A.Fake <ISolverSettingsFactory>();

            _solverSettings = new SolverSettings
            {
                DomainHelperForSpecs.ConstantParameterWithValue(1).WithName(Constants.Parameters.USE_JACOBIAN),
                DomainHelperForSpecs.ConstantParameterWithValue(1.5).WithName(Constants.Parameters.H0),
                DomainHelperForSpecs.ConstantParameterWithValue(0.5).WithName(Constants.Parameters.H_MIN),
                DomainHelperForSpecs.ConstantParameterWithValue(2.5).WithName(Constants.Parameters.H_MAX),
                DomainHelperForSpecs.ConstantParameterWithValue(100).WithName(Constants.Parameters.MX_STEP),
                DomainHelperForSpecs.ConstantParameterWithValue(1e-5).WithName(Constants.Parameters.REL_TOL),
                DomainHelperForSpecs.ConstantParameterWithValue(1e-7).WithName(Constants.Parameters.ABS_TOL)
            };

            var solverSettings = A.Fake <SolverSettings>();

            solverSettings.AbsTol      = 1;
            solverSettings.RelTol      = 2;
            solverSettings.MxStep      = 3;
            solverSettings.HMin        = 4;
            solverSettings.H0          = 5;
            solverSettings.HMax        = 6;
            solverSettings.UseJacobian = false;
            A.CallTo(() => _solverSettingsFactory.CreateDefault()).Returns(solverSettings);

            sut = new SolverSettingsMapper(_solverSettingsFactory);
            return(_completed);
        }
        protected override void Context()
        {
            base.Context();
            _eventGroupBuilder1        = new EventGroupBuilder().WithName("EG1");
            _eventGroupBuilder2        = new EventGroupBuilder().WithName("EG2");
            _eventBuildingBlockCreator = new EventGroupBuildingBlock {
                _eventGroupBuilder1, _eventGroupBuilder2
            };

            _startTime1        = DomainHelperForSpecs.ConstantParameterWithValue().WithName(Constants.Parameters.START_TIME);
            _startTime2        = DomainHelperForSpecs.ConstantParameterWithValue().WithName(Constants.Parameters.START_TIME);
            _dose              = DomainHelperForSpecs.ConstantParameterWithValue().WithName(CoreConstants.Parameters.DOSE);
            _dosePerBodyWeight = DomainHelperForSpecs.ConstantParameterWithValue().WithName(CoreConstants.Parameters.DOSE_PER_BODY_WEIGHT);

            _p1 = DomainHelperForSpecs.ConstantParameterWithValue().WithName("P1");
            _p2 = DomainHelperForSpecs.ConstantParameterWithValue().WithName("P2");

            _eventBuilder1 = new EventBuilder().WithName("E1");
            _eventBuilder2 = new EventBuilder().WithName("E2");

            _eventGroupBuilder1.Add(_eventBuilder1);
            _eventGroupBuilder2.Add(_eventBuilder2);

            _eventBuilder1.Add(_startTime1);
            _eventBuilder1.Add(_p1);
            _eventBuilder2.Add(_startTime2);
            _eventBuilder1.Add(_dosePerBodyWeight);
            _eventBuilder2.Add(_dose);
            _eventBuilder2.Add(_p2);
        }
        protected override void Context()
        {
            base.Context();
            _organism            = new Organism();
            _anotherTopContainer = new Container().WithName("Another container");
            _spatialStructure    = new PKSimSpatialStructure();
            _spatialStructure.AddTopContainer(_organism);
            _spatialStructure.AddTopContainer(_anotherTopContainer);

            _ga     = DomainHelperForSpecs.ConstantParameterWithValue().WithName(Constants.Parameters.GESTATIONAL_AGE);
            _age    = DomainHelperForSpecs.ConstantParameterWithValue().WithName(CoreConstants.Parameters.AGE);
            _height = DomainHelperForSpecs.ConstantParameterWithValue().WithName(CoreConstants.Parameters.HEIGHT);

            _distributedParameter = DomainHelperForSpecs.NormalDistributedParameter(isDefault: false, distributionParameterIsDefault: false).WithName("Distributed");
            _p1 = DomainHelperForSpecs.ConstantParameterWithValue().WithName("P1");
            _p2 = DomainHelperForSpecs.ConstantParameterWithValue().WithName("P2");
            _organism.Add(_ga);
            _organism.Add(_age);
            _organism.Add(_height);
            _organism.Add(_p1);
            _anotherTopContainer.Add(_p2);
            _organism.Add(_distributedParameter);
            _mean      = _distributedParameter.Parameter(Constants.Distribution.MEAN);
            _deviation = _distributedParameter.Parameter(Constants.Distribution.DEVIATION);
        }
Exemplo n.º 12
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>());
        }
        protected override Task Context()
        {
            _parameterMapper       = A.Fake <ParameterMapper>();
            _formulationRepository = A.Fake <IFormulationRepository>();
            _cloner = A.Fake <ICloner>();

            sut = new FormulationMapper(_parameterMapper, _formulationRepository, _cloner);

            _parameter1 = DomainHelperForSpecs.ConstantParameterWithValue(5, isDefault: false)
                          .WithName("Param1");

            _parameter2 = DomainHelperForSpecs.ConstantParameterWithValue(5, isDefault: true)
                          .WithName("Param2");

            _hiddenParameter = DomainHelperForSpecs.ConstantParameterWithValue(5, isDefault: false)
                               .WithName("Param3");
            _hiddenParameter.Visible = false;

            _formulation = new Formulation
            {
                Name            = "Form",
                FormulationType = "Weibul",
                Description     = "Amazing formulation"
            };

            _formulation.Add(_parameter1);
            _formulation.Add(_parameter2);
            _formulation.Add(_hiddenParameter);

            A.CallTo(() => _parameterMapper.MapToSnapshot(_parameter1)).Returns(new Parameter().WithName(_parameter1.Name));
            A.CallTo(() => _parameterMapper.MapToSnapshot(_parameter2)).Returns(new Parameter().WithName(_parameter2.Name));
            A.CallTo(() => _parameterMapper.MapToSnapshot(_hiddenParameter)).Returns(new Parameter().WithName(_hiddenParameter.Name));

            return(Task.FromResult(true));
        }
        protected override void Context()
        {
            base.Context();
            _normalDistribution1 = new ParameterDistributionMetaData {
                Age = 20, Mean = 5, Deviation = 10
            };
            _normalDistribution2 = new ParameterDistributionMetaData {
                Age = 10, Mean = 15, Deviation = 30
            };
            _normalDistributions = new List <ParameterDistributionMetaData> {
                _normalDistribution1, _normalDistribution2
            };
            _parameter = A.Fake <IDistributedParameter>();

            IParameter meanParameter      = DomainHelperForSpecs.ConstantParameterWithValue(1).WithName("Mean");
            IParameter deviationParameter = DomainHelperForSpecs.ConstantParameterWithValue(2).WithName("Deviation");

            A.CallTo(() => _parameter.MeanParameter).Returns(meanParameter);
            A.CallTo(() => _parameter.DeviationParameter).Returns(deviationParameter);
            A.CallTo(() => _distrFormulaFactory.CreateNormalDistributionFormulaFor(_parameter, meanParameter, deviationParameter)).Returns(new NormalDistributionFormula());

            _originData = new OriginData {
                Age = 12
            };
        }
        protected override void Context()
        {
            _parameter    = DomainHelperForSpecs.ConstantParameterWithValue(10);
            _parameter.Id = "ParameterId";
            _parameter.Origin.ParameterId    = "BuildingBlockInSimulationParameter";
            _parameter.Origin.BuilingBlockId = "BuildingBlockId";
            _parameter.Origin.SimulationId   = "SimulationId";
            _parameter.BuildingBlockType     = PKSimBuildingBlockType.Formulation;

            _valueOrigin = new ValueOrigin
            {
                Description = "Hello",
                Method      = ValueOriginDeterminationMethods.InVitro,
                Source      = ValueOriginSources.Other
            };

            _previousValueOrigin = new ValueOrigin
            {
                Description = "OldValueOrigin",
                Method      = ValueOriginDeterminationMethods.InVivo,
                Source      = ValueOriginSources.ParameterIdentification
            };

            _parameter.ValueOrigin.UpdateFrom(_previousValueOrigin);

            sut = new UpdateParameterValueOriginCommand(_parameter, _valueOrigin);

            _buildingBlockParameter    = DomainHelperForSpecs.ConstantParameterWithValue(20);
            _buildingBlockParameter.Id = _parameter.Origin.ParameterId;

            _context = A.Fake <IExecutionContext>();
            A.CallTo(() => _context.Get <IParameter>(_parameter.Id)).Returns(_parameter);
            A.CallTo(() => _context.Get <IParameter>(_buildingBlockParameter.Id)).Returns(_buildingBlockParameter);
        }
        protected override Task Context()
        {
            _parameterMapper     = A.Fake <ParameterMapper>();
            _eventMappingFactory = A.Fake <IEventMappingFactory>();
            sut = new EventMappingMapper(_parameterMapper, _eventMappingFactory);

            _event = new PKSimEvent()
                     .WithName("E1")
                     .WithId("EventId");

            _eventMapping = new EventMapping
            {
                TemplateEventId = _event.Id,
                StartTime       = DomainHelperForSpecs.ConstantParameterWithValue(1)
            };

            _snapshotEventStartTime1 = new Parameter {
                Name = "P1"
            };

            _project = new PKSimProject();
            _project.AddBuildingBlock(_event);
            A.CallTo(() => _parameterMapper.MapToSnapshot(_eventMapping.StartTime)).Returns(_snapshotEventStartTime1);

            return(_completed);
        }
Exemplo n.º 17
0
        protected override void Context()
        {
            _parameterMapper = A.Fake <ParameterMapper>();
            _eventFactory    = A.Fake <IEventFactory>();

            sut = new EventMapper(_parameterMapper, _eventFactory);

            _parameter1 = DomainHelperForSpecs.ConstantParameterWithValue(5, isDefault: false)
                          .WithName("Param1");

            _parameter2 = DomainHelperForSpecs.ConstantParameterWithValue(5, isDefault: true)
                          .WithName("Param2");

            _hiddenParameter = DomainHelperForSpecs.ConstantParameterWithValue(5, isDefault: false)
                               .WithName("Param3");
            _hiddenParameter.Visible = false;

            _event = new PKSimEvent
            {
                Name         = "Event",
                TemplateName = "TemplateEventName",
                Description  = "Amazing event"
            };

            _event.Add(_parameter1);
            _event.Add(_parameter2);
            _event.Add(_hiddenParameter);

            A.CallTo(() => _parameterMapper.MapToSnapshot(_parameter1)).Returns(new Parameter().WithName(_parameter1.Name));
            A.CallTo(() => _parameterMapper.MapToSnapshot(_parameter2)).Returns(new Parameter().WithName(_parameter2.Name));
            A.CallTo(() => _parameterMapper.MapToSnapshot(_hiddenParameter)).Returns(new Parameter().WithName(_hiddenParameter.Name));
        }
        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);
        }
Exemplo n.º 19
0
        protected override Task Context()
        {
            _parameterMapper  = A.Fake <ParameterMapper>();
            _schemaItemMapper = A.Fake <SchemaItemMapper>();
            _schemaFactory    = A.Fake <ISchemaFactory>();

            sut = new SchemaMapper(_parameterMapper, _schemaItemMapper, _schemaFactory);

            _schemaItem = new SchemaItem().WithName("Item1");
            _schema     = new Schema
            {
                Description = "Hello",
                Name        = "Tralala"
            };
            _schema.AddSchemaItem(_schemaItem);

            _parameter = DomainHelperForSpecs.ConstantParameterWithValue(3).WithName("Param1");
            //Schema item parameters that have a value IsDefault true should still be saved to snapshot
            _parameter1 = DomainHelperForSpecs.ConstantParameterWithValue(1, isDefault: true).WithName(Constants.Parameters.START_TIME);
            _parameter2 = DomainHelperForSpecs.ConstantParameterWithValue(2, isDefault: true).WithName(CoreConstants.Parameters.NUMBER_OF_REPETITIONS);
            _parameter3 = DomainHelperForSpecs.ConstantParameterWithValue(3, isDefault: true).WithName(CoreConstants.Parameters.TIME_BETWEEN_REPETITIONS);
            _schema.Add(_parameter);
            _schema.Add(_parameter1);
            _schema.Add(_parameter2);
            _schema.Add(_parameter3);

            A.CallTo(() => _parameterMapper.MapToSnapshot(_parameter)).Returns(new Snapshots.Parameter().WithName(_parameter.Name));
            A.CallTo(() => _parameterMapper.MapToSnapshot(_parameter1)).Returns(new Snapshots.Parameter().WithName(_parameter1.Name));
            A.CallTo(() => _parameterMapper.MapToSnapshot(_parameter2)).Returns(new Snapshots.Parameter().WithName(_parameter2.Name));
            A.CallTo(() => _parameterMapper.MapToSnapshot(_parameter3)).Returns(new Snapshots.Parameter().WithName(_parameter3.Name));

            A.CallTo(() => _schemaItemMapper.MapToSnapshot(_schemaItem)).Returns(new Snapshots.SchemaItem().WithName(_schemaItem.Name));

            return(Task.FromResult(true));
        }
Exemplo n.º 20
0
        protected override Task Context()
        {
            _parameterMapper       = A.Fake <ParameterMapper>();
            _outputIntervalFactory = A.Fake <IOutputIntervalFactory>();
            sut = new OutputIntervalMapper(_parameterMapper, _outputIntervalFactory);

            _outputInterval = new OutputInterval
            {
                Name = "Interval"
            };
            _endTimeParameter    = DomainHelperForSpecs.ConstantParameterWithValue(1, isDefault: true).WithName(Constants.Parameters.END_TIME);
            _resolutionParameter = DomainHelperForSpecs.ConstantParameterWithValue(1, isDefault: true).WithName(Constants.Parameters.RESOLUTION);
            _anotherParameter    = DomainHelperForSpecs.ConstantParameterWithValue(1, isDefault: false).WithName("Another");
            _outputInterval.Add(_endTimeParameter);
            _outputInterval.Add(_anotherParameter);
            _outputInterval.Add(_resolutionParameter);

            _endTimeSnapshotParameter    = new Parameter().WithName(_endTimeParameter.Name);
            _anotherSnapshotParameter    = new Parameter().WithName(_anotherParameter.Name);
            _resolutionSnapshotParameter = new Parameter().WithName(_resolutionParameter.Name);
            A.CallTo(() => _parameterMapper.MapToSnapshot(_endTimeParameter)).Returns(_endTimeSnapshotParameter);
            A.CallTo(() => _parameterMapper.MapToSnapshot(_anotherParameter)).Returns(_anotherSnapshotParameter);
            A.CallTo(() => _parameterMapper.MapToSnapshot(_resolutionParameter)).Returns(_resolutionSnapshotParameter);

            return(_completed);
        }
        protected override async Task Context()
        {
            await base.Context();

            _snapshot = await sut.MapToSnapshot(_enzymaticProcess);

            _templateProcess = new EnzymaticProcess();
            _templateProcess.InternalName = _snapshot.InternalName;
            A.CallTo(() => _compoundProcessRepository.ProcessByName(_snapshot.InternalName)).Returns(_templateProcess);
            _cloneOfTemplate = new EnzymaticProcess();
            _cloneOfTemplate.InternalName = _snapshot.InternalName;
            A.CallTo(() => _cloner.Clone((Model.CompoundProcess)_templateProcess)).Returns(_cloneOfTemplate);


            _snapshot.Description        = null;
            _cloneOfTemplate.Description = "Description of template from database";
            _snapshot.Molecule           = "CYP3A4";
            _snapshot.Metabolite         = "Meta";
            _snapshot.DataSource         = "Lab";

            _snapshotParameter   = new Parameter().WithName("Km");
            _snapshot.Parameters = new [] { _snapshotParameter };

            _processParameter = DomainHelperForSpecs.ConstantParameterWithValue(5).WithName("Km");
            _cloneOfTemplate.Add(_processParameter);
        }
Exemplo n.º 22
0
        protected override void Context()
        {
            base.Context();
            _targetParam1       = A.Fake <IParameter>().WithName("P1");
            _targetParam2       = A.Fake <IParameter>().WithName("P2");
            _targetParam3       = A.Fake <IParameter>().WithName("P3");
            _targetRefConcParam = DomainHelperForSpecs.ConstantParameterWithValue(5).WithName(CoreConstants.Parameters.REFERENCE_CONCENTRATION);
            _originRefConcParam = DomainHelperForSpecs.ConstantParameterWithValue(5).WithName(CoreConstants.Parameters.REFERENCE_CONCENTRATION);
            _originRelExpParam  = A.Fake <IParameter>().WithName(CoreConstants.Parameters.REL_EXP);

            _originParam1            = A.Fake <IParameter>().WithName(_targetParam1.Name);
            _originParam2            = A.Fake <IParameter>().WithName(_targetParam2.Name);
            _notMatchingOriginParam1 = A.Fake <IParameter>().WithName("not match1");
            _notMatchingOriginParam2 = A.Fake <IParameter>().WithName("not match2");

            var pathParam1 = "pathParam1";
            var pathParam2 = "pathParam2";
            var pathParam3 = "pathParam3";
            var pathParam4 = "pathParam4";

            A.CallTo(() => _entityPathResolver.PathFor(_targetParam1)).Returns(pathParam1);
            A.CallTo(() => _entityPathResolver.PathFor(_originParam1)).Returns(pathParam1);
            A.CallTo(() => _entityPathResolver.PathFor(_targetParam2)).Returns(pathParam2);
            A.CallTo(() => _entityPathResolver.PathFor(_originParam2)).Returns(pathParam2);
            A.CallTo(() => _entityPathResolver.PathFor(_targetParam3)).Returns(pathParam3);
            A.CallTo(() => _entityPathResolver.PathFor(_originRefConcParam)).Returns(pathParam4);
            A.CallTo(() => _entityPathResolver.PathFor(_targetRefConcParam)).Returns(pathParam4);
            A.CallTo(() => _entityPathResolver.PathFor(_notMatchingOriginParam1)).Returns("_notMatchingParam1");
            A.CallTo(() => _entityPathResolver.PathFor(_notMatchingOriginParam2)).Returns("_notMatchingParam2");

            _targetParam1.Value        = 5;
            _targetParam1.DefaultValue = 7;
            _originParam1.Value        = 6;

            _originRefConcParam.DefaultValue = 8;

            _originParam1.IsFixedValue = true;
            _originParam1.Visible      = true;
            _originParam1.Editable     = true;

            _targetParam2.Visible        = false;
            _targetParam3.Visible        = true;
            _targetRefConcParam.Visible  = true;
            _targetRefConcParam.Editable = true;
            _originRefConcParam.Visible  = true;
            _originRefConcParam.Editable = true;

            _targetIndividual.Add(_targetParam1);
            _targetIndividual.Add(_targetParam2);
            _targetIndividual.Add(_targetParam3);
            _targetIndividual.Add(_targetRefConcParam);

            _originIndividual.Add(_originParam1);
            _originIndividual.Add(_originParam2);
            _originIndividual.Add(_notMatchingOriginParam1);
            _originIndividual.Add(_notMatchingOriginParam2);
            _originIndividual.Add(_originRelExpParam);
            _originIndividual.Add(_originRefConcParam);
        }
            public ISchemaItem Create()
            {
                var schemaItem = new SchemaItem().WithName(Guid.NewGuid().ToString());

                schemaItem.Add(DomainHelperForSpecs.ConstantParameterWithValue(0).WithName(Constants.Parameters.START_TIME));
                schemaItem.Add(DomainHelperForSpecs.ConstantParameterWithValue(0).WithName(CoreConstants.Parameter.INPUT_DOSE));
                return(schemaItem);
            }
Exemplo n.º 24
0
 protected override void Context()
 {
     base.Context();
     _displayName         = "tutu";
     _expressionContainer = new MoleculeExpressionContainer().WithName("tralal");
     _expressionContainer.Add(DomainHelperForSpecs.ConstantParameterWithValue(5).WithName(CoreConstants.Parameters.REL_EXP));
     A.CallTo(() => _representationInfoRepository.DisplayNameFor(_expressionContainer)).Returns(_displayName);
 }
Exemplo n.º 25
0
 protected override void Context()
 {
     _tableParameter          = DomainHelperForSpecs.ConstantParameterWithValue(5);
     _distributedTableFormula = new DistributedTableFormula();
     _tableParameter.Formula  = _distributedTableFormula;
     _context = A.Fake <IExecutionContext>();
     A.CallTo(() => _context.Resolve <IDistributionMetaDataToDistributionMapper>()).Returns(new DistributionMetaDataToDistributionMapper());
     sut = new UpdateDistributedTableFormulaPercentileCommand(_tableParameter, 0.5);
 }
 protected override void Context()
 {
     base.Context();
     _simpleProtocol = new SimpleProtocol();
     _simpleProtocol.ApplicationType = ApplicationTypes.Intravenous;
     _simpleProtocol.DosingInterval  = DosingIntervals.DI_6_6_12;
     _simpleProtocol.Add(DomainHelperForSpecs.ConstantParameterWithValue(5).WithName(CoreConstants.Parameter.INPUT_DOSE));
     _simpleProtocol.Add(DomainHelperForSpecs.ConstantParameterWithValue(3600).WithName(Constants.Parameters.END_TIME)); //2.5 day
 }
        protected override void Context()
        {
            _parameter           = DomainHelperForSpecs.ConstantParameterWithValue(10).WithId("Id");
            _parameter.IsDefault = true;
            sut = new SetParameterDefaultStateCommand(_parameter, false);

            _context = A.Fake <IExecutionContext>();
            A.CallTo(() => _context.Get <IParameter>(_parameter.Id)).Returns(_parameter);
        }
            public Schema Create(IContainer container)
            {
                var schema = new Schema().WithName(Guid.NewGuid().ToString());

                schema.Add(DomainHelperForSpecs.ConstantParameterWithValue(0).WithName(Constants.Parameters.START_TIME));
                schema.Add(DomainHelperForSpecs.ConstantParameterWithValue(0).WithName(CoreConstants.Parameter.TIME_BETWEEN_REPETITIONS));
                schema.Add(DomainHelperForSpecs.ConstantParameterWithValue(0).WithName(CoreConstants.Parameter.NUMBER_OF_REPETITIONS));
                return(schema);
            }
Exemplo n.º 29
0
 protected override void Context()
 {
     _tableParameter          = DomainHelperForSpecs.ConstantParameterWithValue(5);
     _distributedTableFormula = new DistributedTableFormula();
     _tableParameter.Formula  = _distributedTableFormula;
     _context = A.Fake <IExecutionContext>();
     _ratio   = 2;
     sut      = new UpdateDistributedTableFormulaRatioCommand(_tableParameter, _ratio);
 }
Exemplo n.º 30
0
 protected override void Context()
 {
     base.Context();
     _sourceParameter = DomainHelperForSpecs.ConstantParameterWithValue(10);
     _targetParameter = DomainHelperForSpecs.ConstantParameterWithValue(10);
     _sourceParameter.IsFixedValue = true;
     _targetParameter.IsFixedValue = false;
     A.CallTo(() => _formulaTypeMapper.MapFrom(_targetParameter)).Returns(FormulaType.Rate);
 }