protected override void Context()
        {
            _view = A.Fake <IMultiParameterEditView>();
            _scaleParametersPresenter   = A.Fake <IScaleParametersPresenter>();
            _editParameterPresenterTask = A.Fake <IEditParameterPresenterTask>();
            _parameterTask      = A.Fake <IParameterTask>();
            _parameterDTOMapper = A.Fake <IParameterToParameterDTOMapper>();
            _contextMenuFactory = A.Fake <IParameterContextMenuFactory>();
            _withIdRepository   = A.Fake <IWithIdRepository>();

            _parameter1    = DomainHelperForSpecs.ConstantParameterWithValue(1).WithName("P1");
            _parameter2    = DomainHelperForSpecs.ConstantParameterWithValue(1).WithName("P1");
            _parameter3    = DomainHelperForSpecs.ConstantParameterWithValue(1).WithName("P2");
            _parameterDTO1 = new ParameterDTO(_parameter1);
            _parameterDTO2 = new ParameterDTO(_parameter2);
            _parameterDTO3 = new ParameterDTO(_parameter3);
            _parameters    = new List <IParameter> {
                _parameter1, _parameter2, _parameter3
            };
            A.CallTo(() => _parameterDTOMapper.MapFrom(_parameter1)).Returns(_parameterDTO1);
            A.CallTo(() => _parameterDTOMapper.MapFrom(_parameter2)).Returns(_parameterDTO2);
            A.CallTo(() => _parameterDTOMapper.MapFrom(_parameter3)).Returns(_parameterDTO3);


            sut = new SimulationCompoundParametersPresenter(_view, _scaleParametersPresenter, _editParameterPresenterTask, _parameterTask, _parameterDTOMapper, _contextMenuFactory, _withIdRepository);
        }
        protected override void Context()
        {
            _view = A.Fake <IMultiParameterEditView>();
            _scaleParameterPresenter    = A.Fake <IScaleParametersPresenter>();
            _parameterTask              = A.Fake <IParameterTask>();
            _contextMenuFactory         = A.Fake <IParameterContextMenuFactory>();
            _favoriteRepository         = A.Fake <IFavoriteRepository>();
            _parameterDTOMapper         = A.Fake <IParameterToParameterDTOMapper>();
            _editParameterPresenterTask = A.Fake <IEditParameterPresenterTask>();
            sut         = new FavoriteParametersPresenter(_view, _scaleParameterPresenter, _editParameterPresenterTask, _parameterTask, _parameterDTOMapper, _contextMenuFactory, _favoriteRepository);
            _par1       = new PKSimParameter().WithName("par1");
            _par2       = new PKSimParameter().WithName("par2");
            _par3       = new PKSimParameter().WithName("par3");
            _parameters = new List <IParameter> {
                _par1, _par2, _par3
            };
            var pathCache = new PathCache <IParameter>(A.Fake <IEntityPathResolver>())
            {
                { "par1", _par1 }, { "par2", _par2 }, { "par3", _par3 }
            };

            A.CallTo(() => _parameterTask.PathCacheFor(_parameters)).Returns(pathCache);
            _par1DTO = new ParameterDTO(_par1);
            _par2DTO = new ParameterDTO(_par2);
            A.CallTo(() => _parameterDTOMapper.MapFrom(_par1)).Returns(_par1DTO);
            A.CallTo(() => _parameterDTOMapper.MapFrom(_par2)).Returns(_par2DTO);
            _favorites = new List <string>();
            A.CallTo(() => _favoriteRepository.All()).Returns(_favorites);
        }
        public MolWeightDTO MapFrom(IEnumerable <IParameter> compoundParameters)
        {
            var allCompoundParameters = compoundParameters.ToList();

            return(new MolWeightDTO
            {
                MolWeightParameter = _parameterDTOMapper.MapFrom(allCompoundParameters.FindByName(Constants.Parameters.MOL_WEIGHT)),
                MolWeightEffParameter = _parameterDTOMapper.MapFrom(allCompoundParameters.FindByName(CoreConstants.Parameter.MolWeightEff)),
                HasHalogensParameter = _parameterDTOMapper.MapFrom(allCompoundParameters.FindByName(CoreConstants.Parameter.HAS_HALOGENS)),
            });
        }
        public ParameterScalingDTO MapFrom(ParameterScaling parameterScaling)
        {
            var parameterScalingDTO = new ParameterScalingDTO(parameterScaling)
            {
                ParameterFullPathDisplay = _fullPathDisplayResolver.FullPathFor(parameterScaling.SourceParameter),
                SourceParameter          = _parameterDTOMapper.MapFrom(parameterScaling.SourceParameter),
                TargetParameter          = _parameterDTOMapper.MapFrom(parameterScaling.TargetParameter),
                ScalingMethod            = parameterScaling.ScalingMethod
            };

            return(parameterScalingDTO);
        }
 public SimpleProtocolDTO MapFrom(SimpleProtocol simpleProtocol)
 {
     return(new SimpleProtocolDTO(simpleProtocol)
     {
         Dose = _parameterDTOMapper.MapFrom(simpleProtocol.Dose),
         EndTime = _parameterDTOMapper.MapFrom(simpleProtocol.EndTimeParameter),
         ApplicationType = simpleProtocol.ApplicationType,
         DosingInterval = simpleProtocol.DosingInterval,
         TargetOrgan = simpleProtocol.TargetOrgan,
         TargetCompartment = simpleProtocol.TargetCompartment
     });
 }
