protected void AddExistingTemplateNames(Template template, ObjectBaseDTO dto)
        {
            var allTemplates = _templateTaskQuery.AllTemplatesFor(template.DatabaseType, template.Type);

            dto.AddUsedNames(allTemplates.Select(x => x.Name));
            dto.ContainerType = PKSimConstants.UI.TemplateDatabase;
        }
 protected override void Context()
 {
     base.Context();
     _baseIndividual = A.Fake <Individual>();
     _populationDTO  = new ObjectBaseDTO();
     A.CallTo(() => _buildingBlockDTOFactory.CreateFor <Population>()).Returns(_populationDTO);
 }
        protected override void Context()
        {
            base.Context();
            var dimensionFactory = A.Fake <IMoBiDimensionFactory>();

            _rightDimension = A.Fake <IDimension>();
            A.CallTo(() => dimensionFactory.Dimension(Constants.Dimension.AMOUNT)).Returns(_rightDimension);
            A.CallTo(() => _context.DimensionFactory).Returns(dimensionFactory);
            _parameterName = "Para";
            var paramterId = _parameterName;

            _dtoMoleculeParameter = new DummyParameterDTO().WithId(_parameterName).WithName(_parameterName);
            var organ = new Container().WithName("Organ");

            _container = new Container().WithName("Container");
            organ.Add(_container);

            var parameterToUse = new ObjectBaseDTO().WithName(_parameterName).WithId(paramterId);

            _dtoMoleculeParameter.ParameterToUse = parameterToUse;

            IParameter parameter = new Parameter().WithName(_parameterName).WithId(paramterId).WithDimension(_rightDimension);

            _moleculeName = "Drug";
            var moleculeProperties = new Container().WithName(Constants.MOLECULE_PROPERTIES);

            _dtoMoleculeParameter.ModelParentName = _moleculeName;
            moleculeProperties.Add(parameter);

            _dtoMoleculeParameter.Parent = moleculeProperties;
            _container.Add(moleculeProperties);
            A.CallTo(() => _context.Get <IParameter>(paramterId)).Returns(parameter);
        }
Example #4
0
        protected override void Context()
        {
            _speciesRepository = A.Fake <ISpeciesRepository>();
            _view = A.Fake <IIndividualSettingsView>();
            _defaultValueRetriever       = A.Fake <IIndividualDefaultValueRetriever>();
            _individualSettingsDTOMapper = A.Fake <IIndividualToIIndividualSettingsDTOMapper>();
            _individualMapper            = A.Fake <IIndividualSettingsDTOToIndividualMapper>();
            _calculationMethodRepository = A.Fake <ICalculationMethodCategoryRepository>();
            _subPopulation            = A.Fake <IEnumerable <CategoryParameterValueVersionDTO> >();
            _editValueOriginPresenter = A.Fake <IEditValueOriginPresenter>();
            _individualSettingsDTO    = new IndividualSettingsDTO();
            _individualPropertiesDTO  = new ObjectBaseDTO();

            _speciesPopulation = A.Fake <SpeciesPopulation>();
            _species           = A.Fake <Species>();
            _gender            = A.Fake <Gender>();
            _cmCat1            = new CalculationMethodCategory();
            _cmCat2            = new CalculationMethodCategory();
            _cmCat1.Add(new CalculationMethod());
            _cmCat2.Add(new CalculationMethod());
            _individualSettingsDTO.Species           = _species;
            _individualSettingsDTO.SpeciesPopulation = _speciesPopulation;
            _individualSettingsDTO.Gender            = _gender;

            A.CallTo(() => _defaultValueRetriever.DefaultSettings()).Returns(_individualSettingsDTO);

            A.CallTo(() => _calculationMethodRepository.All()).Returns(new[] { _cmCat1, _cmCat2 });
            _individualSettingsDTO.SubPopulation = _subPopulation;
            _parentPresenter = A.Fake <IIndividualPresenter>();
            sut = new IndividualSettingsPresenter(_view, _speciesRepository, _calculationMethodRepository, _defaultValueRetriever,
                                                  _individualSettingsDTOMapper, _individualMapper, _editValueOriginPresenter);
            sut.InitializeWith(_parentPresenter);
        }
        protected override ObjectBaseDTO CreateDTOFor(ParameterAlternativeGroup compoundParamGroup)
        {
            var dto = new ObjectBaseDTO();

            dto.AddUsedNames(compoundParamGroup.Children.Select(x => x.Name));
            return(dto);
        }
