Exemplo n.º 1
0
        protected override void Context()
        {
            _dialogCreator             = A.Fake <IDialogCreator>();
            _dataRepositoryTask        = A.Fake <IDataRepositoryTask>();
            _quantityDisplayPathMapper = A.Fake <IQuantityPathToQuantityDisplayPathMapper>();
            _pkAnalysesTask            = A.Fake <IPKAnalysesTask>();
            _globalPKAnalysisMapper    = A.Fake <IGlobalPKAnalysisToDataTableMapper>();
            _dimensionFactory          = A.Fake <IDimensionFactory>();

            sut = new PKAnalysisExportTask(_dialogCreator, _dataRepositoryTask, _quantityDisplayPathMapper, _globalPKAnalysisMapper, _dimensionFactory);
        }
Exemplo n.º 2
0
        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])));
        }