예제 #1
0
        protected override void Context()
        {
            _project           = A.Fake <IPKSimProject>();
            _entityTask        = A.Fake <IEntityTask>();
            _templateTaskQuery = A.Fake <ITemplateTaskQuery>();
            _executionContext  = A.Fake <IExecutionContext>();
            A.CallTo(() => _executionContext.CurrentProject).Returns(_project);
            _applicationController            = A.Fake <IApplicationController>();
            _buildingBlockInSimulationManager = A.Fake <IBuildingBlockInSimulationManager>();
            _buildingBlockRepository          = A.Fake <IBuildingBlockRepository>();
            _clonePresenter             = A.Fake <ICloneBuildingBlockPresenter>();
            _renamePresenter            = A.Fake <IRenameObjectPresenter>();
            _dialogCreator              = A.Fake <IDialogCreator>();
            _singleStartPresenterTask   = A.Fake <ISingleStartPresenterTask>();
            _lazyLoadTask               = A.Fake <ILazyLoadTask>();
            _presenterSettingsTask      = A.Fake <IPresentationSettingsTask>();
            _simulationReferenceUpdater = A.Fake <ISimulationReferenceUpdater>();

            sut = new BuildingBlockTask(_executionContext, _applicationController, _dialogCreator, _buildingBlockInSimulationManager,
                                        _entityTask, _templateTaskQuery, _singleStartPresenterTask, _buildingBlockRepository, _lazyLoadTask, _presenterSettingsTask, _simulationReferenceUpdater);
            A.CallTo(() => _applicationController.Start <ICloneBuildingBlockPresenter>()).Returns(_clonePresenter);
            A.CallTo(() => _applicationController.Start <IRenameObjectPresenter>()).Returns(_renamePresenter);

            _buildingBlock = A.Fake <IPKSimBuildingBlock>();
        }
 protected override void Context()
 {
     _simulation = new IndividualSimulation();
     _buildingBlockInSmulationManager = A.Fake <IBuildingBlockInSimulationManager>();
     _buildingBlockRepository         = A.Fake <IBuildingBlockRepository>();
     sut = new FormulationFromMappingRetriever(_buildingBlockInSmulationManager, _buildingBlockRepository);
 }
예제 #3
0
 protected override void Context()
 {
     _buildingBlockRepository = A.Fake <IBuildingBlockRepository>();
     sut = new BuildingBlockRetriever(_buildingBlockRepository);
     _allBuildingBlocks = new List <IBuildingBlock>();
     A.CallTo(() => _buildingBlockRepository.All()).Returns(_allBuildingBlocks);
 }
        protected override void Context()
        {
            _view = A.Fake <IExpressionProfileSelectionView>();
            _moleculePropertiesMapper = A.Fake <IMoleculePropertiesMapper>();
            _buildingBlockRepository  = A.Fake <IBuildingBlockRepository>();
            _expressionProfileTask    = A.Fake <IExpressionProfileTask>();


            sut = new ExpressionProfileSelectionPresenter(_view, _moleculePropertiesMapper, _buildingBlockRepository, _expressionProfileTask);

            A.CallTo(() => _view.BindTo(A <ExpressionProfileSelectionDTO> ._))
            .Invokes(x => _dto = x.GetArgument <ExpressionProfileSelectionDTO>(0));

            _individual         = DomainHelperForSpecs.CreateIndividual(speciesName: "Human");
            _expressionProfile1 = DomainHelperForSpecs.CreateExpressionProfile <IndividualEnzyme>(speciesName: "Human");
            _expressionProfile2 = DomainHelperForSpecs.CreateExpressionProfile <IndividualEnzyme>(speciesName: "Human");
            _expressionProfile3 = DomainHelperForSpecs.CreateExpressionProfile <IndividualTransporter>(speciesName: "Human");
            _expressionProfile4 = DomainHelperForSpecs.CreateExpressionProfile <IndividualEnzyme>(speciesName: "Dog");
            _expressionProfile5 = DomainHelperForSpecs.CreateExpressionProfile <IndividualEnzyme>(speciesName: "Human");

            _allExpressionProfiles = new List <ExpressionProfile> {
                _expressionProfile1, _expressionProfile2
            };

            A.CallTo(() => _buildingBlockRepository.All(A <Func <ExpressionProfile, bool> > ._))
            .Invokes(x => _predicate = x.GetArgument <Func <ExpressionProfile, bool> >(0))
            .Returns(_allExpressionProfiles);

            _individual.AddExpressionProfile(_expressionProfile5);
        }
