private string getDescriptionFor(UsedCalculationMethod usedCalculationMethod) { var usedMethod = _calculationMethodsRepository.GetAllCalculationMethodsFor(usedCalculationMethod.Category).FirstOrDefault(c => c.Name.Equals(usedCalculationMethod.CalculationMethod)); if (usedMethod == null) { return(string.Empty); } var description = new StringBuilder(); description.AppendLine("Defined Formulas:"); foreach (var formula in usedMethod.AllOutputFormulas()) { var descriptor = usedMethod.DescriptorFor(formula); description.AppendLine($"For Parameter:'{descriptor.ParameterName}'"); description.AppendLine($"{"Black Box Formula"}:'{formula.Name}'"); if (formula.IsExplicit()) { description.AppendLine(((ExplicitFormula)formula).FormulaString); } } description.AppendLine("Defined Parameters:"); foreach (var parameter in usedMethod.AllHelpParameters()) { description.AppendLine($"{ObjectTypes.Parameter}:'{parameter.Name}'"); addFormualDescription(parameter.Formula, description); } return(description.ToString()); }
public ChangeCalculationMethodForCategoryCommand(IMoleculeBuilder moleculeBuilder, string category, string newValue, string oldValue, IBuildingBlock buildingBlock) : base(buildingBlock) { MoleculeBuilderId = moleculeBuilder.Id; _moleculeBuilder = moleculeBuilder; _changedUsedCalculationMethod = getUsedCalulationMethod(moleculeBuilder, category, oldValue); NewCalculationMethod = newValue; OldCalculationMethod = oldValue; Category = category; }
public UsedCalculationMethodDTO MapFrom(UsedCalculationMethod usedCalculationMethod) { return(new UsedCalculationMethodDTO { Category = usedCalculationMethod.Category, CalculationMethodName = usedCalculationMethod.CalculationMethod, Description = getDescriptionFor(usedCalculationMethod) }); }
protected override void Context() { base.Context(); _moleculeBuilder = A.Fake <IMoleculeBuilder>(); _startFormula = A.Fake <IFormula>(); _moleculeBuilder.DefaultStartFormula = _startFormula; _moleculeBuilder.Description = "Description"; _moleculeBuilder.Icon = "Icon"; _moleculeBuilder.Id = "ID"; _moleculeBuilder.IsFloating = true; _moleculeBuilder.QuantityType = QuantityType.Drug; _activeTransport = A.Fake <ITransportBuilder>(); _transporterMoleculeContainer = A.Fake <TransporterMoleculeContainer>(); A.CallTo(() => _moleculeBuilder.TransporterMoleculeContainerCollection).Returns(new[] { _transporterMoleculeContainer }); A.CallTo(() => _transporterMoleculeContainer.ActiveTransportRealizations).Returns(new[] { _activeTransport }); _parameter = A.Fake <IParameter>(); A.CallTo(() => _moleculeBuilder.Parameters).Returns(new[] { _parameter }); _calculationMethod = A.Fake <UsedCalculationMethod>(); A.CallTo(() => _moleculeBuilder.UsedCalculationMethods).Returns(new[] { _calculationMethod }); _interactionContainer = A.Fake <InteractionContainer>(); A.CallTo(() => _moleculeBuilder.InteractionContainerCollection).Returns(new[] { _interactionContainer }); }
public override void RestoreExecutionData(IMoBiContext context) { base.RestoreExecutionData(context); _moleculeBuilder = context.Get <IMoleculeBuilder>(MoleculeBuilderId); _changedUsedCalculationMethod = getUsedCalulationMethod(_moleculeBuilder, Category, NewCalculationMethod); }
protected override void ClearReferences() { base.ClearReferences(); _moleculeBuilder = null; _changedUsedCalculationMethod = null; }