protected override void Context()
        {
            _observedDataCollection = new ObservedDataCollection();
            _displayPathMapper      = A.Fake <IQuantityPathToQuantityDisplayPathMapper>();
            _dimensionRepository    = A.Fake <IDimensionRepository>();
            sut              = new DataRepositoryToObservedCurveDataMapper(_displayPathMapper, _dimensionRepository);
            _observedData    = new DataRepository();
            _baseGrid        = new BaseGrid("Time", DomainHelperForSpecs.TimeDimensionForSpecs());
            _baseGrid.Values = new[] { 1.0f, 2.0f, 3.0f };

            _data                 = new DataColumn("Col", DomainHelperForSpecs.ConcentrationDimensionForSpecs(), _baseGrid);
            _data.Values          = new[] { 10f, 20f, 30f };
            _data.DataInfo.Origin = ColumnOrigins.Observation;

            _observedData.Add(_data);

            _errorArithmetic        = new DataColumn("ErrorArithmetic", _data.Dimension, _baseGrid);
            _errorArithmetic.Values = new[] { 1.0f, 2.2f, 3.3f };
            _errorArithmetic.DataInfo.AuxiliaryType = AuxiliaryType.ArithmeticStdDev;

            _errorGeometric        = new DataColumn("ErrorGeometric", DomainHelperForSpecs.NoDimension(), _baseGrid);
            _errorGeometric.Values = new[] { 1.0f, 1.2f, 1.3f };
            _errorGeometric.DataInfo.AuxiliaryType = AuxiliaryType.GeometricStdDev;

            _observedDataCollection.AddObservedData(_observedData);

            _curveOptions           = _observedDataCollection.ObservedDataCurveOptionsFor(_data).CurveOptions;
            _curveOptions.Color     = Color.Aqua;
            _curveOptions.LineStyle = LineStyles.Dot;
            _curveOptions.Symbol    = Symbols.Diamond;
        }
        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)));
        }
Ejemplo n.º 3
0
 protected override void Context()
 {
     sut = new ParameterRange {
         Dimension = DomainHelperForSpecs.TimeDimensionForSpecs()
     };
     sut.Unit = sut.Dimension.Unit("h");
 }
        protected override void Context()
        {
            base.Context();
            var timeDimension = DomainHelperForSpecs.TimeDimensionForSpecs();
            var concDimension = DomainHelperForSpecs.ConcentrationDimensionForSpecs();

            _xAxis = new AxisData(timeDimension, timeDimension.DefaultUnit, Scalings.Linear)
            {
                Caption = "X"
            };
            _yAxis = new AxisData(concDimension, concDimension.DefaultUnit, Scalings.Linear)
            {
                Caption = "Y"
            };
            _chartData = new ChartData <TimeProfileXValue, TimeProfileYValue>(_xAxis, null, null, null);
            var pane1 = new PaneData <TimeProfileXValue, TimeProfileYValue>(_yAxis)
            {
                Caption = "Male"
            };
            var pane2 = new PaneData <TimeProfileXValue, TimeProfileYValue>(_yAxis)
            {
                Caption = "Female"
            };

            _chartData.AddPane(pane1);
            _chartData.AddPane(pane2);
            var curve1 = new CurveData <TimeProfileXValue, TimeProfileYValue> {
                Caption = "Liver"
            };

            curve1.Add(new TimeProfileXValue(1), new TimeProfileYValue {
                Y = 10
            });
            curve1.Add(new TimeProfileXValue(2), new TimeProfileYValue {
                LowerValue = 20, UpperValue = 30
            });
            pane1.AddCurve(curve1);

            var curve2 = new CurveData <TimeProfileXValue, TimeProfileYValue> {
                Caption = "Kidney"
            };

            curve2.Add(new TimeProfileXValue(3), new TimeProfileYValue {
                Y = 40
            });
            pane2.AddCurve(curve2);

            _observedData = DomainHelperForSpecs.ObservedData();
            var displayPathMapper   = A.Fake <IQuantityPathToQuantityDisplayPathMapper>();
            var dimensionRepository = A.Fake <IDimensionRepository>();
            var observedDataMapper  = new DataRepositoryToObservedCurveDataMapper(displayPathMapper, dimensionRepository);
            var obserevdDataCurves  = observedDataMapper.MapFrom(_observedData, new ObservedDataCollection(), concDimension);

            obserevdDataCurves.Each(pane1.AddObservedCurve);
            observedDataMapper.MapFrom(_observedData, new ObservedDataCollection(), concDimension).Each(curve =>
            {
                curve.Visible = false;
                pane1.AddObservedCurve(curve);
            });
        }
        protected override Task Context()
        {
            _formulaFactory      = A.Fake <IFormulaFactory>();
            _dimensionRepository = A.Fake <IDimensionRepository>();

            sut = new TableFormulaMapper(_formulaFactory, _dimensionRepository);

            _tableFormula = new TableFormula
            {
                XName      = "pH",
                YName      = "Value",
                XDimension = DomainHelperForSpecs.TimeDimensionForSpecs(),
                Dimension  = DomainHelperForSpecs.LengthDimensionForSpecs(),
                Name       = "SUPER_FORMULA"
            };

            _tableFormula.XDisplayUnit = _tableFormula.XDimension.Unit("h");
            _tableFormula.YDisplayUnit = _tableFormula.Dimension.Unit("cm");

            _tableFormula.UseDerivedValues = true;

            _tableFormula.AddPoint(60, 1);  //60 min, 1m
            _tableFormula.AddPoint(120, 2); //120 min, 2m
            _tableFormula.AllPoints().ElementAt(1).RestartSolver = true;

            A.CallTo(() => _dimensionRepository.DimensionByName(_tableFormula.XDimension.Name)).Returns(_tableFormula.XDimension);
            A.CallTo(() => _dimensionRepository.DimensionByName(_tableFormula.Dimension.Name)).Returns(_tableFormula.Dimension);

            return(Task.FromResult(true));
        }
