Exemplo n.º 1
0
        protected override void Context()
        {
            base.Context();
            _time = new Dimension(new BaseDimensionRepresentation {
                TimeExponent = 1
            }, "Time", "s");
            _time.AddUnit("min", 60, 0);
            _time.AddUnit("h", 3600, 0);

            _length = new Dimension(new BaseDimensionRepresentation {
                LengthExponent = 1
            }, "Length", "m");
            _length.AddUnit("mm", 0.001, 0);

            _mass = new Dimension(new BaseDimensionRepresentation {
                MassExponent = 1
            }, "Mass", "kg");
            _mass.AddUnit("mg", 0.000001, 0.0);

            _dimensionless = new Dimension(new BaseDimensionRepresentation(), "Dimensionless", " ");

            _baseGrid        = new BaseGrid("BaseGrid", _time);
            _baseGrid.Values = new[] { -1.0F, 0.0F, 2.0F };
            sut = new DataColumn("Colin", _length, _baseGrid);
        }
Exemplo n.º 2
0
        protected override void Context()
        {
            base.Context();
            _time = new Dimension(new BaseDimensionRepresentation {
                TimeExponent = 1
            }, "Time", "s");
            _time.AddUnit("min", 60, 0);
            _time.AddUnit("h", 3600, 0);

            _length = new Dimension(new BaseDimensionRepresentation {
                LengthExponent = 1
            }, "Length", "m");
            _length.AddUnit("mm", 0.001, 0.0);
            _mass = new Dimension(new BaseDimensionRepresentation {
                MassExponent = 1
            }, "Mass", "kg");
            _mass.AddUnit("mg", 0.000001, 0.0);

            _baseGrid1        = new BaseGrid("BaseGrid1", "BaseGrid1", _time);
            _baseGrid1.Values = new[] { 0, 1, 2.0F };

            _baseGrid2        = new BaseGrid("BaseGrid2", "BaseGrid2", _time);
            _baseGrid1.Values = new[] { 0, 1, 2.0F, 3.0F };

            _spA  = new MoleculeAmount().WithName("A");
            _obsB = new Observer().WithName("B");
            sut   = new DataRepository();
        }
Exemplo n.º 3
0
 protected override void Context()
 {
     base.Context();
     time = new Dimension(new BaseDimensionRepresentation {
         TimeExponent = 1
     }, "Time", "s");
     time.AddUnit("min", 60, 0);
     time.AddUnit("h", 3600, 0);
     sut = new BaseGrid("BaseGrid", time);
 }