예제 #5
0
 protected override void Context()
 {
     _allBuildingBlocks       = new List <IPKSimBuildingBlock>();
     _buildingBlockRepository = A.Fake <IBuildingBlockRepository>();
     A.CallTo(() => _buildingBlockRepository.All()).Returns(_allBuildingBlocks);
     sut = new FormulationMappingDTOToFormulationMappingMapper(_buildingBlockRepository);
 }
예제 #6
0
 public CompoundTask(IExecutionContext executionContext, IBuildingBlockTask buildingBlockTask, IApplicationController applicationController,
                     IBuildingBlockRepository buildingBlockRepository, IDialogCreator dialogCreator)
     : base(executionContext, buildingBlockTask, applicationController, PKSimBuildingBlockType.Compound)
 {
     _buildingBlockRepository = buildingBlockRepository;
     _dialogCreator           = dialogCreator;
 }
        public ObservedDataFolderContextMenu(
            ITreeNode <RootNodeType> treeNode,
            IMenuBarItemRepository repository,
            IBuildingBlockRepository buildingBlockRepository,
            IBuildingBlockExplorerPresenter presenter,
            IUserSettings userSettings)
        {
            var allCompounds = buildingBlockRepository.All <Compound>().ToList();

            //create sub menu containing all compounds
            var addObservedDataFor = CreateSubMenu.WithCaption(PKSimConstants.MenuNames.AddObservedDataFor)
                                     .WithIcon(ApplicationIcons.ObservedDataForMolecule);


            foreach (var compound in allCompounds)
            {
                addObservedDataFor.AddItem(CreateMenuButton.WithCaption(compound.Name)
                                           .WithCommandFor <AddObservedDataForCompoundUICommand, Compound>(compound));
            }

            _view.AddMenuItem(repository[MenuBarItemIds.AddObservedData]);
            if (allCompounds.Any())
            {
                _view.AddMenuItem(addObservedDataFor);
            }

            if (treeNode.HasChildren)
            {
                _view.AddMenuItem(ObservedDataClassificationCommonContextMenuItems.ColorGroupObservedData(userSettings));
            }


            _view.AddMenuItem(CreateMenuButton.WithCaption(PKSimConstants.MenuNames.LoadFromTemplate)
                              .WithCommand <LoadObservedDataFromTemplateUICommand>()
                              .WithIcon(ApplicationIcons.LoadFromTemplate)
                              .AsGroupStarter());

            _view.AddMenuItem(CreateMenuButton.WithCaption(PKSimConstants.MenuNames.AsDeveloperOnly("Load from Snapshot"))
                              .WithCommand <LoadObservedDataFromSnapshotUICommand>()
                              .WithIcon(ApplicationIcons.SnapshotImport)
                              .ForDeveloper());


            if (treeNode.AllLeafNodes.OfType <ObservedDataNode>().Any())
            {
                _view.AddMenuItem(ObservedDataClassificationCommonContextMenuItems.EditMultipleMetaData(treeNode).AsGroupStarter());
            }


            _view.AddMenuItem(ClassificationCommonContextMenuItems.CreateClassificationUnderMenu(treeNode, presenter));

            var groupMenu = createGroupingSubMenu(treeNode, presenter);

            if (groupMenu.AllItems().Any())
            {
                _view.AddMenuItem(groupMenu);
            }

            _view.AddMenuItem(createDeleteSubMenu(treeNode, presenter));
        }
예제 #8
0
 public EventMappingToEventMappingDTOMapper(IBuildingBlockRepository buildingBlockRepository,
                                            IParameterToParameterDTOInContainerMapper <EventMappingDTO> parameterDTOMapper,
                                            IBuildingBlockInSimulationManager buildingBlockInSimulationManager)
 {
     _buildingBlockRepository          = buildingBlockRepository;
     _parameterDTOMapper               = parameterDTOMapper;
     _buildingBlockInSimulationManager = buildingBlockInSimulationManager;
 }
