protected override void Context() { _pkCalculator = A.Fake <IPKValuesCalculator>(); _pkMapper = A.Fake <IPKValuesToPKAnalysisMapper>(); _dimensionRepository = A.Fake <IDimensionRepository>(); _pkCalculationOptionsFactory = A.Fake <IPKCalculationOptionsFactory>(); _pkParameterRepository = A.Fake <IPKParameterRepository>(); sut = new PKAnalysisTask(_pkCalculator, _pkMapper, _dimensionRepository, _pkCalculationOptionsFactory, _pkParameterRepository); }
protected override void Context() { _lazyLoadTask = A.Fake <ILazyLoadTask>(); _pkValuesCalculator = A.Fake <IPKValuesCalculator>(); _pkParameterRepository = A.Fake <IPKParameterRepository>(); _pkCalculationOptionsFactory = A.Fake <IPKCalculationOptionsFactory>(); _entityPathResolver = A.Fake <IEntityPathResolver>(); sut = new PopulationPKAnalysesTask(_lazyLoadTask, _pkValuesCalculator, _pkParameterRepository, _pkCalculationOptionsFactory, _entityPathResolver); _populationSimulation = A.Fake <PopulationSimulation>(); _outputSelections = new OutputSelections(); A.CallTo(() => _populationSimulation.OutputSelections).Returns(_outputSelections); _allBodyWeights = new List <double>(); _bodyWeight = A.Fake <IParameter>(); var bodyWeightPath = "PATH"; A.CallTo(() => _populationSimulation.BodyWeight).Returns(_bodyWeight); A.CallTo(() => _entityPathResolver.PathFor(_bodyWeight)).Returns(bodyWeightPath); A.CallTo(() => _populationSimulation.AllValuesFor(bodyWeightPath)).Returns(_allBodyWeights); A.CallTo(() => _populationSimulation.NumberOfItems).Returns(2); _individualResult0 = new IndividualResults { IndividualId = 0, Time = new QuantityValues { Values = new[] { 1f, 2f } } }; _individualResult0.Add(new QuantityValues { QuantityPath = _quantityPath1, Values = new[] { 10f, 20f } }); _individualResult0.Add(new QuantityValues { QuantityPath = _quantityPath2, Values = new[] { 11f, 21f } }); _individualResult1 = new IndividualResults { IndividualId = 1, Time = new QuantityValues { Values = new[] { 3f, 4f } } }; _individualResult1.Add(new QuantityValues { QuantityPath = _quantityPath1, Values = new[] { 30f, 40f } }); _individualResult1.Add(new QuantityValues { QuantityPath = _quantityPath2, Values = new[] { 31f, 41f } }); _simulationResults = new SimulationResults { _individualResult0, _individualResult1 }; _populationSimulation.Results = _simulationResults; _pkParameter1 = new PKParameter { Mode = PKParameterMode.Always, Name = "Cmax" }; _pkParameter2 = new PKParameter { Mode = PKParameterMode.Always, Name = "tMax" }; A.CallTo(() => _pkParameterRepository.All()).Returns(new[] { _pkParameter1, _pkParameter2 }); }
protected override void Context() { _lazyLoadTask = A.Fake <ILazyLoadTask>(); _pkCalculator = A.Fake <IPKValuesCalculator>(); _pkMapper = A.Fake <IPKValuesToPKAnalysisMapper>(); _dimensionRepository = A.Fake <IDimensionRepository>(); _pkCalculationOptionsFactory = A.Fake <IPKCalculationOptionsFactory>(); _pkParameterRepository = A.Fake <IPKParameterRepository>(); _entityPathResolver = A.Fake <IEntityPathResolver>(); sut = new PKAnalysesTask(_lazyLoadTask, _pkCalculator, _pkParameterRepository, _pkCalculationOptionsFactory, _entityPathResolver, _pkMapper, _dimensionRepository); }
protected override void Context() { _vssCalculator = A.Fake <IVSSCalculator>(); _parameterFactory = A.Fake <IParameterFactory>(); _protocolMapper = A.Fake <IProtocolToSchemaItemsMapper>(); _protocolFactory = A.Fake <IProtocolFactory>(); _globalPKAnalysisRunner = A.Fake <IGlobalPKAnalysisRunner>(); _pkCalculationOptionsFactory = A.Fake <IPKCalculationOptionsFactory>(); _pkAnalysisTask = A.Fake <IPKAnalysesTask>(); _interactionTask = A.Fake <IInteractionTask>(); _cloner = A.Fake <ICloner>(); sut = new GlobalPKAnalysisTask(_parameterFactory, _protocolMapper, _protocolFactory, _globalPKAnalysisRunner, _pkAnalysisTask, _pkCalculationOptionsFactory, _vssCalculator, _interactionTask, _cloner); var baseGrid = new BaseGrid("time", A.Fake <IDimension>()); _peripheralVenousBloodPlasma = CalculationColumnFor(baseGrid, CoreConstants.Organ.PeripheralVenousBlood, CoreConstants.Observer.PLASMA_PERIPHERAL_VENOUS_BLOOD, CoreConstants.Observer.PLASMA_PERIPHERAL_VENOUS_BLOOD, _compoundName); _venousBloodPlasma = CalculationColumnFor(baseGrid, CoreConstants.Organ.VenousBlood, CoreConstants.Compartment.Plasma, CoreConstants.Observer.CONCENTRATION_IN_CONTAINER, _compoundName); _individual = A.Fake <Individual>(); _species = new Species(); A.CallTo(() => _individual.Species).Returns(_species); _compound = new Compound().WithName(_compoundName); _compoundProperties = new CompoundProperties { Compound = _compound }; _simulationSchemaItems = new List <SchemaItem>(); _protocol = new SimpleProtocol(); _compoundProperties.ProtocolProperties.Protocol = _protocol; A.CallTo(() => _protocolMapper.MapFrom(_protocol)).Returns(_simulationSchemaItems); _simulation = new IndividualSimulation { Properties = new SimulationProperties() }; _simulation.Properties.AddCompoundProperties(_compoundProperties); _simulation.AddUsedBuildingBlock(new UsedBuildingBlock("CompId", PKSimBuildingBlockType.Compound) { BuildingBlock = _compound }); _simulation.AddUsedBuildingBlock(new UsedBuildingBlock("IndividualId", PKSimBuildingBlockType.Individual) { BuildingBlock = _individual }); _simulation.DataRepository = new DataRepository { _venousBloodPlasma, _peripheralVenousBloodPlasma }; _venousBloodPK = new PKValues(); _venousBloodPK.AddValue(Constants.PKParameters.Vss, 10); _venousBloodPK.AddValue(Constants.PKParameters.Vd, 11); _venousBloodPK.AddValue(Constants.PKParameters.CL, 12); _venousBloodPK.AddValue(Constants.PKParameters.AUC_inf, 13); _venousBloodPK.AddValue(Constants.PKParameters.AUC_inf_tD1_norm, 14); _peripheralVenousBloodPK = new PKValues(); _peripheralVenousBloodPK.AddValue(Constants.PKParameters.Vss, 21); _peripheralVenousBloodPK.AddValue(Constants.PKParameters.Vd, 22); _peripheralVenousBloodPK.AddValue(Constants.PKParameters.CL, 23); _peripheralVenousBloodPK.AddValue(Constants.PKParameters.AUC_inf, 24); _peripheralVenousBloodPK.AddValue(Constants.PKParameters.AUC_inf_tD1_norm, 25); _peripheralVenousBloodPK.AddValue(Constants.PKParameters.C_max, 26); _peripheralVenousBloodPK.AddValue(Constants.PKParameters.C_max_tDLast_tDEnd, 27); A.CallTo(() => _pkAnalysisTask.CalculatePK(_venousBloodPlasma, A <PKCalculationOptions> ._)).Returns(_venousBloodPK); A.CallTo(() => _pkAnalysisTask.CalculatePK(_peripheralVenousBloodPlasma, A <PKCalculationOptions> ._)).Returns(_peripheralVenousBloodPK); A.CallTo(() => _parameterFactory.CreateFor(A <string> ._, A <double> ._, A <string> ._, PKSimBuildingBlockType.Simulation)) .ReturnsLazily(s => new PKSimParameter().WithName((string)s.Arguments[0]) .WithDimension(A.Fake <IDimension>()) .WithFormula(new ConstantFormula((double)s.Arguments[1]))); }
protected override void Context() { _vssCalculator = A.Fake <IVSSCalculator>(); _parameterFactory = A.Fake <IParameterFactory>(); _protocolMapper = A.Fake <IProtocolToSchemaItemsMapper>(); _protocolFactory = A.Fake <IProtocolFactory>(); _globalPKAnalysisRunner = A.Fake <IGlobalPKAnalysisRunner>(); _pkCalculationOptionsFactory = A.Fake <IPKCalculationOptionsFactory>(); _pkAnalysisTask = A.Fake <IPKAnalysesTask>(); _interactionTask = A.Fake <IInteractionTask>(); _cloner = A.Fake <ICloner>(); sut = new GlobalPKAnalysisTask(_parameterFactory, _protocolMapper, _protocolFactory, _globalPKAnalysisRunner, _pkAnalysisTask, _pkCalculationOptionsFactory, _vssCalculator, _interactionTask, _cloner); var baseGrid = new BaseGrid("time", A.Fake <IDimension>()); _peripheralVenousBloodPlasma = CalculationColumnFor(baseGrid, CoreConstants.Organ.PERIPHERAL_VENOUS_BLOOD, CoreConstants.Observer.PLASMA_PERIPHERAL_VENOUS_BLOOD, CoreConstants.Observer.PLASMA_PERIPHERAL_VENOUS_BLOOD, _compoundName); _venousBloodPlasma = CalculationColumnFor(baseGrid, CoreConstants.Organ.VENOUS_BLOOD, CoreConstants.Compartment.PLASMA, CoreConstants.Observer.CONCENTRATION_IN_CONTAINER, _compoundName); _individual = A.Fake <Individual>(); _species = new Species(); A.CallTo(() => _individual.Species).Returns(_species); _compound = new Compound().WithName(_compoundName); _compoundProperties = new CompoundProperties { Compound = _compound }; _protocol = new SimpleProtocol(); _compoundProperties.ProtocolProperties.Protocol = _protocol; _simulation = new IndividualSimulation { Properties = new SimulationProperties() }; _simulation.Properties.AddCompoundProperties(_compoundProperties); _simulation.AddUsedBuildingBlock(new UsedBuildingBlock("CompId", PKSimBuildingBlockType.Compound) { BuildingBlock = _compound }); _simulation.AddUsedBuildingBlock(new UsedBuildingBlock("IndividualId", PKSimBuildingBlockType.Individual) { BuildingBlock = _individual }); _simulation.DataRepository = new DataRepository { _venousBloodPlasma, _peripheralVenousBloodPlasma }; _simulation.SimulationSettings = new SimulationSettings(); _simulation.OutputSchema = new OutputSchema(); _simulation.OutputSchema.AddInterval(new OutputInterval { DomainHelperForSpecs.ConstantParameterWithValue(100).WithName(Constants.Parameters.END_TIME) }); _simulation.Model = new OSPSuite.Core.Domain.Model { Root = new Container() }; _eventGroup = new EventGroup(); _application1 = new Container().WithName("App1").WithContainerType(ContainerType.Application); _application1.Add(new MoleculeAmount().WithName(_compoundName)); _application1.Add(DomainHelperForSpecs.ConstantParameterWithValue(10).WithName(Constants.Parameters.START_TIME)); _application2 = new Container().WithName("App2").WithContainerType(ContainerType.Application); _application2.Add(DomainHelperForSpecs.ConstantParameterWithValue(10).WithName(Constants.Parameters.START_TIME)); _application2.Add(new MoleculeAmount().WithName(_compoundName)); _simulation.Model.Root.Add(_eventGroup); _eventGroup.Add(_application1); _venousBloodPK = new PKValues(); _venousBloodPK.AddValue(Constants.PKParameters.Vss, 10); _venousBloodPK.AddValue(Constants.PKParameters.Vd, 11); _venousBloodPK.AddValue(Constants.PKParameters.CL, 12); _venousBloodPK.AddValue(Constants.PKParameters.AUC_inf, 13); _venousBloodPK.AddValue(Constants.PKParameters.AUC_inf_tD1_norm, 14); _peripheralVenousBloodPK = new PKValues(); _peripheralVenousBloodPK.AddValue(Constants.PKParameters.Vss, 21); _peripheralVenousBloodPK.AddValue(Constants.PKParameters.Vd, 22); _peripheralVenousBloodPK.AddValue(Constants.PKParameters.CL, 23); _peripheralVenousBloodPK.AddValue(Constants.PKParameters.AUC_inf, 24); _peripheralVenousBloodPK.AddValue(Constants.PKParameters.AUC_inf_tD1_norm, 25); _peripheralVenousBloodPK.AddValue(Constants.PKParameters.C_max, 26); _peripheralVenousBloodPK.AddValue(Constants.PKParameters.C_max_tDLast_tDEnd, 27); A.CallTo(() => _pkAnalysisTask.CalculatePK(_venousBloodPlasma, A <PKCalculationOptions> ._)).Returns(_venousBloodPK); A.CallTo(() => _pkAnalysisTask.CalculatePK(_peripheralVenousBloodPlasma, A <PKCalculationOptions> ._)).Returns(_peripheralVenousBloodPK); A.CallTo(() => _parameterFactory.CreateFor(A <string> ._, A <double> ._, A <string> ._, PKSimBuildingBlockType.Simulation)) .ReturnsLazily(s => new PKSimParameter().WithName((string)s.Arguments[0]) .WithDimension(A.Fake <IDimension>()) .WithFormula(new ConstantFormula((double)s.Arguments[1]))); }