Exemplo n.º 4
0
        protected override void Context()
        {
            _msvCreator = A.Fake <IMoleculeStartValuesCreator>();

            A.CallTo(() => _msvCreator.CreateMoleculeStartValue(A <IObjectPath> .Ignored, A <string> .Ignored, A <IDimension> .Ignored, A <Unit> ._, A <ValueOrigin> ._))
            .ReturnsLazily((IObjectPath path, string moleculeName, IDimension dimension) => new MoleculeStartValue {
                ContainerPath = path, Name = moleculeName, Dimension = dimension
            });

            _concentrationDimension = new Dimension(new BaseDimensionRepresentation(), Constants.Dimension.MOLAR_CONCENTRATION, "mol/l");

            _amountDimension = new Dimension(new BaseDimensionRepresentation(), Constants.Dimension.AMOUNT, "mol");
            _amountDimension.AddUnit("mmol", 0.001, 0);

            _timeDimension = new Dimension(new BaseDimensionRepresentation(), Constants.Dimension.TIME, "s");
            _timeDimension.Unit("s").Factor = 1.0 / 60;

            _dimensionFactory         = A.Fake <IMoBiDimensionFactory>();
            _startValuesBuildingBlock = A.Fake <IMoleculeStartValuesBuildingBlock>();

            _reactionDimensionRetriever = A.Fake <IReactionDimensionRetriever>();

            A.CallTo(() => _dimensionFactory.DimensionForUnit("mol")).Returns(_amountDimension);
            A.CallTo(() => _dimensionFactory.DimensionForUnit("mmol")).Returns(_amountDimension);
            A.CallTo(() => _dimensionFactory.DimensionForUnit("mol/l")).Returns(_concentrationDimension);
            A.CallTo(() => _dimensionFactory.DimensionForUnit("s")).Returns(_timeDimension);
            A.CallTo(() => _dimensionFactory.DimensionForUnit("")).Throws <Exception>();

            A.CallTo(() => _dimensionFactory.Dimension(Constants.Dimension.AMOUNT)).Returns(_amountDimension);
            A.CallTo(() => _dimensionFactory.Dimension(Constants.Dimension.MOLAR_CONCENTRATION)).Returns(_concentrationDimension);

            A.CallTo(() => _reactionDimensionRetriever.SelectedDimensionMode).Returns(ReactionDimensionMode.AmountBased);

            sut = new DataTableToImportQuantityDTOMapperForMolecules(_dimensionFactory, _reactionDimensionRetriever);
        }
        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 void CreateDimensionFactory()
        {
            BaseDimensionRepresentation baseRepresentation = new BaseDimensionRepresentation();

            _concentrationDimension = new Dimension(baseRepresentation, "Concentration", "mol");
            _volumeDimension        = new Dimension(baseRepresentation, "Volume", "l");
            _volumeDimension.AddUnit("ml", 0.001, 0);
            _timeDimension = new Dimension(baseRepresentation, "Time", "min");
            _timeDimension.AddUnit("s", 1 / 60.0, 0);
            _inversedTime = new Dimension(baseRepresentation, "Inversed time", "1/min");
            _becquerel    = new Dimension(baseRepresentation, "Becquerel", "1/min");

            _dimensionFactory = A.Fake <IMoBiDimensionFactory>();

            A.CallTo(() => _dimensionFactory.DimensionForUnit("mol")).Returns(_concentrationDimension);
            A.CallTo(() => _dimensionFactory.DimensionForUnit("ml")).Returns(_volumeDimension);
            A.CallTo(() => _dimensionFactory.DimensionForUnit("s")).Returns(_timeDimension);
            A.CallTo(() => _dimensionFactory.DimensionForUnit("1/min")).Returns(_inversedTime);
            A.CallTo(() => _dimensionFactory.Has(_inversedTime.Name)).Returns(true);
            A.CallTo(() => _dimensionFactory.Has(_becquerel.Name)).Returns(true);
            A.CallTo(() => _dimensionFactory.DimensionForUnit("r/h")).Returns(null);
            A.CallTo(() => _dimensionFactory.DimensionForUnit("")).Throws <Exception>();

            A.CallTo(() => _dimensionFactory.Dimension(_becquerel.Name)).Returns(_becquerel);
            A.CallTo(() => _dimensionFactory.Dimension(_inversedTime.Name)).Returns(_inversedTime);
        }
        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);
        }
Exemplo n.º 8
0
 protected override void Context()
 {
     base.Context();
     _dimension = new Dimension(new BaseDimensionRepresentation {
         TimeExponent = 1
     }, "Time", "s");
     _displayUnit  = _dimension.AddUnit("min", 2, 0);
     sut.Dimension = _dimension;
 }
Exemplo n.º 9
0
 protected override void Context()
 {
     sut = new TableFormula();
     _dimensionLength = new Dimension(new BaseDimensionRepresentation {
         LengthExponent = 1
     }, "Length", "m");
     _dimensionLength.AddUnit("cm", 0.01, 0);
     _dimensionpH = new Dimension(new BaseDimensionRepresentation(), "pH", "");
 }
Exemplo n.º 10
0
        protected override void Context()
        {
            _source = new Dimension(new BaseDimensionRepresentation(), "DrugMass", "g");
            _source.AddUnit("mg", 1000, 0);
            _source.DefaultUnit = _source.Unit("mg");
            _target             = new Dimension(new BaseDimensionRepresentation(), "Target", "mol");
            _target.AddUnit("mmol", 300, 0);
            _target.DefaultUnit = _target.Unit("mmol");
            _converter          = new TestDimensionConverterFor <IParameter>(_source, _target);

            sut = new MoBiMergedDimensionFactory();
        }
Exemplo n.º 11
0
 protected override void Context()
 {
     _mw                      = 10;
     _formulaUsable           = A.Fake <IQuantity>();
     _formulaUsable.Dimension = _source;
     _source                  = new Dimension(new BaseDimensionRepresentation(), "DrugMass", "g");
     _source.AddUnit("mg", 1000, 0);
     _source.DefaultUnit = _source.Unit("mg");
     _target             = new Dimension(new BaseDimensionRepresentation(), "Target", "mol");
     _target.AddUnit("mmol", 300, 0);
     _target.DefaultUnit = _target.Unit("mmol");
     sut = new MolWeightDimensionConverterForFormulaUsable(_source, _target);
     sut.SetRefObject(_formulaUsable);
 }
        protected override void Context()
        {
            _time = DomainHelperForSpecs.TimeDimensionForSpecs();
            _mass = new Dimension(new BaseDimensionRepresentation {
                MassExponent = 1
            }, "Mass", "kg");
            _mass.AddUnit("mg", 0.1, 0.0);
            _mass.DefaultUnit = _mass.Unit("mg");

            _baseGrid1 = new BaseGrid("BaseGrid1", _time)
            {
                Values = new float[] { 1, 2, 3 }
            };
            _dataRepository = new DataRepository("id").WithName("toto");
            sut             = new DataRepositoryExportTask();;
        }