예제 #9
0
 public IndividualExtractor(IExecutionContext executionContext, IEntityPathResolver entityPathResolver, IIndividualTask individualTask, IContainerTask containerTask, IBuildingBlockRepository buildingBlockRepository)
 {
     _executionContext        = executionContext;
     _entityPathResolver      = entityPathResolver;
     _individualTask          = individualTask;
     _containerTask           = containerTask;
     _buildingBlockRepository = buildingBlockRepository;
 }
 public BuildingBlockSelectionPresenter(IBuildingBlockSelectionView view, IBuildingBlockRepository buildingBlockRepository,
                                        IInteractionTasksForBuildingBlock <TBuildingBlock> interactionTasks, IMoBiContext context)
     : base(view)
 {
     _buildingBlockRepository = buildingBlockRepository;
     _interactionTasks        = interactionTasks;
     _context = context;
     _buildingBlockSelectionDTO = new BuildingBlockSelectionDTO();
 }
예제 #11
0
 public SimulationSelectionForComparisonPresenter(ISimulationSelectionForComparisonView view, IBuildingBlockRepository buildingBlockRepository, ILazyLoadTask lazyLoadTask) : base(view)
 {
     _buildingBlockRepository         = buildingBlockRepository;
     _lazyLoadTask                    = lazyLoadTask;
     _selectionDTO                    = new SimulationComparisonSelectionDTO();
     _nullSimulation                  = new NullSimulation();
     _selectionDTO.Reference          = _nullSimulation;
     _selectionDTO.GroupingItem.Color = PKSimColors.StartGroupingColor;
 }
 protected CreatePopulationPresenter(TView view, ISubPresenterItemManager <IPopulationItemPresenter> subPresenterItemManager,
                                     IReadOnlyList <ISubPresenterItem> subPresenterItems, IDialogCreator dialogCreator,
                                     IBuildingBlockPropertiesMapper propertiesMapper, IObjectBaseDTOFactory buildingBlockDTOFactory, IBuildingBlockRepository buildingBlockRepository)
     : base(view, subPresenterItemManager, subPresenterItems, dialogCreator)
 {
     _propertiesMapper        = propertiesMapper;
     _buildingBlockDTOFactory = buildingBlockDTOFactory;
     _buildingBlockRepository = buildingBlockRepository;
 }
예제 #13
0
        protected override void Context()
        {
            _toolTipPartCreator      = A.Fake <IToolTipPartCreator>();
            _buildingBlockRepository = A.Fake <IBuildingBlockRepository>();
            sut = new BuildingBlockSelectionDisplayer(_buildingBlockRepository, _toolTipPartCreator);

            _templateCompound    = new Compound().WithName("A").WithId("A");
            _nonTemplateCompound = new Compound().WithName("B").WithId("B");

            A.CallTo(() => _buildingBlockRepository.ById(_templateCompound.Id)).Returns(_templateCompound);
            A.CallTo(() => _buildingBlockRepository.ById(_nonTemplateCompound.Id)).Returns(null);
        }
 public SimulationCompoundsSelectionPresenter(ISimulationCompoundsSelectionView view, IBuildingBlockRepository buildingBlockRepository,
                                              IBuildingBlockInSimulationManager buildingBlockInSimulationManager, ICompoundTask compoundTask, IBuildingBlockSelectionDisplayer buildingBlockSelectionDisplayer)
     : base(view)
 {
     _buildingBlockRepository          = buildingBlockRepository;
     _buildingBlockInSimulationManager = buildingBlockInSimulationManager;
     _compoundTask = compoundTask;
     _buildingBlockSelectionDisplayer = buildingBlockSelectionDisplayer;
     _compoundSelectionDTOs           = new NotifyList <CompoundSelectionDTO>();
     _view.BindTo(_compoundSelectionDTOs);
     _compoundSelectionDTOs.CollectionChanged += onCollectionChanged;
 }
 public EnzymaticCompoundProcessPresenter(
     IEnzymaticCompoundProcessView view,
     IParametersByGroupPresenter parametersPresenter,
     IEntityTask entityTask, ISpeciesRepository speciesRepository,
     IRepresentationInfoRepository representationInfoRepository,
     IEnzymaticProcessToEnzymaticProcessDTOMapper mapper,
     IBuildingBlockRepository buildingBlockRepository,
     ICompoundProcessTask processTask)
     : base(view, parametersPresenter, entityTask, speciesRepository, representationInfoRepository, mapper, processTask)
 {
     _buildingBlockRepository = buildingBlockRepository;
 }
