public void AddSchemaItemTo(SchemaDTO schemaDTO, SchemaItemDTO schemaItemDTOToDupicate) { var schema = SchemaFrom(schemaDTO); var schemaItem = SchemaItemFrom(schemaItemDTOToDupicate); AddCommand(_protocolTask.AddSchemaItemTo(schema, schemaItem)); }
public SchemaItemDTO MapFrom(SchemaItem schemaItem) { var schemaItemDTO = new SchemaItemDTO(schemaItem); schemaItemDTO.DoseParameter = _parameterDTOMapper.MapFrom(schemaItem.Dose, schemaItemDTO, x => x.Dose, x => x.DoseParameter); schemaItemDTO.StartTimeParameter = _parameterDTOMapper.MapFrom(schemaItem.StartTime, schemaItemDTO, x => x.StartTime, x => x.StartTimeParameter); return(schemaItemDTO); }
public void RemoveSchemaItem(SchemaItemDTO schemaItemDTOToDelete) { var schemaDTO = schemaItemDTOToDelete.ParentSchema; var schema = SchemaFrom(schemaDTO); var schemaItemToDelete = SchemaItemFrom(schemaItemDTOToDelete); AddCommand(_protocolTask.RemoveSchemaItemFrom(schemaItemToDelete, schema)); }
public bool HasDynamicParameters(SchemaItemDTO schemaItemDTO) { if (schemaItemDTO == null) { return(false); } return(_protocolTask.AllDynamicParametersFor(SchemaItemFrom(schemaItemDTO)).Any()); }
public bool HasDynamicContent(SchemaItemDTO schemaItemDTO) { if (schemaItemDTO == null) { return(false); } return(schemaItemDTO.IsUserDefined || _protocolTask.AllDynamicParametersFor(SchemaItemFrom(schemaItemDTO)).Any()); }
public IList DynamicParametersFor(SchemaItemDTO schemaItemDTO) { if (schemaItemDTO == null) { return(new List <IParameterDTO>()); } return(_protocolTask.AllDynamicParametersFor(SchemaItemFrom(schemaItemDTO)).MapAllUsing(_parameterDTOMapper).ToList()); }
protected override void Context() { base.Context(); _schemaItem = new SchemaItem { ApplicationType = ApplicationTypes.UserDefined, TargetOrgan = "Liv", TargetCompartment = "Cell" }; _schemaItemDTO = new SchemaItemDTO(_schemaItem); }
private string schemaItemAggregation(SchemaItemDTO dto) { var key = $"{dto.ApplicationType}|{dto.StartTime}|{dto.DoseParameter.DisplayUnit}"; if (dto.NeedsFormulation) { key = $"{key}|{dto.FormulationKey}"; } return(key); }
private string schemaItemAggregation(SchemaItemDTO dto) { var key = string.Format("{0}|{1}|{2}", dto.ApplicationType, dto.StartTime, dto.DoseParameter.DisplayUnit); if (dto.NeedsFormulation) { key = string.Format("{0}|{1}", key, dto.FormulationKey); } return(key); }
private RepositoryItem formulationRepository(SchemaItemDTO schemaItemDTO) { if (_formulationRepository == null) { _formulationRepository = new RepositoryItemMRUEdit(); _presenter.AllFormulationKeys().Each(key => _formulationRepository.Items.Add(key)); } _formulationRepository.ReadOnly = !schemaItemDTO.NeedsFormulation; _formulationRepository.Enabled = schemaItemDTO.NeedsFormulation; return(_formulationRepository); }
protected override void Context() { base.Context(); _schemaDTO = A.Fake <SchemaDTO>(); _schemaItem = A.Fake <SchemaItem>(); _schema = A.Fake <Schema>(); _allSchemas.Add(_schema); A.CallTo(() => _schemaDTO.Schema).Returns(_schema); sut.EditProtocol(_advancedProtocol); A.CallTo(() => _schema.SchemaItems).Returns(new[] { _schemaItem }); _schemaItemDTOToDuplicate = new SchemaItemDTO(_schemaItem); }
public string DescriptionFor(SchemaItemDTO schemaItemDTO) { if (schemaItemDTO == null) { return(string.Empty); } return (PKSimConstants.UI.SchemaItemDescription( schemaItemDTO.ApplicationType.DisplayName, schemaItemDTO.FormulationKey, ParameterMessages.DisplayValueFor(schemaItemDTO.DoseParameter.Parameter), ParameterMessages.DisplayValueFor(schemaItemDTO.StartTimeParameter.Parameter))); }
protected override void Context() { base.Context(); _schema = A.Fake <Schema>(); _schemaDTO = A.Fake <SchemaDTO>(); _schemaItemDTO = DomainHelperForSpecs.SchemaItemDTO(ApplicationTypes.Intravenous); _schemaItem = _schemaItemDTO.SchemaItem; A.CallTo(() => _schemaDTO.Schema).Returns(_schema); A.CallTo(() => _advancedProtocol.Contains(_schema)).Returns(true); _allSchemas.Add(_schema); A.CallTo(() => _schemaDTOMapper.MapFrom(_schema)).Returns(_schemaDTO); A.CallTo(() => _schemaItemDTOMapper.MapFrom(_schemaItem)).Returns(_schemaItemDTO); sut.EditProtocol(_advancedProtocol); }
protected override void Context() { base.Context(); _schemaDTO = A.Fake <SchemaDTO>(); _schemaItem = A.Fake <SchemaItem>(); _schema = A.Fake <Schema>(); _deleteSchemaItemCommand = A.Fake <IPKSimCommand>(); _schemaItemDTOToDelete = DomainHelperForSpecs.SchemaItemDTO(ApplicationTypes.Intravenous); _schemaItemDTOToDelete.ParentSchema = _schemaDTO; _schemaItemToDelete = _schemaItemDTOToDelete.SchemaItem; A.CallTo(() => _schemaDTO.Schema).Returns(_schema); A.CallTo(() => _schema.SchemaItems).Returns(new[] { _schemaItem, _schemaItemToDelete }); A.CallTo(() => _protocolTask.RemoveSchemaItemFrom(_schemaItemToDelete, _schema)).Returns(_deleteSchemaItemCommand); }
public static SchemaItemDTO SchemaItemDTO(ApplicationType applicationType, Unit doseDisplayUnit = null, double?doseValue = null, double?startTimeValue = null) { var schemaItemDTO = new SchemaItemDTO(new SchemaItem { ApplicationType = applicationType }); schemaItemDTO.DoseParameter = new ParameterDTO(ConstantParameterWithValue(doseValue.GetValueOrDefault(1)).WithName(CoreConstants.Parameter.INPUT_DOSE)); schemaItemDTO.StartTimeParameter = new ParameterDTO(ConstantParameterWithValue(startTimeValue.GetValueOrDefault(0)).WithName(Constants.Parameters.START_TIME)); if (doseDisplayUnit != null) { schemaItemDTO.DoseParameter.Parameter.DisplayUnit = doseDisplayUnit; } return(schemaItemDTO); }
public IList DynamicContentFor(SchemaItemDTO schemaItemDTO) { if (schemaItemDTO == null) { return(new List <IParameterDTO>()); } if (schemaItemDTO.IsUserDefined) { return new List <SchemaItemTargetDTO> { new SchemaItemTargetDTO(PKSimConstants.UI.TargetOrgan, schemaItemDTO, x => x.TargetOrgan), new SchemaItemTargetDTO(PKSimConstants.UI.TargetCompartment, schemaItemDTO, x => x.TargetCompartment), } } ; return(_protocolTask.AllDynamicParametersFor(SchemaItemFrom(schemaItemDTO)).MapAllUsing(_parameterDTOMapper).ToList()); }
private void setApplicationType(SchemaItemDTO dto, ApplicationType newApplicationType) { OnEvent(() => _presenter.SetApplicationType(dto, newApplicationType)); }
public void should_return_true_if_the_schema_item_represented_a_user_defined_application() { var schemaItemDTO = new SchemaItemDTO(_userDefinedSchemaItem); sut.HasDynamicContent(schemaItemDTO).ShouldBeTrue(); }
private void updateApplicationParameter(GridViewBinder <SchemaItemDTO> binder, SchemaItemDTO dto) { refreshMasterRow(binder.GridView, binder.RowHandleFor(dto)); }
protected override void Because() { _schemaItemDTO = sut.MapFrom(_schemaItem); }
private void schemaItemButtonRepositoryButtonClick(object sender, ButtonPressedEventArgs e, SchemaItemDTO schemaItemDTO) { var editor = (ButtonEdit)sender; var buttonIndex = editor.Properties.Buttons.IndexOf(e.Button); if (buttonIndex == 0) { _presenter.AddSchemaItemTo(schemaItemDTO.ParentSchema, schemaItemDTO); } else { //before removing: collapse int rowHandle = _gridProtocolBinder.RowHandleFor(schemaItemDTO.ParentSchema); refreshMasterRow(_gridProtocolBinder.GridView, rowHandle); _presenter.RemoveSchemaItem(schemaItemDTO); _gridProtocolBinder.GridView.ExpandMasterRow(rowHandle); } }
public void SetFormulationType(SchemaItemDTO schemaItemDTO, string newFormulationType) { AddCommand(_protocolTask.SetFormulationType(SchemaItemFrom(schemaItemDTO), newFormulationType)); }
protected SchemaItem SchemaItemFrom(SchemaItemDTO schemaItemDTO) { return(schemaItemDTO.SchemaItem); }
public void should_return_true_if_the_schema_item_has_dynamic_parameters() { var schemaItemDTO = new SchemaItemDTO(_schemaItemWithParameters); sut.HasDynamicContent(schemaItemDTO).ShouldBeTrue(); }
public void SetApplicationType(SchemaItemDTO schemaItemDTO, ApplicationType newApplicationType) { AddCommand(_protocolTask.SetApplicationType(SchemaItemFrom(schemaItemDTO), newApplicationType)); }
public void should_return_false_if_the_schema_item_does_not_have_dynamic_parameters() { var schemaItemDTO = new SchemaItemDTO(_schemaItemWithoutParameters); sut.HasDynamicContent(schemaItemDTO).ShouldBeFalse(); }
protected override void Context() { base.Context(); _schemaItemDTO = new SchemaItemDTO(_schemaItem); }
private static string createDataGroupingNameFor(bool hasOnlyOneDoseUnit, Compound compound, SchemaItemDTO schemaItemDTO) { var baseName = schemaItemDTO.DisplayName; if (!string.IsNullOrEmpty(compound.Name)) { baseName = CoreConstants.CompositeNameFor(baseName, compound.Name); } return(hasOnlyOneDoseUnit ? baseName : Constants.NameWithUnitFor(baseName, schemaItemDTO.DoseParameter.DisplayUnit)); }
public void SetApplicationType(SchemaItemDTO schemaItemDTO, ApplicationType newApplicationType) { SetApplicationType(newApplicationType, SchemaItemFrom(schemaItemDTO)); }
protected SchemaItem SchemaItemFrom(SchemaItemDTO schemaItemDTO) => schemaItemDTO.SchemaItem;