Exemplo n.º 13
0
        protected override void Context()
        {
            _executionContext = A.Fake <IExecutionContext>();
            _favoriteTask     = A.Fake <IFavoriteTask>();
            _project          = A.Fake <IProject>();
            sut = new ParameterTask(new EntityPathResolver(new ObjectPathFactoryForSpecs()), _executionContext, _favoriteTask);
            var dimensionFactory = new DimensionFactory();

            _volumeDimension = dimensionFactory.AddDimension(new BaseDimensionRepresentation {
                LengthExponent = 3
            }, "Volume", "L");
            _volumeDimension.AddUnit("mL", 1e-3, 0);
            _parameter           = DomainHelperForSpecs.ConstantParameterWithValue(10);
            _parameter.Dimension = _volumeDimension;
            A.CallTo(() => _executionContext.BuildingBlockContaining(_parameter)).Returns(A.Fake <IPKSimBuildingBlock>());
        }
Exemplo n.º 14
0
 protected override void Context()
 {
     _mw                        = 10;
     _column                    = A.Fake <DataColumn>();
     _column.Dimension          = _source;
     _column.DataInfo           = A.Fake <DataInfo>();
     _column.DataInfo.MolWeight = _mw;
     _source                    = new Dimension(new BaseDimensionRepresentation(), "DrugMass", "g");
     _source.AddUnit("mg", 1000, 0);
     _source.DefaultUnit = _source.Unit("mg");
     _target             = new Dimension(new BaseDimensionRepresentation(), "Target", "mol");
     _target.AddUnit("mmol", 300, 0);
     _target.DefaultUnit = _target.Unit("mmol");
     sut = new ConcentrationToMolarConcentrationConverterForDataColumn(_source, _target);
     sut.SetRefObject(_column);
 }
Exemplo n.º 15
0
        protected void CreateDimensionFactory()
        {
            _concentrationDimension = new Dimension();
            _concentrationDimension.AddUnit("mol", 1.0, 0);

            _volumeDimension = new Dimension();
            _volumeDimension.AddUnit("ml", 0.001, 0);

            _timeDimension = new Dimension();
            _timeDimension.AddUnit("s", 1 / 60.0, 0);
            _dimensionFactory = A.Fake <IMoBiDimensionFactory>();

            A.CallTo(() => _dimensionFactory.DimensionForUnit("mol")).Returns(_concentrationDimension);
            A.CallTo(() => _dimensionFactory.DimensionForUnit("ml")).Returns(_volumeDimension);
            A.CallTo(() => _dimensionFactory.DimensionForUnit("s")).Returns(_timeDimension);
            A.CallTo(() => _dimensionFactory.DimensionForUnit("r/h")).Returns(null);
            A.CallTo(() => _dimensionFactory.DimensionForUnit("")).Throws <Exception>();
        }
        protected override void Context()
        {
            base.Context();
            _myDefaultUnit = A.Fake <Unit>();
            _dimension1    = new Dimension(new BaseDimensionRepresentation(), "Dim", "BASE_UNIT");
            _myDefaultUnit = _dimension1.AddUnit("UNIT", 10, 0);

            _dimension2            = A.Fake <IDimension>();
            _mergedDimensionSource = new MergedDimensionFor <Axis>(_dimension1, new[] { _dimension2 }, new List <IDimensionConverter>());
            var converter = A.Fake <IDimensionConverter>();

            A.CallTo(() => converter.CanConvertTo(_dimension1)).Returns(true);
            _mergedDimensionTarget = new MergedDimensionFor <Axis>(_dimension2, new[] { _dimension1 }, new [] { converter });

            sut.AddDisplayUnit(new DisplayUnitMap {
                Dimension = _dimension1, DisplayUnit = _myDefaultUnit
            });
        }
Exemplo n.º 17
0
 protected override void Context()
 {
     base.Context();
     _dataRepository = new DataRepository();
     _timeDimension  = new Dimension(new BaseDimensionRepresentation {
         TimeExponent = 1
     }, "Time", "min");
     _hourUnit = _timeDimension.AddUnit("h", 60, 0);
     _concentrationDimension = new Dimension(new BaseDimensionRepresentation {
         MassExponent = 1
     }, "Conc", "mg/l");
     _gramPerLiterUnit = _concentrationDimension.AddUnit("g/l", 1000, 0);
     _time             = new BaseGrid("Time", _timeDimension);
     _conc             = new DataColumn("Conc", _concentrationDimension, _time);
     _dataRepository.Add(_conc);
     A.CallTo(() => _displayUnitRetriever.PreferredUnitFor(_conc)).Returns(_gramPerLiterUnit);
     A.CallTo(() => _displayUnitRetriever.PreferredUnitFor(_time)).Returns(_hourUnit);
 }