Ejemplo n.º 6
0
 protected override void Context()
 {
     base.Context();
     _cloneManager = A.Fake <ICloneManager>();
     _sourceFixedLimitDefinition = new FixedLimitsGroupingDefinition("Field");
     _sourceFixedLimitDefinition.SetLimits(new [] { 1.5, 2.5 }.OrderBy(x => x));
     _sourceFixedLimitDefinition.Dimension   = DomainHelperForSpecs.TimeDimensionForSpecs();
     _sourceFixedLimitDefinition.DisplayUnit = _sourceFixedLimitDefinition.Dimension.Unit("h");
 }
Ejemplo n.º 7
0
        protected override async Task Context()
        {
            await base.Context();

            _snapshot = await sut.MapToSnapshot(_axis);

            _optimalDimension = DomainHelperForSpecs.TimeDimensionForSpecs();
            A.CallTo(() => _dimensionRepository.OptimalDimensionFor(_dimension)).Returns(_optimalDimension);
        }
        protected override void Context()
        {
            base.Context();
            var timeDimension = DomainHelperForSpecs.TimeDimensionForSpecs();
            var concDimension = DomainHelperForSpecs.ConcentrationDimensionForSpecs();

            _xAxis = new AxisData(timeDimension, timeDimension.DefaultUnit, Scalings.Linear)
            {
                Caption = "X"
            };
            _yAxis = new AxisData(concDimension, concDimension.DefaultUnit, Scalings.Linear)
            {
                Caption = "Y"
            };
            _chartData = new ChartData <RangeXValue, RangeYValue>(_xAxis, null);
            var pane1 = new PaneData <RangeXValue, RangeYValue>(_yAxis)
            {
                Caption = "Male"
            };
            var pane2 = new PaneData <RangeXValue, RangeYValue>(_yAxis)
            {
                Caption = "Female"
            };

            _chartData.AddPane(pane1);
            _chartData.AddPane(pane2);
            var curve1 = new CurveData <RangeXValue, RangeYValue> {
                Caption = "Liver"
            };

            curve1.Add(new RangeXValue(1)
            {
                Minimum = 0, Maximum = 1.5f, NumberOfItems = 5
            }, new RangeYValue {
                LowerPercentile = 10, Median = 20, UpperPercentile = 30
            });
            curve1.Add(new RangeXValue(2)
            {
                Minimum = 1.8f, Maximum = 2.5f, NumberOfItems = 10
            }, new RangeYValue {
                LowerPercentile = 20, Median = 30, UpperPercentile = 40
            });
            pane1.AddCurve(curve1);

            var curve2 = new CurveData <RangeXValue, RangeYValue> {
                Caption = "Kidney"
            };

            curve2.Add(new RangeXValue(3)
            {
                Minimum = 2f, Maximum = 4f, NumberOfItems = 15
            }, new RangeYValue {
                LowerPercentile = 30, Median = 40, UpperPercentile = 50
            });
            pane2.AddCurve(curve2);
        }
