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)));
        }
        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 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.º 5
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.º 6
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.º 8
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
                }
            };
        }
Ejemplo n.º 9
0
        protected override void Context()
        {
            _entityPathResolver           = new EntityPathResolverForSpecs();
            _representationInfoRepository = new RepresentationInfoRepositoryForSpecs();
            sut = new PKSimPathToPathElementsMapper(_representationInfoRepository, _entityPathResolver);

            _organism                = new Organism();
            _venousBlood             = new Organ().WithName(CoreConstants.Organ.VenousBlood).WithParentContainer(_organism);
            _liver                   = new Organ().WithName(CoreConstants.Organ.Liver).WithParentContainer(_organism);
            _kidney                  = new Organ().WithName(CoreConstants.Organ.Kidney).WithParentContainer(_organism);
            _liverInt                = new Compartment().WithName(CoreConstants.Compartment.Interstitial).WithParentContainer(_liver);
            _liverCell               = new Compartment().WithName(CoreConstants.Compartment.Intracellular).WithParentContainer(_liver);
            _kidneyUrine             = new Compartment().WithName(CoreConstants.Compartment.URINE).WithParentContainer(_kidney);
            _gallBladder             = new Organ().WithName(CoreConstants.Organ.Gallbladder).WithParentContainer(_organism);
            _lumen                   = new Organ().WithName(CoreConstants.Organ.Lumen).WithParentContainer(_organism);
            _peripheralVenousBlood   = new Container().WithName(CoreConstants.Organ.PeripheralVenousBlood).WithParentContainer(_organism);
            _smallIntestine          = new Organ().WithName(CoreConstants.Organ.SmallIntestine).WithParentContainer(_organism);
            _mucosa                  = new Compartment().WithName(CoreConstants.Compartment.Mucosa).WithParentContainer(_smallIntestine);
            _mucosa_duo              = new Compartment().WithName(CoreConstants.Compartment.Duodenum).WithParentContainer(_mucosa);
            _mucosa_duo_interstitial = new Compartment().WithName(CoreConstants.Compartment.Interstitial).WithParentContainer(_mucosa_duo);

            _events     = new Container().WithName(Constants.EVENTS);
            _eventGroup = new EventGroup().WithName("E1").WithParentContainer(_events);
            _plasma     = new Compartment().WithName(CoreConstants.Compartment.Plasma).WithParentContainer(_venousBlood);
            _drugContainerVenousBlood           = new Container().WithName(_drugName).WithContainerType(ContainerType.Molecule).WithParentContainer(_venousBlood);
            _drugContainerPeripheralVenousBlood = new Container().WithName(_drugName).WithContainerType(ContainerType.Molecule).WithParentContainer(_peripheralVenousBlood);
            _drugContainerGallBladder           = new Container().WithName(_drugName).WithContainerType(ContainerType.Molecule).WithParentContainer(_gallBladder);
            _drugContainerInLumen     = new Container().WithName(_drugName).WithContainerType(ContainerType.Molecule).WithParentContainer(_lumen);
            _drugContainerInLiverCell = new Container().WithName(_drugName).WithContainerType(ContainerType.Molecule).WithParentContainer(_liverCell);
            _drug = new MoleculeAmount().WithName(_drugName).WithParentContainer(_plasma);

            _drugUrineKidney = new MoleculeAmount().WithName(_drugName).WithParentContainer(_kidneyUrine);
            _applications    = new Container().WithName(Constants.APPLICATIONS);
            _application1    = new EventGroup().WithName("App").WithParentContainer(_applications).WithContainerType(ContainerType.EventGroup);
            _formulation     = new Container().WithName("F1").WithParentContainer(_application1);

            _neighborhoods = new Container().WithName(Constants.NEIGHBORHOODS);
            _liverCellToLiverIntNeighborhood = new Neighborhood {
                FirstNeighbor = _liverInt, SecondNeighbor = _liverCell
            }.WithParentContainer(_neighborhoods);
            _concentrationDimension = DomainHelperForSpecs.ConcentrationDimensionForSpecs();
            _fractionDimension      = DomainHelperForSpecs.FractionDimensionForSpecs();
        }
