Пример #1
0
        protected override void Context()
        {
            _projectPersistor         = A.Fake <IProjectPersistor>();
            _historyManagerPersistor  = A.Fake <IHistoryManagerPersistor>();
            _progressManager          = A.Fake <IProgressManager>();
            _workspaceLayoutPersistor = A.Fake <IWorkspaceLayoutPersistor>();
            _historyManager           = A.Fake <IHistoryManager>();
            _projectFileCompressor    = A.Fake <IProjectFileCompressor>();
            _databaseSchemaMigrator   = A.Fake <IDatabaseSchemaMigrator>();
            _journalLoader            = A.Fake <IJournalLoader>();
            _projectClassifiableUpdaterAfterDeserialization = A.Fake <IProjectClassifiableUpdaterAfterDeserialization>();
            _command1 = A.Fake <IPKSimCommand>();
            _command2 = A.Fake <IPKSimCommand>();
            var history1 = A.Fake <IHistoryItem>();

            A.CallTo(() => history1.Command).Returns(_command1);
            var history2 = A.Fake <IHistoryItem>();

            A.CallTo(() => history2.Command).Returns(_command2);

            A.CallTo(() => _progressManager.Create()).Returns(A.Fake <IProgressUpdater>());
            A.CallTo(() => _historyManager.History).Returns(new[] { history1, history2 });
            _workspace = A.Fake <IWorkspace>();
            _workspace.HistoryManager = _historyManager;
            _session     = A.Fake <ISession>();
            _transaction = A.Fake <ITransaction>();
            A.CallTo(() => _session.BeginTransaction()).Returns(_transaction);
            _sessionManager = A.Fake <ISessionManager>();
            A.CallTo(() => _sessionManager.OpenSession()).Returns(_session);
            _fileName = "c:\\toto.txt";
            sut       = new WorkspacePersistor(_projectPersistor, _historyManagerPersistor, _workspaceLayoutPersistor, _sessionManager, _progressManager,
                                               _projectFileCompressor, _databaseSchemaMigrator, _journalLoader, _projectClassifiableUpdaterAfterDeserialization);
        }
 protected override void Context()
 {
     base.Context();
     _process       = A.Fake <SystemicProcess>();
     _renameCommand = A.Fake <IPKSimCommand>();
     A.CallTo(() => _compoundProcessTask.RenameDataSource(_process)).Returns(_renameCommand);
 }
Пример #3
0
 protected override void Context()
 {
     base.Context();
     _createIndividualCommand = A.Fake <IPKSimCommand>();
     A.CallTo(() => _createIndividualPresenter.Create()).Returns(_createIndividualCommand);
     A.CallTo(() => _createIndividualPresenter.BuildingBlock).Returns(_individual);
 }
Пример #4
0
 protected override void Context()
 {
     base.Context();
     _addCommand = A.Fake <IPKSimCommand>();
     A.CallTo(() => _simulationSettingsTask.AddSimulationIntervalTo(_outputSchema)).Returns(_addCommand);
     sut.EditSettingsFor(_simulationToEdit);
 }
 protected override void Context()
 {
     base.Context();
     _command = A.Fake <IPKSimCommand>();
     A.CallTo(() => _moleculeExpressionTask.AddDefaultMolecule <IndividualEnzyme>(_individual)).Returns(_command);
     sut.EditIndividual(_individual);
 }
        protected override async Task Context()
        {
            await base.Context();

            _command = A.Fake <IPKSimCommand>();
            A.CallTo(() => _entityTask.Rename(_buildingBlock)).Returns(_command);
        }
 protected override void Context()
 {
     base.Context();
     _percentileInPercent           = 50;
     _percentileInFraction          = _percentileInPercent / 100;
     _parameterPercentileSetCommand = A.Fake <IPKSimCommand>();
     A.CallTo(() => _parameterTask.SetParameterPercentile(_parameter, _percentileInFraction)).Returns(_parameterPercentileSetCommand);
 }
        protected override void Context()
        {
            base.Context();

            _addCommand = new PKSimMacroCommand();

            A.CallTo(() => _compoundAlternativePresentationTask.AddParameterGroupAlternativeTo(A <ParameterAlternativeGroup> ._)).Returns(_addCommand);
        }
 protected override void Context()
 {
     base.Context();
     _command         = new PKSimMacroCommand();
     _originalCommand = new PKSimMacroCommand {
         BuildingBlockType = "BB", BuildingBlockName = "Name"
     };
 }
 protected override void Context()
 {
     base.Context();
     _command1 = A.Fake <IPKSimCommand>();
     _command2 = A.Fake <IPKSimCommand>();
     sut.AddCommand(_command1);
     sut.AddCommand(_command2);
 }
