protected override void Context()
        {
            _newSimulation           = A.Fake <ISimulation>();
            _oldSimulation           = A.Fake <ISimulation>();
            _parameterIdentification = A.Fake <ParameterIdentification>();
            _outputMapping           = A.Fake <OutputMapping>();
            _outputMappings          = new[] { _outputMapping };
            _identificationParameter = new IdentificationParameter();
            _linkedParameter         = new ParameterSelection(_oldSimulation, "parameter|path");

            A.CallTo(() => _outputMapping.UsesSimulation(_oldSimulation)).Returns(true);

            sut = new ParameterIdentificationSimulationSwapValidator(new SimulationQuantitySelectionFinder());
        }
        protected override void Context()
        {
            base.Context();

            _outputMapping2 = A.Fake <OutputMapping>();
            A.CallTo(() => _outputMapping2.UsesSimulation(_simulation2)).Returns(true);

            _simulation2 = A.Fake <ISimulation>();
            _parameterIdentification.AddSimulation(_simulation2);

            _parameterIdentification.AddOutputMapping(_outputMapping2);

            _modelCoreSimulation2 = A.Fake <IModelCoreSimulation>();
            A.CallTo(() => _modelCoreSimulationMapper.MapFrom(_simulation2, true)).Returns(_modelCoreSimulation2);
        }
        protected override void Context()
        {
            _modelCoreSimulationMapper   = A.Fake <ISimulationToModelCoreSimulationMapper>();
            _residualCalculatorFactory   = A.Fake <IResidualCalculatorFactory>();
            _timeGridUpdater             = A.Fake <ITimeGridUpdater>();
            _simModelBatchFactory        = A.Fake <ISimModelBatchFactory>();
            _optimizationAlgorithmMapper = A.Fake <IParameterIdentificationAlgorithmToOptmizationAlgorithmMapper>();
            _outputSelectionUpdater      = A.Fake <IOutputSelectionUpdater>();
            _coreUserSettings            = A.Fake <ICoreUserSettings>();
            _jacobianMatrixCalculator    = A.Fake <IJacobianMatrixCalculator>();

            _coreUserSettings.MaximumNumberOfCoresToUse = 2;
            sut = new ParameterIdentificationRun(_residualCalculatorFactory, _timeGridUpdater, _simModelBatchFactory, _modelCoreSimulationMapper,
                                                 _optimizationAlgorithmMapper, _outputSelectionUpdater, _coreUserSettings, _jacobianMatrixCalculator);

            _simulation           = A.Fake <ISimulation>();
            _parameter1           = A.Fake <IParameter>();
            _parameter1.Dimension = DomainHelperForSpecs.ConcentrationDimensionForSpecs();
            _parameter1.Value     = 15;
            _parameter2           = A.Fake <IParameter>();
            _parameter2.Value     = 35;
            _parameter2.Dimension = DomainHelperForSpecs.ConcentrationDimensionForSpecs();

            _parameterIdentification = new ParameterIdentification();
            _parameterIdentification.Configuration.LLOQMode       = LLOQModes.OnlyObservedData;
            _parameterIdentification.Configuration.RemoveLLOQMode = RemoveLLOQModes.NoTrailing;

            _parameterIdentification.AddSimulation(_simulation);

            _parameterSelection1 = ParameterSelectionFor(_parameter1, "ParameterPath1");
            _parameterSelection2 = ParameterSelectionFor(_parameter2, "ParameterPath2");

            _identificationParameter = DomainHelperForSpecs.IdentificationParameter("IdParam", min: 10, max: 20, startValue: 15);

            _identificationParameter.AddLinkedParameter(_parameterSelection1);
            _identificationParameter.AddLinkedParameter(_parameterSelection2);

            _modelCoreSimulation = A.Fake <IModelCoreSimulation>();

            A.CallTo(() => _modelCoreSimulationMapper.MapFrom(_simulation, true)).Returns(_modelCoreSimulation);

            _outputMapping = A.Fake <OutputMapping>();
            A.CallTo(() => _outputMapping.UsesSimulation(_simulation)).Returns(true);
            A.CallTo(() => _outputMapping.WeightedObservedData.ObservedData).Returns(DomainHelperForSpecs.ObservedData());
            _parameterIdentification.AddOutputMapping(_outputMapping);

            _simModelBatch = A.Fake <ISimModelBatch>();
            A.CallTo(() => _simModelBatchFactory.Create()).Returns(_simModelBatch);

            _parameterIdentification.AddIdentificationParameter(_identificationParameter);

            _residualCalculator = A.Fake <IResidualCalculator>();
            A.CallTo(_residualCalculatorFactory).WithReturnType <IResidualCalculator>().Returns(_residualCalculator);

            _algorithm = A.Fake <IOptimizationAlgorithm>();
            A.CallTo(() => _optimizationAlgorithmMapper.MapFrom(_parameterIdentification.AlgorithmProperties)).Returns(_algorithm);

            _cancellationTokenSource = new CancellationTokenSource();
            _cancellationToken       = _cancellationTokenSource.Token;

            _runInitializer = A.Fake <IParameterIdentifcationRunInitializer>();
            A.CallTo(() => _runInitializer.InitializeRun()).ReturnsAsync(_parameterIdentification);

            PerformExtraInitializationSteps();
            sut.InitializeWith(_runInitializer);
        }