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);
        }
Exemplo n.º 2
0
        protected override void Context()
        {
            _view                        = A.Fake <IFavoriteParametersView>();
            _parameterTask               = A.Fake <IParameterTask>();
            _favoriteRepository          = A.Fake <IFavoriteRepository>();
            _multiParameterEditPresenter = A.Fake <IMultiParameterEditPresenter>();
            _favoriteTask                = A.Fake <IFavoriteTask>();

            sut = new FavoriteParametersPresenter(_view, _multiParameterEditPresenter, _parameterTask, _favoriteRepository, _favoriteTask);

            _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);
            _favorites = new List <string>();
            A.CallTo(() => _favoriteRepository.All()).Returns(_favorites);

            A.CallTo(() => _multiParameterEditPresenter.Edit(A <IEnumerable <IParameter> > ._))
            .Invokes(x => _allEditedParameters = x.GetArgument <IEnumerable <IParameter> >(0));
        }
        private void addFavoriteParametersTo(ParameterIdentification parameterIdentification, ISimulation simulation)
        {
            var allParameters   = _entitiesInSimulationRetriever.ParametersFrom(simulation);
            var parametersToAdd = _favoriteRepository.All()
                                  .Select(path => allParameters[path])
                                  .Where(p => p != null);

            AddParametersTo(parameterIdentification, parametersToAdd);
        }
Exemplo n.º 4
0
        private void updateFavorites()
        {
            var allFavoritesParameters = _favoriteRepository.All().Select(path => _parameterCache[path]).Where(p => p != null);

            _editParameterListPresenter.Edit(allFavoritesParameters);

            //name always visible
            _editParameterListPresenter.SetVisibility(PathElement.Name, isVisible: true);

            UpdateSpecialColumnsVisibility();
        }
        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)
            });
        }
Exemplo n.º 6
0
        protected override void Context()
        {
            _view = A.Fake <IEditFavoritesView>();
            _editParameterListPresenter = A.Fake <IEditParameterListPresenter>();
            _favoriteRepository         = A.Fake <IFavoriteRepository>();
            _entityPathResolver         = new EntityPathResolver(new ObjectPathFactory(A.Fake <IAliasCreator>()));
            _favoriteTask = A.Fake <IFavoriteTask>();

            sut = new EditFavoritesInSpatialStructurePresenter(_view, _favoriteRepository, _entityPathResolver, _editParameterListPresenter, _favoriteTask);
            _spatialStructure = new MoBiSpatialStructure();
            var cont = new Container().WithName("root");

            _para = new Parameter().WithName("P").WithParentContainer(cont);
            _fav  = new Parameter().WithName("F").WithParentContainer(cont);
            _spatialStructure.AddTopContainer(cont);
            A.CallTo(() => _favoriteRepository.All()).Returns(new[] { _entityPathResolver.PathFor(_fav) });
        }
 private IEnumerable <IParameter> allFavoriteParameters()
 {
     return(from favorite in _favoriteRepository.All()
            where _allParameterCache.Contains(favorite)
            select _allParameterCache[favorite]);
 }