Ejemplo n.º 9
0
 protected override void Context()
 {
     _objectBaseFactory     = A.Fake <IObjectBaseFactory>();
     _outputIntervalFactory = A.Fake <IOutputIntervalFactory>();
     _dimensionRepository   = A.Fake <IDimensionRepository>();
     _timeDimension         = DomainHelperForSpecs.TimeDimensionForSpecs();
     _dayUnit = _timeDimension.Unit(CoreConstants.Units.Days);
     A.CallTo(() => _dimensionRepository.Time).Returns(_timeDimension);
     sut = new OutputSchemaFactory(_objectBaseFactory, _outputIntervalFactory, _dimensionRepository);
 }
Ejemplo n.º 10
0
        protected override void Context()
        {
            base.Context();
            _simulation = new IndividualSimulation {
                DataRepository = new DataRepository()
            };
            _baseGrid = new BaseGrid("Time", DomainHelperForSpecs.TimeDimensionForSpecs())
            {
                Values = new[] { 10f, 20f, 30f }
            };
            _dataColumn1 = new DataColumn("C1", DomainHelperForSpecs.ConcentrationDimensionForSpecs(), _baseGrid)
            {
                DataInfo     = { Origin = ColumnOrigins.Calculation },
                QuantityInfo = { Path = new[] { "C1", "Concentration" } },
                Values       = new[] { 11f, 21f, 31f }
            };

            _dataColumn2 = new DataColumn("C2", DomainHelperForSpecs.ConcentrationDimensionForSpecs(), _baseGrid)
            {
                DataInfo     = { Origin = ColumnOrigins.Calculation },
                QuantityInfo = { Path = new[] { "C2", "Concentration" } },
                Values       = new[] { 12f, 22f, 32f }
            };

            _simulation.DataRepository.Add(_dataColumn1);
            _simulation.DataRepository.Add(_dataColumn2);

            //Setup global PK analysis
            _globalPKAnalysis = new GlobalPKAnalysis();
            var c1Container = new Container().WithName("C1");

            c1Container.Add(DomainHelperForSpecs.ConstantParameterWithValue(0.5).WithName(CoreConstants.PKAnalysis.FractionAbsorbed));
            var c2Container = new Container().WithName("C2");

            c2Container.Add(DomainHelperForSpecs.ConstantParameterWithValue(1).WithName(CoreConstants.PKAnalysis.FractionAbsorbed));
            _globalPKAnalysis.Add(c1Container);
            _globalPKAnalysis.Add(c2Container);

            _pkC1 = new PKAnalysis
            {
                DomainHelperForSpecs.ConstantParameterWithValue(1).WithName(Constants.PKParameters.MRT),
                DomainHelperForSpecs.ConstantParameterWithValue(2).WithName(Constants.PKParameters.Tmax)
            };

            _pkC2 = new PKAnalysis
            {
                DomainHelperForSpecs.ConstantParameterWithValue(3).WithName(Constants.PKParameters.MRT),
                DomainHelperForSpecs.ConstantParameterWithValue(4).WithName(Constants.PKParameters.Tmax)
            };

            A.CallTo(() => _pkMapper.MapFrom(_dataColumn1, A <PKValues> ._, A <PKParameterMode> ._, "C1")).Returns(_pkC1);
            A.CallTo(() => _pkMapper.MapFrom(_dataColumn2, A <PKValues> ._, A <PKParameterMode> ._, "C2")).Returns(_pkC2);

            _defaultNumberOfRules = DomainHelperForSpecs.ConstantParameterWithValue(3).Rules.Count;
        }