Пример #11
0
 protected override void Context()
 {
     base.Context();
     _valueInGuiUnit = 20;
     _command        = A.Fake <IPKSimCommand>();
     _parameterDTO   = A.Fake <ParameterDTO>();
     A.CallTo(() => _parameterDTO.Parameter).Returns(A.Fake <IParameter>());
     A.CallTo(() => _parameterTask.SetAdvancedParameterDisplayValue(_parameterDTO.Parameter, _valueInGuiUnit)).Returns(_command);
 }
Пример #12
0
 protected override void Context()
 {
     base.Context();
     _unit         = A.Fake <Unit>();
     _parameterDTO = A.Fake <ParameterDTO>();
     _command      = A.Fake <IPKSimCommand>();
     A.CallTo(() => _parameterDTO.Parameter).Returns(A.Fake <IParameter>());
     A.CallTo(() => _parameterTask.SetAdvancedParameterUnit(_parameterDTO.Parameter, _unit)).Returns(_command);
 }
 protected override void Context()
 {
     base.Context();
     _command           = A.Fake <IPKSimCommand>();
     _advancedParameter = new AdvancedParameter();
     _advancedParameter.ParameterPath = _pathAdvancedPara1;
     A.CallTo(() => _advancedParametersTask.SwitchDistributionTypeFor(_advancedPara1, _population, DistributionTypes.Normal)).Returns(_command);
     sut.EditPopulation(_population);
 }
Пример #14
0
        protected override void Context()
        {
            base.Context();
            _setParameterValueCommand       = A.Fake <IPKSimCommand>();
            _setParameterValueOriginCommand = A.Fake <IPKSimCommand>();

            A.CallTo(() => _parameterTask.SetParameterValue(_targetParameter, _sourceParameter.Value, true)).Returns(_setParameterValueCommand);
            A.CallTo(() => _parameterTask.SetParameterValueOrigin(_targetParameter, _sourceParameter.ValueOrigin)).Returns(_setParameterValueOriginCommand);
        }
Пример #15
0
 protected override void Context()
 {
     base.Context();
     _allParameters     = new List <IParameter>();
     _newMolWeightValue = 13;
     _command           = A.Fake <IPKSimCommand>();
     A.CallTo(() => _parameterTask.SetParameterDisplayValue(_molWeightParameter, _newMolWeightValue)).Returns(_command);
     sut.EditCompoundParameters(_allParameters);
 }
Пример #16
0
 protected override void Context()
 {
     base.Context();
     _selectedOntogeny = new DatabaseOntogeny();
     _individual       = A.Fake <Individual>();
     _protein          = A.Fake <IndividualProtein>();
     _command          = A.Fake <IPKSimCommand>();
     A.CallTo(() => _ontogenyTask.SetOntogenyForMolecule(_protein, _selectedOntogeny, _individual)).Returns(_command);
     sut.Edit(_protein, _individual);
 }
Пример #17
0
 public static T UpdatePropertiesFrom <T>(this T command, IPKSimCommand originalCommand) where T : IPKSimCommand
 {
     if (originalCommand == null)
     {
         return(command);
     }
     command.BuildingBlockName = originalCommand.BuildingBlockName;
     command.BuildingBlockType = originalCommand.BuildingBlockType;
     return(command);
 }
Пример #18
0
 protected override void Context()
 {
     base.Context();
     _simulation            = A.Fake <Simulation>();
     _templateBuildingBlock = A.Fake <IPKSimBuildingBlock>();
     _updateCommand         = A.Fake <IPKSimCommand>();
     _usedBuildingBlock     = A.Fake <UsedBuildingBlock>();
     A.CallTo(() => _simulationBuildingBlockUpdater.QuickUpdatePossibleFor(_templateBuildingBlock, _usedBuildingBlock)).Returns(true);
     A.CallTo(() => _blockParametersToSimulationUpdater.UpdateParametersFromBuildingBlockInSimulation(_templateBuildingBlock, _simulation)).Returns(_updateCommand);
 }
