protected override void Context() { base.Context(); var populationFieldFactory = A.Fake <PopulationAnalysisFieldFactory>(); _covariateField = populationFieldFactory.CreateFor("Gender", _populationDataCollector); _populationAnalysis.Add(_covariateField); _genderValues = new string[] { "Male", "Female" }; _covariateField.AddGroupingItem(new GroupingItem { Label = "Male", Color = PKSimColors.Male, Symbol = Symbols.Circle }); _covariateField.AddGroupingItem(new GroupingItem { Label = "Female", Color = PKSimColors.Female, Symbol = Symbols.Diamond }); var referenceSimulation = A.Fake <PopulationSimulation>().WithName("Sim"); _referenceGroupingItem = new GroupingItem { Label = "Reference", Color = Color.Black, Symbol = Symbols.Circle }; _populationDataCollector.ReferenceSimulation = referenceSimulation; _populationDataCollector.ReferenceGroupingItem = _referenceGroupingItem; A.CallTo(() => _populationDataCollector.NumberOfItems).Returns(_ageValues.Count * 2); A.CallTo(() => _populationDataCollector.AllSimulationNames()).Returns( Enumerable.Repeat(referenceSimulation.Name, _ageValues.Count).Concat( Enumerable.Repeat("Sim2", _ageValues.Count)).ToArray()); A.CallTo(() => _populationDataCollector.AllValuesFor(_ageField.ParameterPath)).Returns(_ageValues.Concat(_ageValues).ToArray()); A.CallTo(() => _populationDataCollector.AllCovariateValuesFor(_covariateField.Covariate)).Returns(_genderValues.Concat(_genderValues).Concat(_genderValues).ToArray()); }
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); }