Ejemplo n.º 11
0
        protected override Task Context()
        {
            _descriptorConditionMapper = A.Fake <DescriptorConditionMapper>();
            _explicitFormulaMapper     = A.Fake <ExplicitFormulaMapper>();
            _moleculeListMapper        = A.Fake <MoleculeListMapper>();
            _objectBaseFactory         = A.Fake <IObjectBaseFactory>();
            _dimensionRepository       = A.Fake <IDimensionRepository>();
            _logger = A.Fake <ILogger>();

            _dimension = DomainHelperForSpecs.TimeDimensionForSpecs();

            _amountObserver = new AmountObserverBuilder {
                Dimension = _dimension
            };
            _containerObserver = new ContainerObserverBuilder {
                Dimension = _dimension
            };
            _formula = new OSPSuite.Core.Domain.Formulas.ExplicitFormula("1+2");
            _amountObserver.Formula    = _formula;
            _containerObserver.Formula = _formula;

            _moleculeListSnapshot = new MoleculeList();
            _snapshotFormula      = new ExplicitFormula();

            _newMoleculeList = new OSPSuite.Core.Domain.Builder.MoleculeList();
            _newMoleculeList.AddMoleculeNameToExclude("A");
            _newMoleculeList.AddMoleculeName("B");
            _newMoleculeList.ForAll = false;
            _newFormula             = new OSPSuite.Core.Domain.Formulas.ExplicitFormula("New");

            sut = new ObserverMapper(
                _descriptorConditionMapper,
                _explicitFormulaMapper,
                _moleculeListMapper,
                _objectBaseFactory,
                _dimensionRepository,
                _logger);

            A.CallTo(() => _explicitFormulaMapper.MapToSnapshot(_formula)).Returns(_snapshotFormula);
            A.CallTo(() => _explicitFormulaMapper.MapToModel(_snapshotFormula)).Returns(_newFormula);
            A.CallTo(() => _moleculeListMapper.MapToSnapshot(_amountObserver.MoleculeList)).Returns(_moleculeListSnapshot);
            A.CallTo(() => _moleculeListMapper.MapToSnapshot(_containerObserver.MoleculeList)).Returns(_moleculeListSnapshot);
            A.CallTo(() => _moleculeListMapper.MapToModel(_moleculeListSnapshot)).Returns(_newMoleculeList);

            A.CallTo(() => _dimensionRepository.DimensionByName(_dimension.Name)).Returns(_dimension);
            A.CallTo(() => _objectBaseFactory.Create <AmountObserverBuilder>()).Returns(new AmountObserverBuilder());
            A.CallTo(() => _objectBaseFactory.Create <ContainerObserverBuilder>()).Returns(new ContainerObserverBuilder());

            return(_completed);
        }
Ejemplo n.º 12
0
        protected override async Task Context()
        {
            await base.Context();

            _snapshot = await sut.MapToSnapshot(_dataRepository);

            _baseGrid            = new BaseGrid("baseGrid", DomainHelperForSpecs.TimeDimensionForSpecs());
            _mappedDataColumn    = new DataColumn("DataColumn", DomainHelperForSpecs.ConcentrationDimensionForSpecs(), _baseGrid);
            _mappedRelatedColumn = new DataColumn("RelatedColumn", DomainHelperForSpecs.ConcentrationDimensionForSpecs(), _baseGrid);
            _mappedDataColumn.AddRelatedColumn(_mappedRelatedColumn);

            A.CallTo(() => _dataColumnMapper.MapToModel(_snapshot.BaseGrid, A <SnapshotContextWithDataRepository> ._)).Returns(_baseGrid);
            A.CallTo(() => _dataColumnMapper.MapToModel(_snapshot.Columns.First(), A <SnapshotContextWithDataRepository> ._)).Returns(_mappedDataColumn);
        }
        protected override void Context()
        {
            base.Context();
            var timeDimension = DomainHelperForSpecs.TimeDimensionForSpecs();
            var concDimension = DomainHelperForSpecs.ConcentrationDimensionForSpecs();

            _xAxis = new AxisData(timeDimension, timeDimension.DefaultUnit, Scalings.Linear)
            {
                Caption = "X"
            };
            _yAxis = new AxisData(concDimension, concDimension.DefaultUnit, Scalings.Linear)
            {
                Caption = "Y"
            };
            _chartData = new ChartData <TimeProfileXValue, TimeProfileYValue>(_xAxis, null, null, null);
            var pane1 = new PaneData <TimeProfileXValue, TimeProfileYValue>(_yAxis)
            {
                Caption = "Male"
            };
            var pane2 = new PaneData <TimeProfileXValue, TimeProfileYValue>(_yAxis)
            {
                Caption = "Female"
            };

            _chartData.AddPane(pane1);
            _chartData.AddPane(pane2);
            var curve1 = new CurveData <TimeProfileXValue, TimeProfileYValue> {
                Caption = "Liver"
            };

            curve1.Add(new TimeProfileXValue(1), new TimeProfileYValue {
                Y = 10
            });
            curve1.Add(new TimeProfileXValue(2), new TimeProfileYValue {
                LowerValue = 20, UpperValue = 30
            });
            pane1.AddCurve(curve1);

            var curve2 = new CurveData <TimeProfileXValue, TimeProfileYValue> {
                Caption = "Kidney"
            };

            curve2.Add(new TimeProfileXValue(3), new TimeProfileYValue {
                Y = 40
            });
            pane2.AddCurve(curve2);
        }
