protected override void Because() { _dimensionFactoy = IoC.Resolve <IMoBiDimensionFactory>(); sut = new UnitDefinitionImporter(IoC.Resolve <IObjectPathFactory>(), IoC.Resolve <IObjectBaseFactory>(), _dimensionFactoy, IoC.Resolve <ASTHandler>(), A.Fake <IMoBiContext>()); //create unit "substance" _unit = new Unit(3, 1); _unit.setExponent(1); _unit.setMultiplier(1.0); _unit.setScale(0); _unit.setKind(libsbml.UNIT_KIND_MOLE); //create unitdef "substance" _unitDef = _sbmlModel.createUnitDefinition(); _unitDef.setId("substance"); _unitDef.setName("substance"); _unitDef.addUnit(_unit); //create unit "volume" _unit2 = _sbmlModel.createUnit(); _unit2.setExponent(1); _unit2.setMultiplier(1.0); _unit2.setScale(0); _unit2.setKind(libsbml.UnitKind_forName("volume")); //create unitdef "volume" _unitDef2 = _sbmlModel.createUnitDefinition(); _unitDef2.setId("volume"); _unitDef2.setName("volume"); _unitDef2.addUnit(_unit2); _sbmlModel.addUnitDefinition(_unitDef); sut.DoImport(_sbmlModel, new MoBiProject(), A.Fake <SBMLInformation>(), new MoBiMacroCommand()); _substanceDimension = _dimensionFactoy.Dimension("SBML_substance"); _volumeDimension = _dimensionFactoy.Dimension("Volume"); }
public void test_Unit_set_get() { Unit u = new Unit(2,4); assertTrue( u.getKind() == libsbml.UNIT_KIND_INVALID ); assertTrue( u.getExponent() == 1 ); assertTrue( u.getScale() == 0 ); assertTrue( u.getMultiplier() == 1.0 ); assertEquals( false, u.isSetKind() ); u.setKind(libsbml.UNIT_KIND_WATT); assertTrue( u.getKind() == libsbml.UNIT_KIND_WATT ); u.setExponent(3); assertTrue( u.getExponent() == 3 ); u.setScale(4); assertTrue( u.getScale() == 4 ); u.setMultiplier(3.2); assertTrue( u.getMultiplier() == 3.2 ); u = null; }
public void test_UnitDefinition_getUnit() { Unit mole = new Unit(2,4); Unit litre = new Unit(2,4); Unit second = new Unit(2,4); mole.setKind(libsbml.UnitKind_forName("mole")); litre.setKind(libsbml.UnitKind_forName("litre")); second.setKind(libsbml.UnitKind_forName("second")); mole.setScale(-3); litre.setExponent(-1); second.setExponent(-1); UD.addUnit(mole); UD.addUnit(litre); UD.addUnit(second); mole = null; litre = null; second = null; assertTrue( UD.getNumUnits() == 3 ); mole = UD.getUnit(0); litre = UD.getUnit(1); second = UD.getUnit(2); assertTrue( mole.getKind() == libsbml.UNIT_KIND_MOLE ); assertTrue( litre.getKind() == libsbml.UNIT_KIND_LITRE ); assertTrue( second.getKind() == libsbml.UNIT_KIND_SECOND ); assertTrue( mole.getScale() == -3 ); assertTrue( litre.getExponent() == -1 ); assertTrue( second.getExponent() == -1 ); }
public void test_L3_Unit_hasRequiredAttributes() { Unit u = new Unit(3,1); assertEquals( false, u.hasRequiredAttributes() ); u.setKind(libsbml.UNIT_KIND_MOLE); assertEquals( false, u.hasRequiredAttributes() ); u.setExponent(0); assertEquals( false, u.hasRequiredAttributes() ); u.setMultiplier(0.45); assertEquals( false, u.hasRequiredAttributes() ); u.setScale(2); assertEquals( true, u.hasRequiredAttributes() ); u = null; }