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));
        }
예제 #2
0
 protected override void Context()
 {
     base.Context();
     _table            = new TableFormula();
     _table.Dimension  = DomainHelperForSpecs.LengthDimensionForSpecs();
     _table.XDimension = DomainHelperForSpecs.NoDimension();
     _table.AddPoint(1, 10);
     _table.AddPoint(2, 20);
 }
예제 #3
0
        protected override Task Context()
        {
            sut             = new ParameterRangeMapper();
            _parameterRange = new ParameterRange {
                Dimension = DomainHelperForSpecs.LengthDimensionForSpecs(),
            };
            _parameterRange.Unit = _parameterRange.Dimension.Unit("cm");
            _parameterRange.MaxValueInDisplayUnit = 180;
            _parameterRange.MinValueInDisplayUnit = 120;

            return(Task.FromResult(true));
        }
예제 #4
0
        protected override Task Context()
        {
            _tableFormulaMapper = A.Fake <TableFormulaMapper>();
            _valueOriginMapper  = A.Fake <ValueOriginMapper>();
            _entityPathResolver = A.Fake <IEntityPathResolver>();
            _logger             = A.Fake <IOSPSuiteLogger>();
            _containerTask      = new ContainerTaskForSpecs();
            sut = new ParameterMapper(_tableFormulaMapper, _valueOriginMapper, _entityPathResolver, _logger, _containerTask);

            //5 mm is the value
            _parameter = DomainHelperForSpecs.ConstantParameterWithValue(10)
                         .WithName("P1")
                         .WithDescription("P1 description")
                         .WithDimension(DomainHelperForSpecs.LengthDimensionForSpecs());

            _parameter.DisplayUnit = _parameter.Dimension.Unit("mm");
            _snapshotValueOrigin   = new ValueOrigin();

            A.CallTo(() => _valueOriginMapper.MapToSnapshot(_parameter.ValueOrigin)).Returns(_snapshotValueOrigin);
            return(_completed);
        }
예제 #5
0
        protected override void Context()
        {
            base.Context();
            var dim = DomainHelperForSpecs.LengthDimensionForSpecs();

            _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",
            };

            pane.AddCurve(curve);

            A.CallTo(() => _pkMapper.MapFrom(A <DataColumn> ._, A <PKValues> ._, A <PKParameterMode> ._, A <string> ._))
            .Invokes(x => _dataColumn = x.GetArgument <DataColumn>(0));
        }
예제 #6
0
        protected override void Context()
        {
            base.Context();
            _male = new Gender();
            _constantParameter = new PKSimParameter().WithName("P1").WithFormula(new ConstantFormula(1));
            _formulaParameter1 = new PKSimParameter().WithName("P2").WithFormula(new ExplicitFormula("1+1")).WithDimension(DomainHelperForSpecs.LengthDimensionForSpecs());
            _formulaParameter2 = new PKSimParameter().WithName("P3").WithFormula(new ExplicitFormula("1+2"));

            A.CallTo(() => _entityPathResolver.PathFor(A <IParameter> ._)).ReturnsLazily(s => ((IParameter)s.Arguments[0]).Name);
            _allVectorialParameters = new List <IParameter>(new[] { _constantParameter, _formulaParameter1, _formulaParameter2 });
            _allAdvancedParameters  = new List <IParameter>(new[] { _constantParameter, _formulaParameter1 });

            A.CallTo(() => _population.AllVectorialParameters(_entityPathResolver)).Returns(_allVectorialParameters);
            A.CallTo(() => _population.AllAdvancedParameters(_entityPathResolver)).Returns(_allAdvancedParameters);

            A.CallTo(() => _population.NumberOfItems).Returns(3);
            A.CallTo(_population).WithReturnType <IReadOnlyList <Gender> >().Returns(new[] { _male, _male, _male });
        }