Exemplo n.º 18
0
        protected override void Context()
        {
            base.Context();
            _dimension1 = new Dimension(new BaseDimensionRepresentation {
                TimeExponent = 1
            }, "Time", "min");
            _myDefaultUnit         = _dimension1.AddUnit("h", 60, 0);
            _topContainer          = new Container();
            _parameter             = new Parameter().WithDimension(_dimension1);
            _parameter.DisplayUnit = _dimension1.DefaultUnit;
            _topContainer.Add(_parameter);
            A.CallTo(() => _displayUnitRetriever.PreferredUnitFor(_parameter)).Returns(_myDefaultUnit);

            _moleculeStartValueBuildingBlock = new MoleculeStartValuesBuildingBlock();
            _moleculeStartValue = new MoleculeStartValue {
                Path = new ObjectPath(new[] { "A", "B", "Molecule" }), Dimension = _dimension1
            };
            _moleculeStartValue.DisplayUnit = _dimension1.DefaultUnit;
            _moleculeStartValueBuildingBlock.Add(_moleculeStartValue);
            A.CallTo(() => _displayUnitRetriever.PreferredUnitFor(_moleculeStartValue)).Returns(_myDefaultUnit);
        }
Exemplo n.º 19
0
        private static IDimensionFactory createDimensionFactory()
        {
            var dimensionFactory = new DimensionFactory();

            IDimension dimLess = dimensionFactory.AddDimension(new BaseDimensionRepresentation(), "Fraction", " ");

            dimLess.AddUnit("%", 0.01, 0.0, true);

            IDimension length = dimensionFactory.AddDimension(new BaseDimensionRepresentation {
                LengthExponent = 1
            }, "Length", "m");

            length.AddUnit("mm", 0.001, 0.0, true);
            length.AddUnit("cm", 0.01, 0);
            length.AddUnit("µm", 0.000001, 0);
            length.AddUnit("nm", 0.000000001, 0);

            IDimension amount = dimensionFactory.AddDimension(new BaseDimensionRepresentation {
                AmountExponent = 1
            }, "Amount", "mol");

            amount.AddUnit("mmol", 0.001, 0.0, true);
            amount.AddUnit("µmol", 0.000001, 0);

            IDimension mass = dimensionFactory.AddDimension(new BaseDimensionRepresentation {
                MassExponent = 1
            }, "Mass", "kg");

            mass.AddUnit("mg", 0.000001, 0.0, true);
            mass.AddUnit("g", 0.001, 0);
            mass.AddUnit("µg", 0.000000001, 0);
            mass.AddUnit("ng", 0.000000000001, 0);

            IDimension time = dimensionFactory.AddDimension(new BaseDimensionRepresentation {
                TimeExponent = 1
            }, "Time", "s");

            time.AddUnit("min", 60, 0);
            time.AddUnit("h", 3600, 0);
            time.AddUnit("day", 24 * 3600, 0);
            time.AddUnit("ms", 0.001, 0);

            IDimension velocity =
                dimensionFactory.AddDimension(new BaseDimensionRepresentation {
                LengthExponent = 1, TimeExponent = -1
            }, "Velocity", "m/s");

            velocity.AddUnit("mm/s", 0.001, 0.0, true);
            velocity.AddUnit("mm/min", 0.001 / 60.0, 0);
            velocity.AddUnit("µm/s", 0.000001, 0);

            IDimension volume = dimensionFactory.AddDimension(new BaseDimensionRepresentation {
                LengthExponent = 3
            }, "Volume", "m^3");

            volume.AddUnit("cm^3", 0.000001, 0.0, true);
            volume.AddUnit("mm^3", 0.000000001, 0);
            volume.AddUnit("l", 0.001, 0);

            IDimension specificMass =
                dimensionFactory.AddDimension(new BaseDimensionRepresentation {
                LengthExponent = -3, MassExponent = 1
            },
                                              "SpecificMass", "kg/m^3");

            specificMass.AddUnit("g/cm^3", 1000, 0.0, true);
            specificMass.AddUnit("kg/l", 1000, 0);

            dimensionFactory.AddDimension(Constants.Dimension.NO_DIMENSION);
            return(dimensionFactory);
        }