protected override void Context() { _workspace = A.Fake <ICoreWorkspace>(); _historyManager = A.Fake <IHistoryManager>(); A.CallTo(() => _workspace.HistoryManager).Returns(_historyManager); sut = new UndoCommand(_workspace); }
protected override void Context() { _worskpace = A.Fake <ICoreWorkspace>(); _labelTask = A.Fake <ILabelTask>(); sut = new AddLabelCommand(_labelTask, _worskpace); A.CallTo(() => _worskpace.HistoryManager).Returns(A.Fake <IHistoryManager <PKSimProject> >()); }
protected override void Context() { _subPresenterManager = SubPresenterHelper.Create <IIndividualItemPresenter>(); _view = A.Fake <IScaleIndividualView>(); _propertiesMapper = A.Fake <IBuildingBlockPropertiesMapper>(); _workspace = A.Fake <ICoreWorkspace>(); _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(); }
public LoadProjectFromSnapshotCommand(ICoreWorkspace workspace, PKSimProject project, string snapshotFile) { _workspace = workspace; _project = project; _snapshotFile = snapshotFile; ObjectType = ObjectTypes.Project; CommandType = Command.CommandTypeAdd; }
public override void GlobalContext() { base.GlobalContext(); _workspace = IoC.Resolve <ICoreWorkspace>(); _oldProject = _workspace.Project; _workspace.Project = new PKSimProject(); _workspace.Project.AddBuildingBlock(_individual); }
public DeleteSimulationComparisonsUICommand(IApplicationController applicationController, ICoreWorkspace workspace, IEventPublisher eventPublisher, IDialogCreator dialogCreator, IRegistrationTask registrationTask) { _applicationController = applicationController; _workspace = workspace; _eventPublisher = eventPublisher; _dialogCreator = dialogCreator; _registrationTask = registrationTask; }
public void LoadSession(ICoreWorkspace workspace, string fileFullPath) { using (var progress = _progressManager.Create()) { progress.Initialize(5); progress.IncrementProgress(PKSimConstants.UI.OpeningProjectDatabase); verifyProjectNotReadOnly(fileFullPath); _databaseSchemaMigrator.MigrateSchema(fileFullPath); try { _sessionManager.OpenFactoryFor(fileFullPath); using (var session = _sessionManager.OpenSession()) using (session.BeginTransaction()) { progress.IncrementProgress(PKSimConstants.UI.LoadingHistory); var historyManager = _historyManagerPersistor.Load(session); workspace.HistoryManager = historyManager; progress.IncrementProgress(PKSimConstants.UI.LoadingProject); var project = _projectPersistor.Load(session); if (project == null) { //history was loaded but project load failed workspace.HistoryManager = null; return; } project.Name = FileHelper.FileNameFromFileFullPath(fileFullPath); workspace.Project = project; _projectClassifiableUpdaterAfterDeserialization.Update(project); progress.IncrementProgress(PKSimConstants.UI.LoadingWorkingJournal); var journal = _journalLoader.Load(project.JournalPath, fileFullPath); workspace.Journal = journal; progress.IncrementProgress(PKSimConstants.UI.LoadingLayout); var workspaceLayout = _workspaceLayoutPersistor.Load(session); // The workspace layout may be null if the workspace was created via CLI. In that case, we simply initialize the workspace layout if (workspace is IWithWorkspaceLayout withWorkspaceLayout) { withWorkspaceLayout.WorkspaceLayout = workspaceLayout ?? new WorkspaceLayout(); } } } catch (Exception) { //Exception occurs while opening the project! //close the file and rethrow the exception _sessionManager.CloseFactory(); throw; } } }
public HistoryPresenter(IHistoryBrowserPresenter historyBrowserPresenter, ICoreWorkspace workspace, IRegionResolver regionResolver, IExecutionContext executionContext, IApplicationConfiguration applicationConfiguration) { _historyBrowserPresenter = historyBrowserPresenter; _workspace = workspace; _executionContext = executionContext; _applicationConfiguration = applicationConfiguration; _initialized = false; _region = regionResolver.RegionWithName(RegionNames.History); _region.Add(_historyBrowserPresenter.View); }
protected override Task Context() { _workspace = A.Fake <ICoreWorkspace>(); _snapshotTask = A.Fake <ISnapshotTask>(); _workspacePersistor = A.Fake <IWorkspacePersistor>(); _logger = A.Fake <ILogger>(); sut = new SnapshotRunner(_workspace, _snapshotTask, _workspacePersistor, _logger); _runOptions = new SnapshotRunOptions(); return(_completed); }
public MenuAndToolBarPresenter(IMenuAndToolBarView view, IMenuBarItemRepository menuBarItemRepository, IButtonGroupRepository buttonGroupRepository, IMRUProvider mruProvider, ISkinManager skinManager, IStartOptions startOptions, ICoreWorkspace workspace, IActiveSubjectRetriever activeSubjectRetriever) : base(view, menuBarItemRepository, mruProvider) { _menuBarItemRepository = menuBarItemRepository; _buttonGroupRepository = buttonGroupRepository; _skinManager = skinManager; _startOptions = startOptions; _workspace = workspace; _activeSubjectRetriever = activeSubjectRetriever; _enabled = true; }
protected override void Context() { _region = A.Fake <IRegion>(); _historyBrowserPresenter = A.Fake <IHistoryBrowserPresenter>(); _workspace = A.Fake <ICoreWorkspace>(); _regionResolver = A.Fake <IRegionResolver>(); _executionContext = A.Fake <IExecutionContext>(); _configuration = A.Fake <IApplicationConfiguration>(); A.CallTo(() => _regionResolver.RegionWithName(RegionNames.History)).Returns(_region); sut = new HistoryPresenter(_historyBrowserPresenter, _workspace, _regionResolver, _executionContext, _configuration); }
protected override void Context() { _context = A.Fake <IExecutionContext>(); _workspace = A.Fake <ICoreWorkspace>(); _configuration = A.Fake <IApplicationConfiguration>(); _project = new PKSimProject { Creation = { Version = "CreationVersion" } }; A.CallTo(() => _context.Resolve <IApplicationConfiguration>()).Returns(_configuration); A.CallTo(() => _configuration.Version).Returns("1.2.3"); sut = new LoadProjectFromSnapshotCommand(_workspace, _project, _snapshotFile); }
public SnapshotRunner( ICoreWorkspace workspace, ISnapshotTask snapshotTask, IWorkspacePersistor workspacePersistor, IOSPSuiteLogger logger) { _workspace = workspace; _snapshotTask = snapshotTask; _workspacePersistor = workspacePersistor; _logger = logger; AllFilesFrom = allFilesFrom; }
protected override void Context() { _subPresenterManager = SubPresenterHelper.Create <ISettingsItemPresenter>(); _userSettings = _subPresenterManager.CreateFake(SettingsItems.UserGeneralSettings); _appSettings = _subPresenterManager.CreateFake(SettingsItems.ApplicationSettings); _userDisplayUnitSettings = _subPresenterManager.CreateFake(SettingsItems.UserDisplayUnitsSettings); _dialogCreator = A.Fake <IDialogCreator>(); _workspace = A.Fake <ICoreWorkspace>(); _view = A.Fake <ISettingsView>(); sut = new SettingsPresenter(_view, _subPresenterManager, _dialogCreator, _workspace); }
protected override void Context() { _dialogCreator = A.Fake <IDialogCreator>(); _applicationController = A.Fake <IApplicationController>(); _workspace = A.Fake <ICoreWorkspace>(); _project = A.Fake <PKSimProject>(); _registrationTask = A.Fake <IRegistrationTask>(); A.CallTo(() => _workspace.Project).Returns(_project); _eventPublisher = A.Fake <IEventPublisher>(); sut = new DeleteSimulationComparisonsUICommand(_applicationController, _workspace, _eventPublisher, _dialogCreator, _registrationTask); _individualSimulationComparison = new IndividualSimulationComparison().WithName("chart"); sut.For(new [] { _individualSimulationComparison }); }
public ExportSimulationRunner( ILogger logger, IWorkspacePersistor workspacePersistor, ICoreWorkspace workspace, ISimulationExporter simulationExporter, ILazyLoadTask lazyLoadTask ) { _logger = logger; _workspacePersistor = workspacePersistor; _workspace = workspace; _simulationExporter = simulationExporter; _lazyLoadTask = lazyLoadTask; }
protected override void Context() { _workspace = A.Fake <ICoreWorkspace>(); _view = A.Fake <IEditRandomPopulationView>(); _subPresenterManager = SubPresenterHelper.Create <IPopulationItemPresenter>(); _popSettingsPresenter = _subPresenterManager.CreateFake(RamdomPopulationItems.Settings); _popAdvancedParameterPresenter = _subPresenterManager.CreateFake(RamdomPopulationItems.AdvancedParameters); _popDistributionPresenter = _subPresenterManager.CreateFake(RamdomPopulationItems.ParameterDistribution); //This line is required because of some generic issues A.CallTo(_subPresenterManager).WithReturnType <IPopulationSettingsPresenter <RandomPopulation> >().Returns(_popSettingsPresenter); _randomPopulation = A.Fake <RandomPopulation>(); A.CallTo(() => _popSettingsPresenter.Population).Returns(_randomPopulation); sut = new EditRandomPopulationPresenter(_view, _subPresenterManager); sut.InitializeWith(_workspace); }
protected override void Context() { _view = A.Fake <IEditIndividualView>(); _workspace = A.Fake <ICoreWorkspace>(); _individualSettingsPresenter = A.Fake <IIndividualSettingsPresenter>(); _individualMoleculesPresenter = A.Fake <IIndividualMoleculesPresenter>(); _individualToEdit = A.Fake <Individual>(); _species = A.Fake <Species>(); _species.Icon = "Human"; A.CallTo(() => _individualToEdit.Species).Returns(_species); _subPresenterItemManager = A.Fake <ISubPresenterItemManager <IIndividualItemPresenter> >(); A.CallTo(() => _subPresenterItemManager.AllSubPresenters).Returns(new IIndividualItemPresenter[] { _individualSettingsPresenter, _individualMoleculesPresenter }); A.CallTo(() => _individualSettingsPresenter.Individual).Returns(_individualToEdit); sut = new EditIndividualPresenter(_view, _subPresenterItemManager); sut.InitializeWith(_workspace); }
protected override Task Context() { _snapshotTask = A.Fake <ISnapshotTask>(); _jsonSerializer = A.Fake <IJsonSerializer>(); _workspace = A.Fake <ICoreWorkspace>(); _workspacePersistor = A.Fake <IWorkspacePersistor>(); _exportSimulationRunner = A.Fake <IExportSimulationRunner>(); _logger = A.Fake <ILogger>(); _dataRepositoryTask = A.Fake <IDataRepositoryTask>(); _markdownReporterTask = A.Fake <IMarkdownReporterTask>(); sut = new QualificationRunner(_snapshotTask, _jsonSerializer, _workspace, _workspacePersistor, _exportSimulationRunner, _dataRepositoryTask, _markdownReporterTask, _logger); _runOptions = new QualificationRunOptions(); _qualificationConfiguration = new QualifcationConfiguration(); return(_completed); }
public override void GlobalContext() { base.GlobalContext(); _templateIndividual = DomainFactoryForSpecs.CreateStandardIndividual(); var compound = DomainFactoryForSpecs.CreateStandardCompound(); var protocol = DomainFactoryForSpecs.CreateStandardIVBolusProtocol(); _simulation = DomainFactoryForSpecs.CreateSimulationWith(_templateIndividual, compound, protocol) as IndividualSimulation; _workspace = IoC.Resolve <ICoreWorkspace>(); var project = new PKSimProject(); project.AddBuildingBlock(compound); project.AddBuildingBlock(protocol); project.AddBuildingBlock(_simulation); project.AddBuildingBlock(_templateIndividual); _workspace.Project = project; }
public QualificationRunner(ISnapshotTask snapshotTask, IJsonSerializer jsonSerializer, ICoreWorkspace workspace, IWorkspacePersistor workspacePersistor, IExportSimulationRunner exportSimulationRunner, IDataRepositoryExportTask dataRepositoryExportTask, IMarkdownReporterTask markdownReporterTask, ILogger logger ) { _snapshotTask = snapshotTask; _jsonSerializer = jsonSerializer; _workspace = workspace; _workspacePersistor = workspacePersistor; _logger = logger; _exportSimulationRunner = exportSimulationRunner; _dataRepositoryExportTask = dataRepositoryExportTask; _markdownReporterTask = markdownReporterTask; }
protected override Task Context() { _logger = A.Fake <ILogger>(); _workspacePersitor = A.Fake <IWorkspacePersistor>(); _workspace = A.Fake <ICoreWorkspace>(); _simulationExporter = A.Fake <ISimulationExporter>(); _lazyLoadTask = A.Fake <ILazyLoadTask>(); sut = new ExportSimulationRunner(_logger, _workspacePersitor, _workspace, _simulationExporter, _lazyLoadTask); _project = new PKSimProject { Name = _projectName }; _simulation1 = createSimulationWithResults(_simulation1Name); _simulation2 = createSimulationWithResults(_simulation2Name); A.CallTo(() => _workspacePersitor.LoadSession(_workspace, _projectFileName)).Invokes(x => { _workspace.Project = _project; }); return(_completed); }
public void SaveSession(ICoreWorkspace workspace, string fileFullPath) { using (var progress = _progressManager.Create()) { progress.Initialize(5); progress.IncrementProgress(PKSimConstants.UI.CreatingProjectDatabase); _sessionManager.CreateFactoryFor(fileFullPath); using (var session = _sessionManager.OpenSession()) using (var transaction = session.BeginTransaction()) { progress.IncrementProgress(PKSimConstants.UI.SavingProject); workspace.UpdateJournalPathRelativeTo(fileFullPath); _projectPersistor.Save(workspace.Project, session); progress.IncrementProgress(PKSimConstants.UI.SavingHistory); _historyManagerPersistor.Save(workspace.HistoryManager, session); progress.IncrementProgress(PKSimConstants.UI.SavingLayout); if (workspace is IWithWorkspaceLayout withWorkspaceLayout) { _workspaceLayoutPersistor.Save(withWorkspaceLayout.WorkspaceLayout, session); } transaction.Commit(); } progress.IncrementProgress(PKSimConstants.UI.CompressionProject); _projectFileCompressor.Compress(fileFullPath); //once saved, we can _projectPersistor.UpdateProjectAfterSave(workspace.Project); } workspace.Project.Name = FileHelper.FileNameFromFileFullPath(fileFullPath); }
protected override void Context() { _view = A.Fake <IMenuAndToolBarView>(); _menuBarItemRepository = A.Fake <IMenuBarItemRepository>(); _buttonGroupRepository = A.Fake <IButtonGroupRepository>(); _mruProvider = A.Fake <IMRUProvider>(); _skinManager = A.Fake <ISkinManager>(); _workspace = A.Fake <ICoreWorkspace>(); _activeSubjectRetriever = A.Fake <IActiveSubjectRetriever>(); _startOptions = A.Fake <IStartOptions>(); sut = new MenuAndToolBarPresenter(_view, _menuBarItemRepository, _buttonGroupRepository, _mruProvider, _skinManager, _startOptions, _workspace, _activeSubjectRetriever); A.CallTo(() => _menuBarItemRepository[A <MenuBarItemId> ._]).ReturnsLazily(item => { { var id = item.Arguments[0].DowncastTo <MenuBarItemId>(); return(FindMenuById(id)); } }); }
public ObjectBaseDTOFactory(ICoreWorkspace workspace) { _workspace = workspace; }
protected override void ClearReferences() { _workspace = null; _project = null; }
public ExportHistoryToExcelCommand(ICoreWorkspace workspace, IReportTask reportTask, IDialogCreator dialogCreator) { _workspace = workspace; _reportTask = reportTask; _dialogCreator = dialogCreator; }
public EditDescriptionUICommand(ICoreWorkspace workspace, IEntityTask entityTask) { _workspace = workspace; _entityTask = entityTask; }
public OpenSingleStartPresenterInvoker(IApplicationController applicationController, ICoreWorkspace commandCollector) { _applicationController = applicationController; _commandCollector = commandCollector; }
protected override void Context() { _workspace = A.Fake <ICoreWorkspace>(); sut = new PKSimProjectRetriever(_workspace); }