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(); 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() { 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); }
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() { base.Context(); _tableFormula = new TableFormula(); _tableFormula.AddPoint(0, 0); _tableFormula.AddPoint(1, 1); sut.Edit(_tableFormula); }
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(); _tableFormulaBuilderDTO = A.Fake <TableFormulaBuilderDTO>(); _tableFormula.AddPoint(0, 0); _tableFormula.AddPoint(1, 1); A.CallTo(() => _tableFormulaToDTOTableFormulaMapper.MapFrom(_tableFormula)).Returns(_tableFormulaBuilderDTO); }
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); }
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); }
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; }
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 }; }
protected override void Context() { base.Context(); _input = new TableFormula(); _p1 = new ValuePoint(0, 0); _p2 = new ValuePoint(1, 1); _p3 = new ValuePoint(2, 2); _input.UseDerivedValues = false; _input.AddPoint(_p1); _input.AddPoint(_p2); _input.AddPoint(_p3); }
protected override void Context() { base.Context(); _cloneManager = A.Fake <ICloneManager>(); sut.ResolveObjectPathsFor(_parameter); _xArgumentObject.Value = 1; _parameter.Value.ShouldBeEqualTo(10); _anotherTableFormula = new TableFormula(); _anotherTableFormula.AddPoint(1, 100); _anotherTableFormula.AddPoint(2, 200); _anotherTableFormula.AddPoint(3, 300); }
protected override void Context() { _context = A.Fake <IMoBiContext>(); _newValue = 10; _tableFormulaId = "FormulaId"; _valuePoint = new ValuePoint(1, 11); _tableFormula = new TableFormula { Id = _tableFormulaId, Dimension = DomainHelperForSpecs.AmountDimension, XDimension = DomainHelperForSpecs.TimeDimension }; _tableFormula.AddPoint(_valuePoint); _tableFormula.AddPoint(2, 22); _buildingBlock = A.Fake <IBuildingBlock>(); }
protected override void Context() { base.Context(); _equalFormula1 = new TableFormula(); _equalFormula2 = new TableFormula(); _equalFormula1.AddPoint(1, 2); _equalFormula1.AddPoint(2, 3); _equalFormula2.AddPoint(1, 2); _equalFormula2.AddPoint(2, 3); _unequalFormula = new TableFormula(); _unequalFormula.AddPoint(3, 4); _unequalFormula.AddPoint(4, 5); }
protected override void Context() { _context = A.Fake <IMoBiContext>(); _tableFormula = new TableFormula(); _valuePoint = new ValuePoint(1, 2); _tableFormula.AddPoint(_valuePoint); _tableFormula.Dimension = A.Fake <IDimension>(); _tableFormula.XDimension = A.Fake <IDimension>(); _buildingBlock = A.Fake <IBuildingBlock>(); sut = new RemoveValuePointFromTableFormulaCommand(_tableFormula, _valuePoint, _buildingBlock); }
public void TestSerialization() { TableFormula x1 = CreateObject <TableFormula>().WithName("Fortunato").WithDimension(DimensionLength); x1.XName = "Great X name"; x1.YName = "Great Y name"; x1.XDimension = DimensionMolarConcentration; x1.XDisplayUnit = DimensionMolarConcentration.DefaultUnit; x1.AddPoint(1, 10); x1.AddPoint(2, 20); x1.AddPoint(new ValuePoint(3, 30) { RestartSolver = true }); x1.UseDerivedValues = false; TableFormula x2 = SerializeAndDeserialize(x1); x2.ResolveObjectPathsFor(P); AssertForSpecs.AreEqualTableFormula(x2, x1); }
protected override void Context() { _buildingBlock = A.Fake <IBuildingBlock>(); _newUnit = DomainHelperForSpecs.TimeDimension.Unit("seconds"); _oldUnit = DomainHelperForSpecs.TimeDimension.Unit("min"); _tableFormula = new TableFormula { XDimension = DomainHelperForSpecs.TimeDimension }; _xValueInMinutes = 1.0; _tableFormula.AddPoint(new ValuePoint(_xValueInMinutes, 1.0)); _context = A.Fake <IMoBiContext>(); A.CallTo(() => _context.Get <TableFormula>(_tableFormula.Id)).Returns(_tableFormula); _tableFormula.XDisplayUnit = _oldUnit; sut = new SetTableFormulaXDisplayUnitCommand(_newUnit, _oldUnit, _tableFormula, _buildingBlock); }
protected override void Context() { _buildingBlock = A.Fake <IBuildingBlock>(); _newUnit = DomainHelperForSpecs.AmountDimension.Unit("µmol"); _oldUnit = DomainHelperForSpecs.AmountDimension.Unit("mmol"); _tableFormula = new TableFormula { Dimension = DomainHelperForSpecs.AmountDimension }; _yvalueInMilliMol = 1.0; _tableFormula.AddPoint(new ValuePoint(1.0, _yvalueInMilliMol)); _context = A.Fake <IMoBiContext>(); A.CallTo(() => _context.Get <TableFormula>(_tableFormula.Id)).Returns(_tableFormula); _tableFormula.YDisplayUnit = _oldUnit; sut = new SetTableFormulaYDisplayUnitCommand(_newUnit, _oldUnit, _tableFormula, _buildingBlock); }
protected override void Context() { _buildingBlock = A.Fake <IBuildingBlock>(); _tableFormula = new TableFormula() { Dimension = DomainHelperForSpecs.AmountDimension, XDimension = DomainHelperForSpecs.TimeDimension }; _valuePoint = new ValuePoint(1.0, 1.0) { RestartSolver = false }; _newRestartSolverValue = true; _tableFormula.AddPoint(_valuePoint); _context = A.Fake <IMoBiContext>(); A.CallTo(() => _context.Get <TableFormula>(_tableFormula.Id)).Returns(_tableFormula); sut = new SetRestartSolverInValuePointCommand(_tableFormula, _valuePoint, _newRestartSolverValue, _buildingBlock); }
private void addZeroPointToTable(TableFormula table) { //always add 0 0 to Formulation Table table.AddPoint(0, 0); }