Example #6
0
        protected override void Context()
        {
            base.Context();
            _parameter1 = new Parameter().WithName("P1").WithMode(ParameterBuildMode.Local);
            _parameter2 = new Parameter().WithName("P2").WithMode(ParameterBuildMode.Local);

            _subContainer       = new Container().WithName("SubContainer").WithId("SubContainerId");
            _moleculeProperties = new Container().WithName(Constants.MOLECULE_PROPERTIES);
            _container          = new Container
            {
                _parameter1,
                _parameter2,
                _subContainer,
                _moleculeProperties,
            }.WithMode(ContainerMode.Physical)
            .WithId("ContId");


            _containerDTO = new ContainerDTO {
                Id = _container.Id
            };
            A.CallTo(() => _context.Get <IObjectBase>(_container.Id)).Returns(_container);

            _subContainerDTO  = new ObjectBaseDTO();
            _parameterDTO1    = new ObjectBaseDTO();
            _parameterDTO2    = new ObjectBaseDTO();
            _dummyReactionDTO = new DummyReactionDTO();
            _dummyMoleculeDTO = new DummyMoleculeDTO();
            A.CallTo(() => _objectBaseDTOMapper.MapFrom(_subContainer)).Returns(_subContainerDTO);
            A.CallTo(() => _objectBaseDTOMapper.MapFrom(_parameter1)).Returns(_parameterDTO1);
            A.CallTo(() => _objectBaseDTOMapper.MapFrom(_parameter2)).Returns(_parameterDTO2);
            A.CallTo(() => _reactionMapper.MapFrom(_reaction, _container)).Returns(_dummyReactionDTO);
            A.CallTo(() => _moleculeMapper.MapFrom(_moleculeBuilder, _container)).Returns(_dummyMoleculeDTO);
        }
        protected override void Context()
        {
            _subPresenterManager = SubPresenterHelper.Create <IIndividualItemPresenter>();
            _view                                  = A.Fake <IScaleIndividualView>();
            _propertiesMapper                      = A.Fake <IBuildingBlockPropertiesMapper>();
            _workspace                             = A.Fake <IWorkspace>();
            _individualExpressionsUpdater          = A.Fake <IIndividualExpressionsUpdater>();
            _cloner                                = A.Fake <ICloner>();
            _sourceIndividual                      = A.Fake <Individual>();
            _cloneIndividual                       = A.Fake <Individual>();
            _scaledIndividual                      = A.Fake <Individual>();
            _objectBaseDTOFactory                  = A.Fake <IObjectBaseDTOFactory>();
            _settingPresenter                      = _subPresenterManager.CreateFake(ScaleIndividualItems.Settings);
            _parameterPresenter                    = _subPresenterManager.CreateFake(ScaleIndividualItems.Parameters);
            _scalingConfigurationPresenter         = _subPresenterManager.CreateFake(ScaleIndividualItems.Scaling);
            _moleculePresenter                     = _subPresenterManager.CreateFake(ScaleIndividualItems.Expressions);
            ScaleIndividualItems.Expressions.Index = 3;
            A.CallTo(() => _cloner.Clone(_sourceIndividual)).Returns(_cloneIndividual);
            _individualSettingsDTO = new IndividualSettingsDTO();

            _dialogCreator = A.Fake <IDialogCreator>();
            A.CallTo(() => _settingPresenter.Individual).Returns(_scaledIndividual);
            _scaleIndividualPropertiesDTO = new ObjectBaseDTO();
            A.CallTo(() => _objectBaseDTOFactory.CreateFor <Individual>()).Returns(_scaleIndividualPropertiesDTO);

            sut = new ScaleIndividualPresenter(_view, _subPresenterManager, _dialogCreator, _individualExpressionsUpdater,
                                               _objectBaseDTOFactory, _propertiesMapper, _cloner);
            sut.Initialize();
        }
        protected override ObjectBaseDTO CreateDTOFor(IClassification classification)
        {
            var dto = new ObjectBaseDTO();

            AddExistingClassificationName(dto);
            return(dto);
        }
 protected ObjectBasePresenter(IObjectBaseView view, bool descriptionVisible, bool nameVisible)
     : base(view)
 {
     //Default object base to ensure a define state at all time
     _objectBaseDTO           = new ObjectBaseDTO();
     _view.DescriptionVisible = descriptionVisible;
     _view.NameVisible        = nameVisible;
 }
        public IPKSimCommand CloneSimulation(Simulation simulationToClone)
        {
            _simulationPropertiesDTO      = _buildingBlockDTOFactory.CreateFor <Simulation>();
            _simulationPropertiesDTO.Name = simulationToClone.Name;
            _view.BindToProperties(_simulationPropertiesDTO);

            return(ConfigureSimulation(simulationToClone));
        }
 protected override void Context()
 {
     base.Context();
     _eventDTO = new ObjectBaseDTO();
     _event    = A.Fake <PKSimEvent>();
     A.CallTo(() => _eventFactory.Create()).Returns(_event);
     A.CallTo(() => _dtoFactory.CreateFor <PKSimEvent>()).Returns(_eventDTO);
 }