Ejemplo n.º 10
0
        protected override void Context()
        {
            base.Context();
            var dim = DomainHelperForSpecs.ConcentrationDimensionForSpecs();

            _populationDataCollector = A.Fake <IPopulationDataCollector>();
            _chartData = new ChartData <TimeProfileXValue, TimeProfileYValue>(new AxisData(dim, dim.DefaultUnit, Scalings.Linear), null);
            var pane = new PaneData <TimeProfileXValue, TimeProfileYValue>(new AxisData(dim, dim.DefaultUnit, Scalings.Linear));

            _chartData.AddPane(pane);
            var curve = new CurveData <TimeProfileXValue, TimeProfileYValue>()
            {
                Pane         = pane,
                QuantityPath = "PATH",
            };

            curve.Add(new TimeProfileXValue(1), new TimeProfileYValue {
                Y = 10
            });
            curve.Add(new TimeProfileXValue(2), new TimeProfileYValue {
                Y = 20
            });
            pane.AddCurve(curve);

            var rangeCurve = new CurveData <TimeProfileXValue, TimeProfileYValue>()
            {
                Pane         = pane,
                QuantityPath = "RANGE_PATH",
            };

            rangeCurve.Add(new TimeProfileXValue(1), new TimeProfileYValue {
                Y = 10, LowerValue = 1, UpperValue = 2
            });
            pane.AddCurve(rangeCurve);

            A.CallTo(() => _populationDataCollector.MolWeightFor("PATH")).Returns(100);

            A.CallTo(() => _pkMapper.MapFrom(A <DataColumn> ._, A <PKValues> ._, A <PKParameterMode> ._, A <string> ._))
            .Invokes(x => _dataColumn = x.GetArgument <DataColumn>(0));
        }
Ejemplo n.º 11
0
        protected override void Context()
        {
            _dimensionRepository          = A.Fake <IDimensionRepository>();
            _representationInfoRepository = A.Fake <IRepresentationInfoRepository>();
            _lazyLoadTask            = A.Fake <ILazyLoadTask>();
            _observedCurveDataMapper = A.Fake <IDataRepositoryToObservedCurveDataMapper>();
            _statisticalAnalysis     = new PopulationStatisticalAnalysis();
            _genderField             = ChartDataHelperForSpecs.CreateGenderField();
            _statisticalAnalysis.Add(_genderField);
            _statisticalAnalysis.Add(_outputFieldVenousBloodPlasma);
            _statisticalAnalysis.Add(_outputFieldLiverCell);
            _predefinedStatisticalAggregation = new PredefinedStatisticalAggregation {
                Selected = true
            };
            _percentileStatisticalAggregation = new PercentileStatisticalAggregation {
                Selected = false, Percentile = 50
            };
            _statisticalAnalysis.AddStatistic(_predefinedStatisticalAggregation);
            _statisticalAnalysis.AddStatistic(_percentileStatisticalAggregation);
            A.CallTo(() => _representationInfoRepository.DisplayNameFor(_predefinedStatisticalAggregation)).Returns(_singleCurveId);
            A.CallTo(() => _representationInfoRepository.DisplayNameFor(_percentileStatisticalAggregation)).Returns(_percentileId);
            _statisticalDataCalculator = new StatisticalDataCalculator();
            _pivotResultCreator        = A.Fake <IPivotResultCreator>();

            _mergedDimensionVenousBloodPlasma = DomainHelperForSpecs.ConcentrationDimensionForSpecs();
            _mergedDimensionLiverCell         = DomainHelperForSpecs.FractionDimensionForSpecs();

            A.CallTo(() => _dimensionRepository.MergedDimensionFor(A <IWithDimension> ._))
            .WhenArgumentsMatch((IWithDimension context) => Equals((context as NumericFieldContext)?.NumericValueField, _outputFieldVenousBloodPlasma))
            .Returns(_mergedDimensionVenousBloodPlasma);

            A.CallTo(() => _dimensionRepository.MergedDimensionFor(A <IWithDimension> ._))
            .WhenArgumentsMatch((IWithDimension context) => Equals((context as NumericFieldContext)?.NumericValueField, _outputFieldLiverCell))
            .Returns(_mergedDimensionLiverCell);

            sut = new TimeProfileChartDataCreator(_dimensionRepository, _pivotResultCreator, _representationInfoRepository,
                                                  _statisticalDataCalculator, _lazyLoadTask, _observedCurveDataMapper);
        }
Ejemplo n.º 12
0
        protected override void Context()
        {
            base.Context();
            var alternative = new ParameterAlternative();

            A.CallTo(() => _objectBaseFactory.Create <ParameterAlternative>()).Returns(alternative);
            A.CallTo(() => _objectBaseFactory.Create <ConstantFormula>()).Returns(new ConstantFormula());
            _compoundParameterGroup.Name       = CoreConstants.Groups.COMPOUND_SOLUBILITY;
            _templateSolubilityTable           = DomainHelperForSpecs.ConstantParameterWithValue().WithName(CoreConstants.Parameters.SOLUBILITY_TABLE);
            _templateSolubilityTable.GroupName = CoreConstants.Groups.COMPOUND_SOLUBILITY;
            _solubilityTable           = DomainHelperForSpecs.ConstantParameterWithValue().WithName(CoreConstants.Parameters.SOLUBILITY_TABLE);
            _solubilityTable.Dimension = DomainHelperForSpecs.ConcentrationDimensionForSpecs();

            A.CallTo(() => _cloner.Clone(_templateSolubilityTable)).Returns(_solubilityTable);
            var compound = new Compound {
                _templateSolubilityTable
            };

            _compoundParameterGroup.ParentContainer = compound;

            _tableFormula = new TableFormula();
            A.CallTo(() => _formulaFactory.CreateTableFormula(false)).Returns(_tableFormula);
        }
Ejemplo n.º 13
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);
        }