protected override void Context() { _view = A.Fake <ITableParameterView>(); _parameterTask = A.Fake <IParameterTask>(); _formulaFactory = A.Fake <IFormulaFactory>(); _cloner = A.Fake <ICloner>(); _tableFormula = new TableFormula { Id = "1" }; _tableFormula.XDimension = DomainHelperForSpecs.TimeDimensionForSpecs(); _tableFormula.XDisplayUnit = _tableFormula.XDimension.BaseUnit; _tableFormula.Dimension = DomainHelperForSpecs.LengthDimensionForSpecs(); _tableFormula.YDisplayUnit = _tableFormula.Dimension.BaseUnit; _editedFormula = new TableFormula { Id = "2" }; _editedFormula.XDimension = DomainHelperForSpecs.TimeDimensionForSpecs(); _editedFormula.XDisplayUnit = _editedFormula.XDimension.BaseUnit; _editedFormula.Dimension = DomainHelperForSpecs.LengthDimensionForSpecs(); _editedFormula.YDisplayUnit = _editedFormula.Dimension.BaseUnit; A.CallTo(() => _cloner.Clone(_tableFormula)).Returns(_editedFormula); sut = new TableParametersForSpecs(_view, _parameterTask, _cloner, _formulaFactory); sut.InitializeWith(A.Fake <ICommandCollector>()); _parameter = new PKSimParameter().WithFormula(_tableFormula); }
protected override void Context() { _tableFormula = A.Fake <TableFormula>(); _newValue = true; _oldValue = _tableFormula.UseDerivedValues; sut = new EditUseDerivedValuesCommand(_tableFormula, _newValue, _oldValue, A.Fake <IBuildingBlock>()); }
protected override void Context() { base.Context(); var parameter1 = new Parameter().WithName("P"); var formula1 = new TableFormula(); formula1.UseDerivedValues = true; //#1 default is false formula1.AddPoint(10, 1); formula1.AddPoint(20, 2); //#2 point does not exist in formula2 formula1.AddPoint(50, 5); parameter1.Formula = formula1; var parameter2 = new Parameter().WithName("P"); var formula2 = new TableFormula(); formula2.UseDerivedValues = false; formula2.AddPoint(10, 2); //#3 not same Y value formula2.AddPoint(30, 3); //#4 point does not exist in formula1 formula2.AddPoint(new ValuePoint(50, 5) { RestartSolver = true }); //#5 default flag is false parameter2.Formula = formula2; _object1 = parameter1; _object2 = parameter2; }
protected override void Context() { base.Context(); sut.Edit(_parameter); A.CallTo(() => _parameterTask.SetParameterFomula(A <IParameter> .Ignored, A <IFormula> .Ignored)) .Invokes(x => _formula = x.GetArgument <TableFormula>(1)); }
protected override void Context() { base.Context(); _solubilityGroup = new ParameterAlternativeGroup { Name = CoreConstants.Groups.COMPOUND_SOLUBILITY }; _refPhParameter = DomainHelperForSpecs.ConstantParameterWithValue(10).WithName(CoreConstants.Parameters.REFERENCE_PH); _solubilityRefPh = DomainHelperForSpecs.ConstantParameterWithValue(10).WithName(CoreConstants.Parameters.SOLUBILITY_AT_REFERENCE_PH); _solubilityTable = DomainHelperForSpecs.ConstantParameterWithValue(20).WithName(CoreConstants.Parameters.SOLUBILITY_TABLE); _solubilityGainParameter = DomainHelperForSpecs.ConstantParameterWithValue(20).WithName(CoreConstants.Parameters.SOLUBILITY_GAIN_PER_CHARGE); var compound = new Compound(); _solubilityAlternativeNameParameter = A.Fake <ISolubilityAlternativeNamePresenter>(); A.CallTo(() => _applicationController.Start <ISolubilityAlternativeNamePresenter>()).Returns(_solubilityAlternativeNameParameter); A.CallTo(() => _solubilityAlternativeNameParameter.Edit(_solubilityGroup)).Returns(true); A.CallTo(() => _solubilityAlternativeNameParameter.Name).Returns("new name"); _solubilityAlternativeNameParameter.CreateAsTable = true; _newTableAlternative = new ParameterAlternative { _solubilityRefPh, _solubilityTable, _refPhParameter, _solubilityGainParameter }; A.CallTo(() => _parameterAlternativeFactory.CreateTableAlternativeFor(_solubilityGroup, CoreConstants.Parameters.SOLUBILITY_TABLE)).Returns(_newTableAlternative); compound.Add(_solubilityGroup); _solubilityTableFormula = new TableFormula(); _solubilityTable.Formula = _solubilityTableFormula; }
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)); }
protected override void Context() { sut = new TableFormulaWithXArgument(); _dimensionLength = new Dimension(new BaseDimensionRepresentation { LengthExponent = 1 }, "Length", "m"); _dimensionLength.AddUnit("cm", 0.01, 0); _dimensionpH = new Dimension(new BaseDimensionRepresentation(), "pH", ""); _tableFormula = new TableFormula().WithName(_tableObjectAlias); _tableFormula.AddPoint(1, 10); _tableFormula.AddPoint(2, 20); _tableFormula.AddPoint(3, 30); _tableObject = new Parameter().WithName(_tableObjectAlias); _tableObject.Formula = _tableFormula; _xArgumentObject = new Parameter().WithName(_xArgumentObjectAlias).WithValue(5); _parameter = new Parameter().WithFormula(sut); _container = new Container { _tableObject, _xArgumentObject, _parameter }; var tableObjectPath = new FormulaUsablePath(ObjectPath.PARENT_CONTAINER, _tableObjectAlias).WithAlias(_tableObjectAlias); sut.AddTableObjectPath(tableObjectPath); var xArgumentObjectPath = new FormulaUsablePath(ObjectPath.PARENT_CONTAINER, _xArgumentObjectAlias).WithAlias(_xArgumentObjectAlias); sut.AddXArgumentObjectPath(xArgumentObjectPath); }
protected override void Context() { base.Context(); _updateTableFormulaCommand = A.Fake <ICommand>(); _editedTableFormula = new TableFormula(); _editSolubilityParameterPresenter = A.Fake <IEditTableSolubilityParameterPresenter>(); _parameter = DomainHelperForSpecs.ConstantParameterWithValue().WithName("SOL"); A.CallTo(() => _applicationController.Start <IEditTableSolubilityParameterPresenter>()).Returns(_editSolubilityParameterPresenter); A.CallTo(() => _editSolubilityParameterPresenter.Edit(_parameter)).Returns(true); A.CallTo(() => _editSolubilityParameterPresenter.EditedFormula).Returns(_editedTableFormula); A.CallTo(() => _parameterTask.UpdateTableFormula(_parameter, _editedTableFormula)).Returns(_updateTableFormulaCommand); var solGroup = new ParameterAlternativeGroup().WithName(CoreConstants.Groups.COMPOUND_SOLUBILITY); _alternative = new ParameterAlternative().WithName("ALT1"); _alternative.Add(_parameter); solGroup.AddAlternative(_alternative); var simulation = new IndividualSimulation { Properties = new SimulationProperties() }; A.CallTo(() => _buildingBlockRepository.All <Simulation>()).Returns(new[] { simulation }); var compoundProperties = new CompoundProperties(); simulation.Properties.AddCompoundProperties(compoundProperties); compoundProperties.AddCompoundGroupSelection(new CompoundGroupSelection { AlternativeName = _alternative.Name, GroupName = solGroup.Name }); }
protected override void Context() { base.Context(); _tableFormula = new TableFormula(); _tableFormula.AddPoint(0, 0); sut.Edit(_tableFormula); }
protected override void Context() { sut = new TableFormulaWithOffset(); _dimensionLength = new Dimension(new BaseDimensionRepresentation { LengthExponent = 1 }, "Length", "m"); _dimensionLength.AddUnit("cm", 0.01, 0); _dimensionpH = new Dimension(new BaseDimensionRepresentation(), "pH", ""); _tableFormula = new TableFormula().WithName(_tableObjectAlias); _tableFormula.AddPoint(1, 10); _tableFormula.AddPoint(2, 20); _tableFormula.AddPoint(3, 30); _tableObject = new Parameter().WithName(_tableObjectAlias); _tableObject.Formula = _tableFormula; _offsetObject = new Parameter().WithName(_offsetObjectAlias).WithValue(5); _dependentObject = new MoleculeAmount { _tableObject, _offsetObject }; var tableObjectPath = new FormulaUsablePath(_tableObjectAlias).WithAlias(_tableObjectAlias); sut.AddTableObjectPath(tableObjectPath); var offsetObjectPath = new FormulaUsablePath(_offsetObjectAlias).WithAlias(_offsetObjectAlias); sut.AddOffsetObjectPath(offsetObjectPath); }
private void reportFor(TableFormula tableFormula, int noOfTabs) { foreach (var valuePoint in tableFormula.AllPoints()) { _report.AppendFormat("{0}{1}; {2} RestartSolver = {3}", tabs(noOfTabs), valuePoint.X, valuePoint.Y, valuePoint.RestartSolver); _report.AppendLine(); } }
public ValuePointDTO(IParameter parameter, TableFormula tableFormula, ValuePoint point) { _parameter = parameter; _tableFormula = tableFormula; X = convertToDisplayUnit(tableFormula.XDimension, tableFormula.XDisplayUnit, point.X); Y = convertToDisplayUnit(tableFormula.Dimension, tableFormula.YDisplayUnit, point.Y); Rules.AddRange(AllRules.All()); }
private TableFormula initializeSolubilityTableFormula(TableFormula tableFormula, IDimension xDimension, IDimension yDimension) { tableFormula.UseDerivedValues = false; return(tableFormula .WithName(PKSimConstants.UI.Solubility) .InitializedWith(PKSimConstants.UI.pH, PKSimConstants.UI.Solubility, xDimension, yDimension)); }
protected override void Context() { base.Context(); _tableFormula = new TableFormula(); _tableFormulaBuilderDTO = A.Fake <TableFormulaBuilderDTO>(); _tableFormula.AddPoint(0, 0); _tableFormula.AddPoint(1, 1); A.CallTo(() => _tableFormulaToDTOTableFormulaMapper.MapFrom(_tableFormula)).Returns(_tableFormulaBuilderDTO); }
public ICommand SetAlternativeParameterTable(IParameter parameter, TableFormula formula) { if (simulationsAreUsingAlternativeContaining(parameter)) { return(_parameterTask.UpdateTableFormula(parameter, formula)); } return(_parameterTask.UpdateTableFormulaWithoutBuildingBlockChange(parameter, formula)); }
protected override void Context() { base.Context(); _table = new TableFormula(); _table.Dimension = DomainHelperForSpecs.LengthDimensionForSpecs(); _table.XDimension = Constants.Dimension.NO_DIMENSION; _table.AddPoint(1, 10); _table.AddPoint(2, 20); }
protected override void Context() { base.Context(); _tableFormula = new TableFormula(); _tableFormula.AddPoint(1, 10); _tableFormula.AddPoint(2, 20); _formula = _tableFormula; A.CallTo(() => _dimensionMapper.ConversionFactor(_formula)).Returns(10); }
public TableFormulaExport MapFrom(TableFormula input) { var export = new TableFormulaExport(); input.AllPoints().Each(export.AddPoint); export.UseDerivedValues = input.UseDerivedValues; return(export); }
protected override async Task Context() { await base.Context(); var tableFormula = new OSPSuite.Core.Domain.Formulas.TableFormula(); _parameter.Formula = tableFormula; _snapshotTableFormula = new TableFormula(); A.CallTo(() => _tableFormulaMapper.MapToSnapshot(tableFormula)).Returns(_snapshotTableFormula); }
protected override void Context() { base.Context(); _tableFormula = new TableFormula(); _newValuePointPresenter = A.Fake <INewValuePointPresenter>(); A.CallTo(() => _applicationController.Start <INewValuePointPresenter>()).Returns(_newValuePointPresenter); _valuePoint = new ValuePoint(0, 0); A.CallTo(() => _newValuePointPresenter.GetNewValuePoint()).Returns(_valuePoint); sut.Edit(_tableFormula); }
public EditUseDerivedValuesCommand(TableFormula tableFormula, bool newValue, bool oldValue, IBuildingBlock buildingBlock) : base(buildingBlock) { _tableFormula = tableFormula; TableFormulaId = _tableFormula.Id; ObjectType = ObjectTypes.TableFormula; CommandType = AppConstants.Commands.EditCommand; NewValue = newValue; OldValue = oldValue; Description = AppConstants.Commands.SetUseDerivedValues(newValue, tableFormula); }
protected override void Context() { base.Context(); _tableFormula = new TableFormula().WithDimension(DomainHelperForSpecs.LengthDimensionForSpecs()); _tableFormula.AddPoint(1, 10); _tableFormula.AddPoint(2, 20); _tableFormula.AddPoint(3, 30); _chart = new CurveChart().WithAxes(); A.CallTo(() => _chartFactory.CreateChartFor(_tableFormula)).Returns(_chart); }
protected SetTableFormulaDisplayUnitCommand(Unit newDisplayUnit, Unit oldDisplayUnit, TableFormula tableFormula, IBuildingBlock buildingBlock) : base(buildingBlock) { _newDisplayUnit = newDisplayUnit; _oldDisplayUnit = oldDisplayUnit; _tableFormula = tableFormula; _tableFormulaId = _tableFormula.Id; ObjectType = new ObjectTypeResolver().TypeFor(tableFormula); CommandType = AppConstants.Commands.EditCommand; }
protected override void Context() { _context = A.Fake <IMoBiContext>(); _tableFormula = new TableFormula(); _tableFormula.Dimension = A.Fake <IDimension>(); _tableFormula.XDimension = A.Fake <IDimension>(); _valuePoint = new ValuePoint(1, 2); _buildingBlock = A.Fake <IBuildingBlock>(); sut = new AddValuePointCommand(_tableFormula, _valuePoint, _buildingBlock); }
protected SetValuePointCommand(TableFormula tableFormula, ValuePoint valuePoint, double newBaseValue, IBuildingBlock buildingBlock) : base(buildingBlock) { _valuePoint = valuePoint; _tableFormula = tableFormula; _tableFormulaId = _tableFormula.Id; _newBaseValue = newBaseValue; CommandType = AppConstants.Commands.EditCommand; ObjectType = ObjectTypes.ValuePoint; }
protected override void Context() { base.Context(); _editCommand = A.Fake <ICommand>(); _editTableFormulaPresenter = A.Fake <IEditTableParameterPresenter>(); _tableFormula = new TableFormula(); A.CallTo(() => _applicationController.Start <IEditTableParameterPresenter>()).Returns(_editTableFormulaPresenter); A.CallTo(() => _parameterTask.UpdateTableFormula(_parameter, _tableFormula)).Returns(_editCommand); A.CallTo(() => _editTableFormulaPresenter.Edit(_parameter)).Returns(true); A.CallTo(() => _editTableFormulaPresenter.EditedFormula).Returns(_tableFormula); }
protected override void Context() { base.Context(); _valuePoint = new ValuePoint(10, 20); _xDisplayUnit = A.Fake <Unit>(); _YDisplayUnit = A.Fake <Unit>(); _tableFormula = A.Fake <TableFormula>(); _tableFormula.XDisplayUnit = _xDisplayUnit; _tableFormula.YDisplayUnit = _YDisplayUnit; _newDisplayValue = 12; }
public TableFormulaBuilderDTO MapFrom(TableFormula tableFormula) { var dto = Map <TableFormulaBuilderDTO>(tableFormula); dto.Dimension = tableFormula.Dimension; dto.UseDerivedValues = tableFormula.UseDerivedValues; dto.XDisplayName = Constants.NameWithUnitFor(tableFormula.XName, tableFormula.XDisplayUnit); dto.YDisplayName = Constants.NameWithUnitFor(tableFormula.YName, tableFormula.YDisplayUnit); _valuePointToDTOValuePointMapperMapper.Initialise(tableFormula.XDimension, tableFormula.Dimension, tableFormula.XDisplayUnit, tableFormula.YDisplayUnit, dto); dto.ValuePoints = tableFormula.AllPoints().MapAllUsing(_valuePointToDTOValuePointMapperMapper); return(dto); }
protected override void Context() { base.Context(); _tableFormula = new TableFormula(); _tableFormula.AddPoint(0, 0); _valuePoint = new ValuePoint(1, 1); _tableFormula.AddPoint(_valuePoint); sut.Edit(_tableFormula); _removedPointDTO = new DTOValuePoint(A.Fake <TableFormulaBuilderDTO>()) { ValuePoint = _valuePoint }; }
public override void GlobalContext() { base.GlobalContext(); var solubilityAlternative = _compound.ParameterAlternativeGroup(CoreConstants.Groups.COMPOUND_SOLUBILITY).AllAlternatives.First(); var solubilityTable = solubilityAlternative.Parameter(CoreConstants.Parameters.SOLUBILITY_TABLE); var solubilityTableFormula = new TableFormula(); solubilityTableFormula.AddPoint(5, 50); solubilityTableFormula.AddPoint(12, 100); solubilityTable.Formula = solubilityTableFormula; _simulation = DomainFactoryForSpecs.CreateSimulationWith(_individual, _compound, _protocol) as IndividualSimulation; }