Example #6
0
        private IParameterDTO updateGlobalParameter(List <IParameter> allParameters, string globalParameterName)
        {
            var globalParameter = allParameters.FindByName(globalParameterName);

            allParameters.Remove(globalParameter);
            return(_parameterMapper.MapFrom(globalParameter));
        }
 public void ConfigureScaling(Individual sourceIndividual, Individual targetIndividual)
 {
     ScalingPerformed      = false;
     Weight                = _parameterDTOMapper.MapFrom(targetIndividual.WeightParameter);
     _parameterScalingList = _individualScalingTask.AllParameterScalingsFrom(sourceIndividual, targetIndividual).ToList();
     _needWeight           = weightShouldBeDisplayed();
     refreshView();
 }
Example #8
0
        public ParameterDTO MapFrom <TPropertyType, TParameterContainerDTO>(IParameter parameter, TParameterContainerDTO parameterContainerDTO,
                                                                            Expression <Func <TParameterContainerDTO, TPropertyType> > parameterValue,
                                                                            Func <TParameterContainerDTO, IParameterDTO> parameterDelegate) where TParameterContainerDTO : IValidatableDTO
        {
            var parameterDTO = _parameterMapper.MapFrom(parameter).DowncastTo <ParameterDTO>();

            parameterDTO.ValueChanged += (o, e) => parameterContainerDTO.AddNotifiableFor(parameterValue);
            parameterContainerDTO.Rules.Add(ParameterDTORules.ParameterIsValid(parameterValue, parameterDelegate));
            return(parameterDTO);
        }
        public SimulationParameterSelectionDTO MapFrom(ISimulation simulation, IParameter parameter)
        {
            var quantitySelectionDTO = _quantitySelectionDTOMapper.MapFrom(parameter);
            var displayString        = _quantityDisplayPathMapper.DisplayPathAsStringFor(parameter, addSimulationName: true);

            UpdateContainerDisplayNameAndIconsIfEmpty(quantitySelectionDTO, parameter);
            return(new SimulationParameterSelectionDTO(simulation, quantitySelectionDTO, displayString)
            {
                IsFavorite = _favoriteRepository.All().Contains(quantitySelectionDTO.QuantityPath),
                ValueParameter = _parameterDTOMapper.MapFrom(parameter)
            });
        }
Example #10
0
        protected override void Context()
        {
            _view = A.Fake <IMultiParameterEditView>();
            _scaleParameterPresenter     = A.Fake <IScaleParametersPresenter>();
            _parameterTask               = A.Fake <IParameterTask>();
            _editParameterTask           = A.Fake <IEditParameterPresenterTask>();
            _parameterDTOMapper          = A.Fake <IParameterToParameterDTOMapper>();
            _parameterContextMenuFactory = A.Fake <IParameterContextMenuFactory>();

            sut = new UserDefinedParametersPresenter(_view, _scaleParameterPresenter, _editParameterTask, _parameterTask, _parameterDTOMapper, _parameterContextMenuFactory);

            A.CallTo(() => _parameterDTOMapper.MapFrom(A <IParameter> ._)).ReturnsLazily(x => new ParameterDTO(x.GetArgument <IParameter>(0)));
        }
Example #11
0
        protected override void FillUpReport(IParameter parameter, ReportPart reportPart)
        {
            var parameterDTO = _parameterMapper.MapFrom(parameter);
            var displayName  = _representationInfoRepository.DisplayNameFor(parameter);
            var displayValue = ParameterMessages.DisplayValueFor(parameter);

            if (parameterDTO.ListOfValues.Any())
            {
                displayValue = parameterDTO.ListOfValues[parameter.Value];
            }

            reportPart.AddToContent(PKSimConstants.UI.ReportIs(displayName, displayValue));
        }
