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 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);
        }
        public IFormulaUsablePath CreateFormulaUsablePathFrom(IEnumerable <string> entries)
        {
            var newFormulaUseablePath = new FormulaUsablePath();

            entries.Each(newFormulaUseablePath.Add);
            newFormulaUseablePath.Alias = createAliasFrom(entries.Last());
            return(newFormulaUseablePath);
        }
        public IFormulaUsablePath CreateAbsoluteFormulaUsablePath(IFormulaUsable entity)
        {
            var newFormulaUseablePath = new FormulaUsablePath();

            addPathEntry(entity, newFormulaUseablePath);
            newFormulaUseablePath.Alias     = createAliasFrom(entity.Name);
            newFormulaUseablePath.Dimension = entity.Dimension;
            return(newFormulaUseablePath);
        }
        public IFormulaUsablePath CreateRelativeFormulaUsablePath(IEntity usingObject, IFormulaUsable usedObject)
        {
            var newFormulaUseablePath = new FormulaUsablePath();

            addRelativePathEntries(usingObject, usedObject, newFormulaUseablePath);
            newFormulaUseablePath.Alias     = createAliasFrom(usedObject.Name);
            newFormulaUseablePath.Dimension = usedObject.Dimension;
            return(newFormulaUseablePath);
        }
Beispiel #6
0
 protected override void Context()
 {
     base.Context();
     _rootContainer     = new Container().WithName("ROOT");
     _moleculeContainer = new Container().WithName("CYP").WithContainerType(ContainerType.Molecule);
     _parameter         = DomainHelperForSpecs.ConstantParameterWithValue(4).WithName("P").WithParentContainer(_moleculeContainer);
     _parameter.Formula = new ExplicitFormula();
     _objectPath        = new FormulaUsablePath("SIM", ObjectPathKeywords.MOLECULE, "test");
     _parameter.Formula.AddObjectPath(_objectPath);
 }
Beispiel #7
0
        protected override void Context()
        {
            base.Context();
            _objPathMolecule   = new FormulaUsablePath(new[] { ObjectPathKeywords.MOLECULE });
            _moleculeName      = "REPLACED";
            _moleculeContainer = new Container().WithName(_modelName);
            var moleculeParameter = new Parameter().WithFormula(A.Fake <IFormula>());

            _moleculeContainer.Add(moleculeParameter);
            A.CallTo(() => moleculeParameter.Formula.ObjectPaths).Returns(new[] { _objPathFirstNeighbor, _objPathMolecule, _objPathOrganism });
        }
Beispiel #8
0
 public bool Equals(FormulaUsablePath other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(base.Equals(other) && string.Equals(Alias, other.Alias) && Equals(Dimension, other.Dimension));
 }
Beispiel #9
0
        public override Task <IFormulaUsablePath> MapToModel(SnapshotFormulaUsablePath snapshot)
        {
            IFormulaUsablePath formulaUsablePath;

            if (snapshot.Alias == Constants.TIME)
            {
                formulaUsablePath = new TimePath();
            }
            else
            {
                formulaUsablePath = new OSPSuite.Core.Domain.FormulaUsablePath(snapshot.Path.ToPathArray())
                {
                    Alias     = snapshot.Alias,
                    Dimension = _dimensionRepository.DimensionByName(snapshot.Dimension),
                };
            }

            return(Task.FromResult(formulaUsablePath));
        }
 protected override void Context()
 {
     base.Context();
     _buildConfiguration = A.Fake <IBuildConfiguration>();
     _processBuilder     = new ReactionBuilder();
     _processBuilder.CreateProcessRateParameter = true;
     _kinetic            = new ExplicitFormula("(A+B)*fu/BW");
     _formulaUsablePathA = new FormulaUsablePath(new[] { ObjectPath.PARENT_CONTAINER, "A" }).WithAlias("A");
     _kinetic.AddObjectPath(_formulaUsablePathA);
     _formulaUsablePathB = new FormulaUsablePath(new[] { "B" }).WithAlias("B");
     _kinetic.AddObjectPath(_formulaUsablePathB);
     _formulaUsablePathFU = new FormulaUsablePath(new[] { ObjectPathKeywords.MOLECULE, "fu" }).WithAlias("fu");
     _kinetic.AddObjectPath(_formulaUsablePathFU);
     _formulaUsablePathBW = new FormulaUsablePath(new[] { "Organism", "BW" }).WithAlias("BW");
     _kinetic.AddObjectPath(_formulaUsablePathBW);
     _processBuilder.CreateProcessRateParameter      = true;
     _processBuilder.ProcessRateParameterPersistable = true;
     A.CallTo(() => _formulaMapper.MapFrom(_kinetic, _buildConfiguration)).Returns(_kinetic);
     _processBuilder.Name    = "Reaction";
     _processBuilder.Formula = _kinetic;
     _processRateParameter   = new Parameter();
     A.CallTo(() => _objectBaseFactory.Create <IParameter>()).Returns(_processRateParameter);
 }