protected override void Context() { _cloneManager = A.Fake <ICloneManagerForModel>(); _simulationFactory = A.Fake <ICoreSimulationFactory>(); _parameterIdentificationRun = A.Fake <IParameterIdentificationRun>(); _coreUserSettings = A.Fake <ICoreUserSettings>(); _descriptionCreator = A.Fake <ICategorialParameterIdentificationDescriptionCreator>(); _container = A.Fake <Utility.Container.IContainer>(); A.CallTo(() => _container.Resolve <ICoreSimulationFactory>()).Returns(_simulationFactory); _coreUserSettings.MaximumNumberOfCoresToUse = 1; sut = new CategorialParameterIdentificationRunInitializer(_cloneManager, _parameterIdentificationRun, _container, _descriptionCreator, _coreUserSettings); _parameterIdentification = new ParameterIdentification(); _parameterIdentification.Configuration.RunMode = new CategorialParameterIdentificationRunMode(); _simulation = A.Fake <ISimulation>(); _clonedSimulation = A.Fake <ISimulation>(); A.CallTo(() => _simulationFactory.CreateWithCalculationMethodsFrom(_simulation, A <IEnumerable <CalculationMethodWithCompoundName> > ._)).Returns(_clonedSimulation); A.CallTo(() => _cloneManager.Clone(_parameterIdentification)).ReturnsLazily(() => { var pi = new ParameterIdentification(); pi.AddSimulation(_simulation); var identificationParameter = new IdentificationParameter(); identificationParameter.AddLinkedParameter(new ParameterSelection(_simulation, A.Fake <QuantitySelection>())); pi.AddIdentificationParameter(identificationParameter); pi.AddOutputMapping(new OutputMapping { OutputSelection = new SimulationQuantitySelection(_simulation, A.Fake <QuantitySelection>()) }); pi.Configuration.RunMode = new CategorialParameterIdentificationRunMode(); return(pi); }); }
public virtual T Create <T>(string id) where T : class, IObjectBase { var newObject = _container.Resolve <T>().WithId(id); updateDimension(newObject); updateCreationMetaData(newObject); return(newObject); }
private ISimulation createNewSimulationFrom(ISimulation simulation, IEnumerable <CalculationMethodWithCompoundName> combination) { //Always instantiate a new factory as some parameters might be global return(_container.Resolve <ICoreSimulationFactory>().CreateWithCalculationMethodsFrom(simulation, combination)); }