Example #12
0
        public void EditParameters(IEnumerable <IParameter> parameters)
        {
            base.Edit(parameters);
            AllParametersDTO.Clear();
            foreach (var parameter in _visibleParameters)
            {
                var parameterDTO = _mapper.MapFrom(parameter).DowncastTo <ParameterDTO>();

                var groupInfo = _representationInfoRepository.InfoFor(RepresentationObjectType.GROUP, parameter.GroupName);
                parameterDTO.PathElements[0] = groupInfo.ToPathElement();
                AllParametersDTO.Add(parameterDTO);
            }

            var allGrouping = AllParametersDTO.Select(x => x.PathElements[0].DisplayName).Distinct();

            _view.GroupingVisible = (allGrouping.Count() > 1);
            _view.BindTo(AllParametersDTO);
        }
 protected override void Context()
 {
     _parameterTask              = A.Fake <IParameterTask>();
     _view                       = A.Fake <IMultiParameterEditView>();
     _scaleParameterPresenter    = A.Fake <IScaleParametersPresenter>();
     _mapper                     = A.Fake <IParameterToParameterDTOMapper>();
     _editParameterPresenterTask = A.Fake <IEditParameterPresenterTask>();
     _parameter                  = DomainHelperForSpecs.ConstantParameterWithValue(5);
     _parameterDTO               = new ParameterDTO(_parameter);
     _commandRegister            = A.Fake <ICommandCollector>();
     _contextMenuFactory         = A.Fake <IParameterContextMenuFactory>();
     A.CallTo(() => _scaleParameterPresenter.View).Returns(A.Fake <IScaleParametersView>());
     A.CallTo(() => _mapper.MapFrom(_parameter)).Returns(_parameterDTO);
     sut = new MultiParameterEditPresenter(_view, _scaleParameterPresenter, _editParameterPresenterTask, _parameterTask, _mapper, _contextMenuFactory);
     sut.StatusChanged += (o, e) => { _eventWasRaised = true; };
     sut.InitializeWith(_commandRegister);
     _parameterList = new List <IParameter>();
 }
        protected override void Context()
        {
            _view = A.Fake <IEditParameterView>();
            _editFormulaPresenter    = A.Fake <IEditFormulaPresenter>();
            _parameterMapper         = A.Fake <IParameterToParameterDTOMapper>();
            _editRHSPresenter        = A.Fake <IEditFormulaPresenter>();
            _interactionTasksContext = A.Fake <IInteractionTaskContext>();
            _groupRepository         = A.Fake <IGroupRepository>();
            _editTasks                        = A.Fake <IEditTaskFor <IParameter> >();
            _favoriteTask                     = A.Fake <IFavoriteTask>();
            _parameterTask                    = A.Fake <IInteractionTasksForParameter>();
            _editValueOriginPresenter         = A.Fake <IEditValueOriginPresenter>();
            _tagsPresenter                    = A.Fake <ITagsPresenter>();
            _descriptorConditionListPresenter = A.Fake <IDescriptorConditionListPresenter <IParameter> >();

            _buildingBlock = A.Fake <IBuildingBlock>();

            sut = new EditParameterPresenter(
                _view,
                _editFormulaPresenter,
                _parameterMapper,
                _editRHSPresenter,
                _interactionTasksContext,
                _groupRepository,
                _editTasks,
                _parameterTask,
                new ContextSpecificReferencesRetriever(),
                _favoriteTask,
                _editValueOriginPresenter,
                _tagsPresenter,
                _descriptorConditionListPresenter)
            {
                BuildingBlock = _buildingBlock
            };

            _commandCollector = A.Fake <ICommandCollector>();
            sut.InitializeWith(_commandCollector);

            _parameter    = new Parameter().WithId("Para");
            _parameterDTO = new ParameterDTO(_parameter);
            A.CallTo(() => _parameterMapper.MapFrom(_parameter)).Returns(_parameterDTO);
        }
 public void Edit(IParameter parameterToEdit)
 {
     ParameterDTO = _parameterToParameterDTOMapper.MapFrom(parameterToEdit);
     _view.BindTo(ParameterDTO);
 }
Example #16
0
        public ApplicationDTO MapFrom(IContainer schemaItemContainer)
        {
            //schemaItemContainer are saved within en event group container
            var    eventGroup      = schemaItemContainer.ParentContainer as IEventGroup;
            string applicationIcon = string.Empty;

            if (eventGroup != null && !string.IsNullOrEmpty(eventGroup.EventGroupType))
            {
                applicationIcon = ApplicationTypes.ByName(eventGroup.EventGroupType).IconName;
            }

            var applicationDTO = new ApplicationDTO {
                Name = schemaItemContainer.ParentContainer.Name, Icon = applicationIcon
            };

            schemaItemContainer.AllParameters().Where(p => p.Visible).Each(p => applicationDTO.AddParameter(_parameterDTOMapper.MapFrom(p)));
            return(applicationDTO);
        }