Ejemplo n.º 14
0
        protected override void Context()
        {
            _objectPathFactory = new ObjectPathFactoryForSpecs();
            _dataColumnToPathElementsMapper = A.Fake <IDataColumnToPathElementsMapper>();
            _pathToPathElementsMapper       = A.Fake <IPathToPathElementsMapper>();
            sut = new PKSimQuantityPathToQuantityDisplayPathMapper(_objectPathFactory, _pathToPathElementsMapper, _dataColumnToPathElementsMapper);

            _root = new Container().WithName("ROOT");
            var baseGrid = new BaseGrid("Time", DomainHelperForSpecs.TimeDimensionForSpecs());

            _column = new DataColumn("Conc", DomainHelperForSpecs.ConcentrationDimensionForSpecs(), baseGrid);
            _individualSimulation = new IndividualSimulation {
                Model = new OSPSuite.Core.Domain.Model {
                    Root = _root
                }
            };
        }
        protected override async Task Context()
        {
            await base.Context();

            _originData.DiseaseState = new DiseaseState {
                Name = "CKD"
            };
            _diseaseStateParameter = new OriginDataParameter {
                Name = "Param", Value = 60, Unit = "h"
            };
            _originData.AddDiseaseStateParameter(_diseaseStateParameter);
            _timeDimension = DomainHelperForSpecs.TimeDimensionForSpecs();
            A.CallTo(() => _dimensionRepository.DimensionForUnit(_diseaseStateParameter.Unit)).Returns(_timeDimension);
            A.CallTo(() => _parameterMapper.ParameterFrom(_diseaseStateParameter.Value, _diseaseStateParameter.Unit, _timeDimension))
            .Returns(new Parameter {
                Value = 1, Unit = "h"
            });
        }
        protected override Task Context()
        {
            _parameterMapper     = A.Fake <ParameterMapper>();
            _schemaMapper        = A.Fake <SchemaMapper>();
            _protocolFactory     = A.Fake <IProtocolFactory>();
            _dimensionRepository = A.Fake <IDimensionRepository>();

            sut = new ProtocolMapper(_parameterMapper, _protocolFactory, _schemaMapper, _dimensionRepository);

            _simpleProtocol = new SimpleProtocol
            {
                ApplicationType = ApplicationTypes.Intravenous,
                DosingInterval  = DosingIntervals.DI_6_6_12,
                Name            = "Simple Protocol",
                Description     = "Simple Protocol description",
            };
            _simpleProtocol.Add(DomainHelperForSpecs.ConstantParameterWithValue(3).WithName(Constants.Parameters.START_TIME));
            _simpleProtocol.Add(DomainHelperForSpecs.ConstantParameterWithValue(4).WithName(CoreConstants.Parameters.INPUT_DOSE));
            _simpleProtocol.Add(DomainHelperForSpecs.ConstantParameterWithValue(5).WithName(Constants.Parameters.END_TIME));

            A.CallTo(() => _parameterMapper.MapToSnapshot(_simpleProtocol.StartTime)).Returns(new Parameter().WithName(_simpleProtocol.StartTime.Name));
            A.CallTo(() => _parameterMapper.MapToSnapshot(_simpleProtocol.Dose)).Returns(new Parameter().WithName(_simpleProtocol.Dose.Name));
            A.CallTo(() => _parameterMapper.MapToSnapshot(_simpleProtocol.EndTimeParameter)).Returns(new Parameter().WithName(_simpleProtocol.EndTimeParameter.Name));

            _advancedProtocol = new AdvancedProtocol
            {
                Name        = "Advanced Protocol",
                Description = "Advanced Protocol description",
                TimeUnit    = DomainHelperForSpecs.TimeDimensionForSpecs().DefaultUnit,
            };
            _schema = new Schema().WithName("Schema1");
            _advancedProtocol.AddSchema(_schema);
            _advancedProtocolParameter = DomainHelperForSpecs.ConstantParameterWithValue(3).WithName("AdvancedProtocolParameter");
            _advancedProtocol.Add(_advancedProtocolParameter);
            A.CallTo(() => _parameterMapper.MapToSnapshot(_advancedProtocolParameter)).Returns(new Parameter().WithName(_advancedProtocolParameter.Name));

            _snapshotSchema = new Snapshots.Schema().WithName(_schema.Name);
            A.CallTo(() => _schemaMapper.MapToSnapshot(_schema)).Returns(_snapshotSchema);

            A.CallTo(() => _dimensionRepository.Time).Returns(DomainHelperForSpecs.TimeDimensionForSpecs());

            return(Task.FromResult(true));
        }
