示例#1
0
        protected override void Context()
        {
            base.Context();
            A.CallTo(() => _objectBaseFactory.Create <ExplicitFormula>()).Returns(new ExplicitFormula());
            _model = new Model();
            _p1    = new Parameter().WithName("p1").WithFormula(new ConstantFormula(1));
            _p1.AddTag("toto");
            _p2 = new Parameter().WithName("p2").WithFormula(new ConstantFormula(2));
            _p2.AddTag("toto");
            var root = new Container();

            _model.Root = root;
            _parameter  = new Parameter().WithName("Dynamic");
            root.Add(_parameter);
            root.Add(_p1);
            root.Add(_p2);
            root.Add(new Parameter().WithName("p3").WithFormula(new ConstantFormula(3)));

            var sumFormula = new SumFormula();

            sumFormula.Criteria = Create.Criteria(x => x.With("toto"));
            _parameter.Formula  = sumFormula;
            _parameter.AddTag("toto");
            root.Add(_parameter);
        }
 protected override void Context()
 {
     _newName    = "NEW";
     _oldName    = "OLD";
     _sumFormula = A.Fake <SumFormula>().WithId("SUMFORMULA").WithName(_oldName);
     sut         = new ChangeVariableNameCommand(_sumFormula, _newName, _oldName, A.Fake <IBuildingBlock>());
 }
示例#3
0
 private IParameter createTotalDrugMassParameter(SumFormula formula, IDimension amountDimension)
 {
     return(_context.Create <IParameter>()
            .WithName(TotalDrugmassNew)
            .WithMode(ParameterBuildMode.Property)
            .WithFormula(formula)
            .WithDimension(amountDimension)
            .WithGroup(Constants.Groups.MOBI));
 }
        public SumFormulaDTO MapFrom(SumFormula sumFormula)
        {
            var dto = Map <SumFormulaDTO>(sumFormula);

            dto.Variable         = sumFormula.Variable;
            dto.VariablePattern  = sumFormula.VariablePattern;
            dto.VariableCriteria = sumFormula.Criteria.MapAllUsing(_descriptorConditionToDTODescriptorConditionMapper);
            return(dto);
        }
        protected override void Context()
        {
            base.Context();
            var sumFormula = new SumFormula();

            sumFormula.AddObjectPath(_objectPathFactory.CreateFormulaUsablePathFrom("..", "..", "f_vas").WithAlias("f_vas_#i"));
            _validContainer.Add(new Parameter().WithName("DynamicParam").WithFormula(sumFormula));

            sut = new ValidatorForQuantities(_objectTypeResolver, _objectPathFactory);;
        }
示例#6
0
 public ChangeVariableNameCommand(SumFormula sumFormula, string newVariableName, IBuildingBlock buildingBlock) : base(buildingBlock)
 {
     _sumFormula      = sumFormula;
     _sumFormulaId    = sumFormula.Id;
     _newVariableName = newVariableName;
     _oldVariableName = sumFormula.Variable;
     ObjectType       = ObjectTypes.SumFormula;
     CommandType      = AppConstants.Commands.EditCommand;
     Description      = AppConstants.Commands.EditDescription(ObjectType, AppConstants.Captions.VariableName, _oldVariableName, newVariableName, _sumFormula.Name);
 }
 public ChangeVariableNameCommand(SumFormula changedFormula, string newVariableName, string oldVariableName, IBuildingBlock buildingBlock) : base(buildingBlock)
 {
     _changedFormula  = changedFormula;
     ChangedFormulaId = changedFormula.Id;
     NewVariableName  = newVariableName;
     OldVariableName  = oldVariableName;
     ObjectType       = ObjectTypes.SumFormula;
     CommandType      = AppConstants.Commands.EditCommand;
     Description      = AppConstants.Commands.EditDescription(ObjectType, AppConstants.Captions.VariableName, oldVariableName, newVariableName, _changedFormula.Name);
 }
        public SumFormulaDTO MapFrom(SumFormula sumFormula)
        {
            var dto = Map <SumFormulaDTO>(sumFormula);

            dto.Variable         = sumFormula.Variable;
            dto.Dimension        = sumFormula.Dimension;
            dto.VariablePattern  = sumFormula.VariablePattern;
            dto.VariableCriteria = sumFormula.Criteria.MapAllUsing(_descriptorConditionDTOMapper);
            dto.FormulaString    = sumFormula.FormulaString;
            return(dto);
        }
示例#9
0
        protected override void Context()
        {
            base.Context();
            _equalFormula1 = new SumFormula();
            _equalFormula2 = new SumFormula();
            _equalFormula1.Criteria.Add(new MatchTagCondition("A"));
            _equalFormula1.Criteria.Add(new NotMatchTagCondition("B"));
            _equalFormula2.Criteria.Add(new MatchTagCondition("A"));
            _equalFormula2.Criteria.Add(new NotMatchTagCondition("B"));

            _unequalFormula = new SumFormula();
            _unequalFormula.Criteria.Add(new NotMatchTagCondition("A"));
            _unequalFormula.Criteria.Add(new MatchTagCondition("B"));
        }
        protected override void Context()
        {
            base.Context();
            var moleculeBuilder1 = new MoleculeBuilder().WithName("Drug");
            var formula1         = new SumFormula();

            formula1.Criteria = Create.Criteria(x => x.With("A").And.Not("B"));
            formula1.Variable = "X";
            moleculeBuilder1.DefaultStartFormula = formula1;

            var moleculeBuilder2 = new MoleculeBuilder().WithName("Drug");
            var formula2         = new SumFormula();

            formula2.Criteria = Create.Criteria(x => x.With("A").And.With("B"));
            formula2.Variable = "Y";
            moleculeBuilder2.DefaultStartFormula = formula2;

            _object1 = moleculeBuilder1;
            _object2 = moleculeBuilder2;
        }
示例#11
0
 public IMoBiCommand ChangeVariableName(SumFormula formula, string newVariableName, string oldVariableName, IBuildingBlock buildingBlock)
 {
     return(new ChangeVariableNameCommand(formula, newVariableName, oldVariableName, buildingBlock).Run(_context));
 }
示例#12
0
 public override void RestoreExecutionData(IMoBiContext context)
 {
     _sumFormula = context.Get <SumFormula>(_sumFormulaId);
 }
示例#13
0
 protected override void ClearReferences()
 {
     base.ClearReferences();
     _sumFormula = null;
 }
 public bool AreEqualSumFormula(SumFormula formula, SumFormula allreadyUsedFormula)
 {
     return(allreadyUsedFormula.Criteria.Equals(formula.Criteria));
 }