Example #12
0
 protected override void Context()
 {
     base.Context();
     _buildingBlockDTO             = new ObjectBaseDTO();
     _buildingBlock                = A.Fake <IPKSimBuildingBlock>();
     _buildingBlockDTO.Name        = "Name";
     _buildingBlockDTO.Description = "Description";
 }
        protected override ObjectBaseDTO CreateDTOFor(Template template)
        {
            var dto = new ObjectBaseDTO {
                Name = template.Name
            };

            AddExistingTemplateNames(template, dto);
            return(dto);
        }
        public ObjectBaseDTO CreateFor <TBuildingBlock>() where TBuildingBlock : class, IPKSimBuildingBlock
        {
            var dto = new ObjectBaseDTO {
                ContainerType = PKSimConstants.ObjectTypes.Project
            };

            dto.AddUsedNames(_workspace.Project.All <TBuildingBlock>().Select(x => x.Name));
            return(dto);
        }
Example #15
0
        protected override ObjectBaseDTO CreateDTOFor(ISimulationSubject simulationSubject)
        {
            var dto = new ObjectBaseDTO {
                ContainerType = _objectTypeResolver.TypeFor(simulationSubject)
            };

            dto.AddUsedNames(simulationSubject.AllMolecules().Select(x => x.Name));
            return(dto);
        }
Example #16
0
        protected override ObjectBaseDTO CreateDTOFor(DataRepository objectToRename)
        {
            var dto = new ObjectBaseDTO {
                ContainerType = PKSimConstants.ObjectTypes.Project, Name = objectToRename.Name
            };

            dto.AddUsedNames(_workspace.Project.AllObservedData.Select(x => x.Name));
            return(dto);
        }
        public bool Edit(TObject objectContext)
        {
            _objectBaseDTO = CreateDTOFor(objectContext);
            InitializeResourcesFor(objectContext);
            _view.BindTo(_objectBaseDTO);
            _view.Display();

            return(!_view.Canceled);
        }
 protected override void Context()
 {
     base.Context();
     _buildingBlockDTO = new ObjectBaseDTO();
     _randomPopulation = A.Fake <RandomPopulation>();
     A.CallTo(() => _view.Canceled).Returns(false);
     A.CallTo(() => _buildingBlockDTOFactory.CreateFor <Population>()).Returns(_buildingBlockDTO);
     A.CallTo(() => _popSettingsPresenter.Population).Returns(_randomPopulation);
 }
        protected virtual void AddExistingClassificationName(ObjectBaseDTO dto)
        {
            var project = _projectRetriever.CurrentProject;

            var allExistingNames = project.AllClassificationsByType(_classificationType)
                                   .Where(x => Equals(x.Parent, _parentClassification))
                                   .Select(x => x.Name);

            dto.AddUsedNames(allExistingNames);
        }
 private void edit(IMoBiSimulation simulation)
 {
     Simulation          = simulation;
     _buildConfiguration = simulation.MoBiBuildConfiguration;
     _simulationDTO      = new ObjectBaseDTO {
         Name = simulation.Name
     };
     _simulationDTO.AddUsedNames(nameOfSimulationAlreadyUsed());
     _subPresenterItemManager.AllSubPresenters.Each(x => x.Edit(simulation));
     _view.BindTo(_simulationDTO);
 }
Example #21
0
        protected override void Context()
        {
            _projectRetriever = A.Fake <IProjectRetriever>();
            _view             = A.Fake <IObjectBaseView>();
            _project          = A.Fake <IProject>();
            A.CallTo(() => _projectRetriever.CurrentProject).Returns(_project);
            sut = new NameClassificationPresenter(_view, _projectRetriever);

            A.CallTo(() => _view.BindTo(A <ObjectBaseDTO> ._))
            .Invokes(x => _dto = x.GetArgument <ObjectBaseDTO>(0));
        }