예제 #16
0
 public ExpressionProfileSelectionPresenter(
     IExpressionProfileSelectionView view,
     IMoleculePropertiesMapper moleculePropertiesMapper,
     IBuildingBlockRepository buildingBlockRepository,
     IExpressionProfileTask expressionProfileTask)
     : base(view)
 {
     _moleculePropertiesMapper      = moleculePropertiesMapper;
     _buildingBlockRepository       = buildingBlockRepository;
     _expressionProfileTask         = expressionProfileTask;
     _expressionProfileSelectionDTO = new ExpressionProfileSelectionDTO();
 }
 protected override void Context()
 {
     base.Context();
     _view = A.Fake <ICreateEnzymaticProcessView>();
     _compoundProcessTask     = A.Fake <ICompoundProcessTask>();
     _buildingBlockRepository = A.Fake <IBuildingBlockRepository>();
     _processMapper           = A.Fake <ICompoundProcessToCompoundProcessDTOMapper>();
     _partialProcessMapper    = A.Fake <IPartialProcessToPartialProcessDTOMapper>();
     _parameterPresenter      = A.Fake <IParametersByGroupPresenter>();
     _usedMOleculeRepository  = A.Fake <IUsedMoleculeRepository>();
     _speciesRepository       = A.Fake <ISpeciesRepository>();
     sut = new CreateEnzymaticProcessPresenter(_view, _compoundProcessTask, _processMapper, _partialProcessMapper, _parameterPresenter, _usedMOleculeRepository, _speciesRepository, _buildingBlockRepository);
 }
예제 #18
0
        protected override void Context()
        {
            _executionContext      = A.Fake <IExecutionContext>();
            _buildingBlockTask     = A.Fake <IBuildingBlockTask>();
            _applicationController = A.Fake <IApplicationController>();
            _compound = new Compound().WithId("Drug").WithName("Drug");
            _buildingBlockRepository = A.Fake <IBuildingBlockRepository>();
            _dialogCreator           = A.Fake <IDialogCreator>();
            sut = new CompoundTask(_executionContext, _buildingBlockTask, _applicationController, _buildingBlockRepository, _dialogCreator);

            A.CallTo(() => _buildingBlockTask.SaveAsTemplate(A <ICache <IPKSimBuildingBlock, IReadOnlyList <IPKSimBuildingBlock> > > ._, TemplateDatabaseType.User))
            .Invokes(x => _cache = x.GetArgument <ICache <IPKSimBuildingBlock, IReadOnlyList <IPKSimBuildingBlock> > >(0));
        }
 protected override void Context()
 {
     _parameterAlternativeFactory = A.Fake <IParameterAlternativeFactory>();
     _applicationController       = A.Fake <IApplicationController>();
     _executionContext            = A.Fake <IExecutionContext>();
     _entityTask              = A.Fake <IEntityTask>();
     _formulaFactory          = A.Fake <IFormulaFactory>();
     _parameterTask           = A.Fake <IParameterTask>();
     _buildingBlockRepository = A.Fake <IBuildingBlockRepository>();
     _compoundFactory         = new CompoundFactoryForSpecs();
     sut = new CompoundAlternativeTask(_parameterAlternativeFactory, _applicationController,
                                       _executionContext, _compoundFactory, _entityTask, _formulaFactory, _parameterTask, _buildingBlockRepository);
 }
예제 #20
0
        protected BuildingBlockFolderContextMenu(IMenuBarItemRepository repository, IBuildingBlockRepository buildingBlockRepository, params MenuBarItemId[] staticMenus)
        {
            staticMenus.Each(menu => _view.AddMenuItem(repository[menu]));

            var allBuildingBlocks = buildingBlockRepository.All <TBuildingBlock>();

            if (!allBuildingBlocks.Any())
            {
                return;
            }

            _view.AddMenuItem(GenericMenu.ExportCollectionToPDFMenuFor <TBuildingBlock>().AsGroupStarter());
        }