Ejemplo n.º 17
0
        protected override Task Context()
        {
            _dimensionRepository = A.Fake <IDimensionRepository>();
            sut            = new GroupingDefinitionMapper(_dimensionRepository);
            _groupingItem1 = new GroupingItem();
            _groupingItem2 = new GroupingItem();

            _dimension = DomainHelperForSpecs.TimeDimensionForSpecs();
            _unit      = _dimension.Unit("h");

            A.CallTo(() => _dimensionRepository.DimensionByName(_dimension.Name)).Returns(_dimension);
            _valueMappingGrouping = new ValueMappingGroupingDefinition("F1");
            _valueMappingGrouping.AddValueLabel("Item1", _groupingItem1);
            _valueMappingGrouping.AddValueLabel("Item2", _groupingItem2);

            _fixedLimitGrouping = new FixedLimitsGroupingDefinition("F1")
            {
                DisplayUnit = _unit,
                Dimension   = _dimension,
            };

            _fixedLimitGrouping.SetLimits(new[] { 60, 120.0 }.OrderBy(x => x));
            _fixedLimitGrouping.AddItem(_groupingItem1);
            _fixedLimitGrouping.AddItem(_groupingItem2);

            _numberOfBinsGrouping = new NumberOfBinsGroupingDefinition("F1")
            {
                DisplayUnit   = _unit,
                Dimension     = _dimension,
                NumberOfBins  = 4,
                NamingPattern = "TOTO",
                StartColor    = Color.Aqua,
                EndColor      = Color.Red,
                Strategy      = LabelGenerationStrategies.Numeric
            };

            _numberOfBinsGrouping.AddItem(_groupingItem1);
            _numberOfBinsGrouping.AddItem(_groupingItem2);

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

            _timeDimension = DomainHelperForSpecs.TimeDimensionForSpecs();
            _snapshot      = await sut.MapToSnapshot(_originData);

            _snapshot.DiseaseState = "Disease";
            _diseaseStateParameter = new Parameter {
                Name = "P1", Value = 1, Unit = "h"
            };
            _snapshot.DiseaseStateParameters = new[] { _diseaseStateParameter };

            A.CallTo(() => _dimensionRepository.DimensionForUnit(_diseaseStateParameter.Unit)).Returns(_timeDimension);

            var diseaseState = new DiseaseState {
                Name = "Disease"
            };

            diseaseState.Add(DomainHelperForSpecs.ConstantParameterWithValue(20).WithName("P1"));
            A.CallTo(() => _diseaseStateRepository.AllFor(_speciesPopulation)).Returns(new[] { diseaseState });
        }
Ejemplo n.º 19
0
        protected override Task Context()
        {
            _dimensionRepository = A.Fake <IDimensionRepository>();
            sut        = new AxisMapper(_dimensionRepository);
            _dimension = DomainHelperForSpecs.TimeDimensionForSpecs();

            _axis = new Axis(AxisTypes.Y)
            {
                Caption          = "Axis Caption",
                GridLines        = true,
                Dimension        = _dimension,
                UnitName         = _dimension.Unit("h").Name,
                Visible          = true,
                Min              = 60, //min
                Max              = 120,
                DefaultColor     = Color.AntiqueWhite,
                DefaultLineStyle = LineStyles.Solid
            };

            A.CallTo(() => _dimensionRepository.DimensionByName(_dimension.Name)).Returns(_dimension);

            return(_completed);
        }