Example #22
0
        protected void AddTimeReference()
        {
            var timeDTO = new ObjectBaseDTO
            {
                Id   = AppConstants.Time,
                Name = AppConstants.Time,
                Icon = ApplicationIcons.Time.IconName
            };

            _view.AddNode(_referenceMapper.MapFrom(timeDTO));
        }
        public override void InitializeWith(ICommandCollector commandCollector)
        {
            base.InitializeWith(commandCollector);
            _subPresenterItemManager.AllSubPresenters.Each(pres =>
            {
                pres.StatusChanged  += subPresenterChanged;
                pres.StatusChanging += subPresenterChanging;
            });

            ProtocolMode           = ProtocolMode.Simple;
            _protocolPropertiesDTO = _protocolPropertiesDTOMapper.MapFrom(_protocol);
            _view.UpdateChartControl(_protocolChartPresenter.View);
            _view.BindToProperties(_protocolPropertiesDTO);
            refreshPlot();
        }
 protected override void Context()
 {
     _subPresenterManager          = SubPresenterHelper.Create <IIndividualItemPresenter>();
     _propertiesMapper             = A.Fake <IBuildingBlockPropertiesMapper>();
     _buildingBlockDTOFactory      = A.Fake <IObjectBaseDTOFactory>();
     _individualSettingsPresenter  = _subPresenterManager.CreateFake(IndividualItems.Settings);
     _individualParameterPresenter = _subPresenterManager.CreateFake(IndividualItems.Parameters);
     _individualMoleculesPresenter = _subPresenterManager.CreateFake(IndividualItems.Expression);
     _dialogCreator           = A.Fake <IDialogCreator>();
     _individualPropertiesDTO = new ObjectBaseDTO();
     _view = A.Fake <ICreateIndividualView>();
     A.CallTo(() => _buildingBlockDTOFactory.CreateFor <Individual>()).Returns(_individualPropertiesDTO);
     sut = new CreateIndividualPresenter(_view, _subPresenterManager, _dialogCreator, _propertiesMapper, _buildingBlockDTOFactory);
     sut.Initialize();
 }
Example #25
0
        public IPKSimCommand Create()
        {
            _eventPropertiesDTO = _objectBaseDTOFactory.CreateFor <PKSimEvent>();
            _view.BindToProperties(_eventPropertiesDTO);
            Event = _eventFactory.Create();
            eventSettingsPresenter.EditEvent(Event);
            _view.Display();

            if (_view.Canceled)
            {
                return(new PKSimEmptyCommand());
            }

            _propertiesMapper.MapProperties(_eventPropertiesDTO, Event);

            return(_macroCommand);
        }
        public IPKSimCommand CreatePopulation(Individual basedIndividual)
        {
            _populationPropertiesDTO = _buildingBlockDTOFactory.CreateFor <Population>();
            _view.BindToProperties(_populationPropertiesDTO);
            _populationSettingsPresenter.PrepareForCreating(basedIndividual);
            SetWizardButtonEnabled(SettingPresenterItem);
            _view.EnableControl(SettingPresenterItem);
            _view.Display();

            if (_view.Canceled)
            {
                return(new PKSimEmptyCommand());
            }

            updatePopulationProperties();
            return(_macroCommand);
        }
Example #27
0
        public IPKSimCommand Create()
        {
            _observedBuildingBlockDTO = _buildingBlockDTOFactory.CreateFor <ObserverSet>();
            ObserverSet = _observerSetFactory.Create();
            _subPresenterItemManager.AllSubPresenters.Each(x => x.Edit(ObserverSet));
            _view.BindToProperties(_observedBuildingBlockDTO);
            _view.Display();

            if (_view.Canceled)
            {
                return(new PKSimEmptyCommand());
            }

            _propertiesMapper.MapProperties(_observedBuildingBlockDTO, ObserverSet);

            return(new PKSimMacroCommand());
        }
Example #28
0
        public IPKSimCommand CreateFormulation(string applicationRoute)
        {
            _formulationPropertiesDTO = _buildingBlockDTOFactory.CreateFor <Formulation>();
            _view.BindToProperties(_formulationPropertiesDTO);
            formulationSettingsPresenter.EditFormulationFor(applicationRoute);
            _view.Display();

            if (_view.Canceled)
            {
                return(new PKSimEmptyCommand());
            }

            formulationSettingsPresenter.SaveFormulation();
            _propertiesMapper.MapProperties(_formulationPropertiesDTO, Formulation);

            return(_macroCommand);
        }
Example #29
0
        public IPKSimCommand Create()
        {
            _individualPropertiesDTO = _buildingBlockDTOFactory.CreateFor <PKSim.Core.Model.Individual>();
            _view.BindToProperties(_individualPropertiesDTO);

            PresenterAt(IndividualItems.Settings).PrepareForCreating();
            _view.EnableControl(IndividualItems.Settings);
            SetWizardButtonEnabled(IndividualItems.Settings);
            _view.Display();

            if (_view.Canceled)
            {
                return(new PKSimEmptyCommand());
            }

            updateIndividualProperties();
            return(_macroCommand);
        }
        public IPKSimCommand Create()
        {
            _simulationPropertiesDTO = _buildingBlockDTOFactory.CreateFor <Simulation>();
            _view.BindToProperties(_simulationPropertiesDTO);

            _view.ActivateControl(SimulationItems.Model);
            _view.EnableControl(SimulationItems.Model);
            AllSimulationItemsAfterModel.Each(x => _view.DisableControl(x));
            SetWizardButtonEnabled(SimulationItems.Model);
            _view.Display();

            if (_view.Canceled)
            {
                return(new PKSimEmptyCommand());
            }

            return(new PKSimMacroCommand());
        }