Пример #19
0
 protected override void Context()
 {
     _command         = A.Fake <IPKSimCommand>();
     _targetParameter = A.Fake <IParameter>();
     _sourceParameter = A.Fake <IParameter>();
     _scalingMethod   = A.Fake <ScalingMethod>();
     sut = new ParameterScaling(_sourceParameter, _targetParameter);
     sut.ScalingMethod = _scalingMethod;
     A.CallTo(() => _scalingMethod.Scale(sut)).Returns(_command);
 }
 protected override void Context()
 {
     base.Context();
     _command         = A.Fake <IPKSimCommand>();
     _proteinToRemove = A.Fake <IndividualEnzyme>().WithName("Trlala");
     _proteinType     = "toto";
     A.CallTo(() => _moleculeExpressionTask.RemoveMoleculeFrom(_proteinToRemove, _individual)).Returns(_command);
     A.CallTo(() => _dialogCreator.MessageBoxYesNo(A <string> .Ignored, ViewResult.Yes)).Returns(ViewResult.Yes);
     A.CallTo(() => _entityTask.TypeFor(_proteinToRemove)).Returns(_proteinType);
     sut.EditIndividual(_individual);
 }
Пример #21
0
 protected override void Context()
 {
     base.Context();
     _populationSimulation             = A.Fake <PopulationSimulation>();
     _simulationResults                = new SimulationResults();
     _importSimulationResultsPresenter = A.Fake <IImportSimulationResultsPresenter>();
     A.CallTo(() => _applicationController.Start <IImportSimulationResultsPresenter>()).Returns(_importSimulationResultsPresenter);
     A.CallTo(() => _importSimulationResultsPresenter.ImportResultsFor(_populationSimulation)).Returns(_simulationResults);
     A.CallTo(() => _buildingBlockTask.AddCommandToHistory(A <IPKSimCommand> ._))
     .Invokes(x => _command = x.GetArgument <IPKSimCommand>(0));
 }
Пример #22
0
        protected override void Context()
        {
            base.Context();
            _templatePresenter   = A.Fake <ITemplatePresenter>();
            _templateObserverSet = new ObserverSet();
            A.CallTo(() => _applicationController.Start <ITemplatePresenter>()).Returns(_templatePresenter);
            A.CallTo(_templatePresenter).WithReturnType <IReadOnlyList <ObserverSet> >().Returns(new[] { _templateObserverSet });

            A.CallTo(() => _executionContext.AddToHistory((A <IPKSimCommand> ._)))
            .Invokes(x => _command = x.GetArgument <IPKSimCommand>(0));
        }
        protected override void Context()
        {
            _macroCommand                     = new PKSimMacroCommand();
            _macroCommand.Description         = "my name is " + CoreConstants.ContainerName.NameTemplate;
            _macroCommand.ExtendedDescription = "my extended is " + CoreConstants.ContainerName.NameTemplate;

            _subCommand                     = A.Fake <IPKSimCommand>();
            _subCommand.Description         = null;
            _subCommand.ExtendedDescription = "extended is " + CoreConstants.ContainerName.NameTemplate;

            _macroCommand.Add(_subCommand);
        }
Пример #24
0
        public void UpdateBuildinBlockProperties(IPKSimCommand command, IPKSimBuildingBlock buildingBlock)
        {
            if (buildingBlock == null)
            {
                command.BuildingBlockType = CoreConstants.ContainerName.TypeTemplate;
                command.BuildingBlockName = CoreConstants.ContainerName.NameTemplate;
                return;
            }

            command.BuildingBlockType = TypeFor(buildingBlock);
            command.BuildingBlockName = string.IsNullOrEmpty(buildingBlock.Name) ? CoreConstants.ContainerName.NameTemplate : buildingBlock.Name;
        }
        protected override async Task Context()
        {
            await base.Context();

            _templatePresenter  = A.Fake <ITemplatePresenter>();
            _templateIndividual = new Individual();
            A.CallTo(() => _applicationController.Start <ITemplatePresenter>()).Returns(_templatePresenter);
            A.CallTo(_templatePresenter).WithReturnType <Task <IReadOnlyList <IPKSimBuildingBlock> > >().Returns(new[] { _templateIndividual });

            A.CallTo(() => _executionContext.AddToHistory((A <IPKSimCommand> ._)))
            .Invokes(x => _command = x.GetArgument <IPKSimCommand>(0));
        }