예제 #21
0
 public CompoundAlternativeTask(IParameterAlternativeFactory parameterAlternativeFactory, IApplicationController applicationController,
                                IExecutionContext executionContext, ICompoundFactory compoundFactory, IEntityTask entityTask,
                                IFormulaFactory formulaFactory, IParameterTask parameterTask, IBuildingBlockRepository buildingBlockRepository)
 {
     _parameterAlternativeFactory = parameterAlternativeFactory;
     _applicationController       = applicationController;
     _executionContext            = executionContext;
     _compoundFactory             = compoundFactory;
     _entityTask              = entityTask;
     _formulaFactory          = formulaFactory;
     _parameterTask           = parameterTask;
     _buildingBlockRepository = buildingBlockRepository;
 }
        protected override void Context()
        {
            _enzymaticProcessToEnzymaticProcessDTOMapper = A.Fake <IEnzymaticProcessToEnzymaticProcessDTOMapper>();
            _view = A.Fake <IEnzymaticCompoundProcessView>();

            _buildingBlockRepository = A.Fake <IBuildingBlockRepository>();
            _compoundProcessTask     = A.Fake <ICompoundProcessTask>();
            sut = new EnzymaticCompoundProcessPresenter(
                _view, A.Fake <IParametersByGroupPresenter>(), A.Fake <IEntityTask>(), A.Fake <ISpeciesRepository>(), A.Fake <IRepresentationInfoRepository>(),
                _enzymaticProcessToEnzymaticProcessDTOMapper,
                _buildingBlockRepository,
                _compoundProcessTask);
        }
예제 #23
0
        protected override void Context()
        {
            _executionContext        = A.Fake <IExecutionContext>();
            _entityPathResolver      = A.Fake <IEntityPathResolver>();
            _individualTask          = A.Fake <IIndividualTask>();
            _containerTask           = new ContainerTaskForSpecs();
            _buildingBlockRepository = A.Fake <IBuildingBlockRepository>();

            sut = new IndividualExtractor(_executionContext, _entityPathResolver, _individualTask, _containerTask, _buildingBlockRepository);

            _templateIndividual1 = new Individual();
            A.CallTo(() => _buildingBlockRepository.All <Individual>()).Returns(new[] { _templateIndividual1 });
        }
예제 #24
0
        protected BuildingBlockFolderContextMenu(IMenuBarItemRepository repository, IBuildingBlockRepository buildingBlockRepository, params MenuBarItemId[] staticMenus)
        {
            staticMenus.Each(menu => _view.AddMenuItem(repository[menu]));

            _view.AddMenuItem(GenericMenu.LoadBuildingBlockFromSnapshot <TBuildingBlock>());

            var allBuildingBlocks = buildingBlockRepository.All <TBuildingBlock>();

            if (!allBuildingBlocks.Any())
            {
                return;
            }
        }
예제 #25
0
 protected override void Context()
 {
     _parameterAlternativeFactory = A.Fake <IParameterAlternativeFactory>();
     _executionContext            = A.Fake <IExecutionContext>();
     _formulaFactory          = A.Fake <IFormulaFactory>();
     _parameterTask           = A.Fake <IParameterTask>();
     _buildingBlockRepository = A.Fake <IBuildingBlockRepository>();
     _dimensionRepository     = A.Fake <IDimensionRepository>();
     _dataImporter            = A.Fake <IDataImporter>();
     _compoundFactory         = new CompoundFactoryForSpecs();
     sut = new CompoundAlternativeTask(_parameterAlternativeFactory,
                                       _executionContext, _compoundFactory, _formulaFactory, _parameterTask,
                                       _buildingBlockRepository, _dimensionRepository, _dataImporter);
 }