Ejemplo n.º 20
0
        protected override Task Context()
        {
            _dimensionRepository     = A.Fake <IDimensionRepository>();
            _objectBaseFactory       = A.Fake <IObjectBaseFactory>();
            _formulaUsablePathMapper = new FormulaUsablePathMapper(_dimensionRepository);
            sut = new ExplicitFormulaMapper(_objectBaseFactory, _formulaUsablePathMapper, _dimensionRepository);


            _dimension1 = DomainHelperForSpecs.ConcentrationDimensionForSpecs();
            _dimension2 = DomainHelperForSpecs.TimeDimensionForSpecs();
            _formula    = new ExplicitFormula("P1+P2+P3+P4")
            {
                Dimension = _dimension1
            };

            _formula.AddObjectPath(new FormulaUsablePath("A", "B", "C")
            {
                Alias = "P1", Dimension = _dimension1
            });
            _formula.AddObjectPath(new FormulaUsablePath("A", "B")
            {
                Alias = "P2", Dimension = _dimension2
            });
            _formula.AddObjectPath(new FormulaUsablePath("A")
            {
                Alias = "P3", Dimension = Constants.Dimension.NO_DIMENSION
            });
            _formula.AddObjectPath(new FormulaUsablePath("A")
            {
                Alias = "P4"
            });

            A.CallTo(() => _dimensionRepository.DimensionByName(_dimension1.Name)).Returns(_dimension1);
            A.CallTo(() => _objectBaseFactory.Create <ExplicitFormula>()).Returns(new ExplicitFormula());
            return(_completed);
        }
        protected override Task Context()
        {
            _groupingDefinitionMapper = A.Fake <GroupingDefinitionMapper>();
            _dimension           = DomainHelperForSpecs.ConcentrationDimensionForSpecs();
            _mergedDimension     = DomainHelperForSpecs.TimeDimensionForSpecs();
            _unit                = _mergedDimension.Unit("h"); // this unit is defined in the merged dimension but not in the field dimension
            _dimensionRepository = A.Fake <IDimensionRepository>();

            sut = new PopulationAnalysisFieldMapper(_groupingDefinitionMapper, _dimensionRepository);

            _groupingItem1 = new GroupingItem();

            _parameterField = new PopulationAnalysisParameterField
            {
                Name          = "P",
                ParameterPath = "A|B",
                Scaling       = Scalings.Linear,
                Dimension     = _dimension,
                DisplayUnit   = _unit
            };

            _pkParameterField = new PopulationAnalysisPKParameterField
            {
                Name         = "PK",
                Dimension    = _dimension,
                DisplayUnit  = _unit,
                PKParameter  = "AUC",
                QuantityPath = "A|B|C",
                QuantityType = QuantityType.Observer | QuantityType.Drug
            };

            _outputField = new PopulationAnalysisOutputField
            {
                Name         = "Output",
                Dimension    = _dimension,
                DisplayUnit  = _unit,
                QuantityType = QuantityType.BaseGrid,
                QuantityPath = "A|B|C",
                Color        = Color.AntiqueWhite
            };

            _groupingDefinition = new FixedLimitsGroupingDefinition("AA");
            _groupingField      = new PopulationAnalysisGroupingField(_groupingDefinition)
            {
                Name = "Grouping",
            };


            _covariateField = new PopulationAnalysisCovariateField
            {
                Name      = "Gender",
                Covariate = "Gender",
            };
            _covariateField.AddGroupingItem(_groupingItem1);

            _snapshotGroupingDefinition = new Snapshots.GroupingDefinition();
            A.CallTo(() => _groupingDefinitionMapper.MapToSnapshot(_groupingDefinition)).Returns(_snapshotGroupingDefinition);

            A.CallTo(() => _dimensionRepository.DimensionByName(_dimension.Name)).Returns(_dimension);
            A.CallTo(() => _dimensionRepository.MergedDimensionFor(A <INumericValueField> ._)).Returns(_mergedDimension);
            return(_completed);
        }