Пример #26
0
 protected override void Context()
 {
     base.Context();
     _removeCommand  = A.Fake <IPKSimCommand>();
     _oneIntervalDTO = new OutputIntervalDTO();
     _oneInterval    = A.Fake <OutputInterval>();
     _oneIntervalDTO.OutputInterval = _oneInterval;
     A.CallTo(() => _simulationSettingsTask.RemoveSimulationIntervalFrom(_oneInterval, _outputSchema)).Returns(_removeCommand);
     A.CallTo(() => _outputIntervalToOutputIntervalDTOMapper.MapFrom(_oneInterval)).Returns(_oneIntervalDTO);
     _allIntervals.Add(_oneInterval);
     sut.EditSettingsFor(_simulationToEdit);
 }
Пример #27
0
        protected override void Context()
        {
            base.Context();
            _templatePresenter  = A.Fake <ITemplatePresenter>();
            _templateIndividual = new Individual().WithName("Existing");
            _existingIndividual = new Individual().WithName("ExiStIng");
            A.CallTo(() => _applicationController.Start <ITemplatePresenter>()).Returns(_templatePresenter);
            A.CallTo(_templatePresenter).WithReturnType <IReadOnlyList <ISimulationSubject> >().Returns(new[] { _templateIndividual });
            A.CallTo(() => _project.All(_templateIndividual.BuildingBlockType)).Returns(new[] { _existingIndividual });

            A.CallTo(() => _executionContext.AddToHistory((A <IPKSimCommand> ._)))
            .Invokes(x => _command = x.GetArgument <IPKSimCommand>(0));
        }
Пример #28
0
        protected override void Context()
        {
            base.Context();
            _command           = A.Fake <IPKSimCommand>();
            _simulationToClone = A.Fake <Simulation>().WithName("OLD");
            _clonedSimulation  = A.Fake <Simulation>().WithName("NEW");

            _cloneSimulationPresenter = A.Fake <ICloneSimulationPresenter>();
            A.CallTo(() => _applicationController.Start <ICloneSimulationPresenter>()).Returns(_cloneSimulationPresenter);
            A.CallTo(() => _cloneSimulationPresenter.CloneSimulation(_simulationToClone)).Returns(_command);
            A.CallTo(() => _cloneSimulationPresenter.Simulation).Returns(_clonedSimulation);
            A.CallTo(() => _buildingBlockInSimulationManager.StatusFor(_simulationToClone)).Returns(BuildingBlockStatus.Green);
            A.CallTo(() => _cloneSimulationPresenter.CloneName).Returns("NEW");
        }
Пример #29
0
 protected override void Context()
 {
     base.Context();
     _targetIndividual = A.Fake <PKSim.Core.Model.Individual>();
     _sourceIndividual = A.Fake <PKSim.Core.Model.Individual>();
     _subCommand       = A.Fake <IPKSimCommand>();
     _scalingCommand   = new List <IPKSimCommand> {
         _subCommand
     };
     A.CallTo(() => _individualScalingTask.AllParameterScalingsFrom(_sourceIndividual, _targetIndividual)).Returns(new List <ParameterScaling>());
     A.CallTo(() => _view.HasError).Returns(false);
     A.CallTo(() => _individualScalingTask.PerformScaling(A <IEnumerable <ParameterScaling> > ._)).Returns(_scalingCommand);
     sut.ConfigureScaling(_sourceIndividual, _targetIndividual);
 }
 protected override void Context()
 {
     base.Context();
     _schemaDTO  = A.Fake <SchemaDTO>();
     _schemaItem = A.Fake <SchemaItem>();
     _schema     = A.Fake <Schema>();
     _deleteSchemaItemCommand            = A.Fake <IPKSimCommand>();
     _schemaItemDTOToDelete              = DomainHelperForSpecs.SchemaItemDTO(ApplicationTypes.Intravenous);
     _schemaItemDTOToDelete.ParentSchema = _schemaDTO;
     _schemaItemToDelete = _schemaItemDTOToDelete.SchemaItem;
     A.CallTo(() => _schemaDTO.Schema).Returns(_schema);
     A.CallTo(() => _schema.SchemaItems).Returns(new[] { _schemaItem, _schemaItemToDelete });
     A.CallTo(() => _protocolTask.RemoveSchemaItemFrom(_schemaItemToDelete, _schema)).Returns(_deleteSchemaItemCommand);
 }