예제 #26
0
 public BuildingBlockMergePresenter(IBuildingBlockMergeView view, IDialogCreator dialogCreator,
                                    IMergeTask mergeTask, IBuildingBlockRepository buildingBlockRepository,
                                    IIconRepository iconRepository, ISerializationTask serializationTask) : base(view)
 {
     _cancellationTokenSource = new CancellationTokenSource();
     _dialogCreator           = dialogCreator;
     _mergeTask = mergeTask;
     _buildingBlockRepository  = buildingBlockRepository;
     _allBuildingBlockMappings = new List <BuildingBlockMappingDTO>();
     _noneBuildingBlock        = new NullBuildingBlock(AppConstants.None);
     _importAsNewBuildingBlock = new NullBuildingBlock(AppConstants.Captions.ImportAsNew);
     _iconRepository           = iconRepository;
     _serializationTask        = serializationTask;
 }
예제 #27
0
 protected override void Context()
 {
     _eventPublisher          = A.Fake <IEventPublisher>();
     _buildingBlockRepository = A.Fake <IBuildingBlockRepository>();
     _simulation1             = new IndividualSimulation();
     _simulation2             = new IndividualSimulation();
     _simulation3             = new IndividualSimulation();
     A.CallTo(() => _buildingBlockRepository.All <Simulation>()).Returns(new[] { _simulation1, _simulation2, _simulation3 });
     _id = "tralala";
     _templateBuildingBlock = A.Fake <IPKSimBuildingBlock>().WithId(_id);
     _usedBuildingBlock     = new UsedBuildingBlock(_templateBuildingBlock.Id, _templateBuildingBlock.BuildingBlockType);
     A.CallTo(() => _buildingBlockRepository.ById(_templateBuildingBlock.Id)).Returns(_templateBuildingBlock);
     sut = new BuildingBlockInProjectManager(_buildingBlockRepository, _eventPublisher);
 }
예제 #28
0
 public BuildingBlockSelectionPresenter(IBuildingBlockSelectionView view, IObjectTypeResolver objectTypeResolver,
                                        IBuildingBlockRepository buildingBlockRepository, IContainer container,
                                        IObjectBaseFactory objectBaseFactory, IBuildingBlockSelectionDisplayer buildingBlockSelectionDisplayer)
     : base(view)
 {
     _buildingBlockRepository = buildingBlockRepository;
     _container = container;
     _buildingBlockSelectionDisplayer = buildingBlockSelectionDisplayer;
     BuildingBlockType = objectTypeResolver.TypeFor <TBuildingBlock>();
     _buildingBlockDTO = new BuildingBlockSelectionDTO {
         BuildingBockType = BuildingBlockType
     };
     _view.DisplayIcons = true;
     _emptySelection    = objectBaseFactory.Create <TBuildingBlock>().WithName(PKSimConstants.UI.None);
 }
예제 #29
0
 public ImportObservedDataTask(IDataImporter dataImporter, IExecutionContext executionContext,
                               IDimensionRepository dimensionRepository, IBuildingBlockRepository buildingBlockRepository, ISpeciesRepository speciesRepository,
                               IDefaultIndividualRetriever defaultIndividualRetriever, IRepresentationInfoRepository representationInfoRepository,
                               IObservedDataTask observedDataTask, IParameterChangeUpdater parameterChangeUpdater)
 {
     _dataImporter                 = dataImporter;
     _executionContext             = executionContext;
     _dimensionRepository          = dimensionRepository;
     _buildingBlockRepository      = buildingBlockRepository;
     _speciesRepository            = speciesRepository;
     _defaultIndividualRetriever   = defaultIndividualRetriever;
     _representationInfoRepository = representationInfoRepository;
     _observedDataTask             = observedDataTask;
     _parameterChangeUpdater       = parameterChangeUpdater;
 }
예제 #30
0
        protected override void Context()
        {
            _buildingBlockRepository = A.Fake <IBuildingBlockRepository>();
            _buildingBockRetriever   = A.Fake <IBuildingBlockRetriever>();
            _observedDataRepository  = A.Fake <IObservedDataRepository>();
            sut = new ParameterChangeUpdater(_buildingBockRetriever, _observedDataRepository, _buildingBlockRepository);

            _compounds = new List <Compound>();
            A.CallTo(() => _buildingBlockRepository.All <Compound>()).Returns(_compounds);
            _observedDataList = new List <DataRepository>();
            A.CallTo(() => _observedDataRepository.All()).Returns(_observedDataList);

            _compound = A.Fake <Compound>().WithName("C");
            A.CallTo(() => _compound.MolWeight).Returns(200);
        }