protected override Task Context() { _containerTask = A.Fake <IContainerTask>(); _progressManager = A.Fake <IProgressManager>(); _individualCacheImporter = A.Fake <IIndividualPropertiesCacheImporter>(); _cloner = A.Fake <ICloner>(); _objectBaseFactory = A.Fake <IObjectBaseFactory>(); _advancedParameterFactory = A.Fake <IAdvancedParameterFactory>(); _createdPopulation = A.Fake <ImportPopulation>(); _individual = new Individual(); _cloneIndividual = new Individual(); A.CallTo(() => _cloner.Clone(_individual)).Returns(_cloneIndividual); A.CallTo(() => _objectBaseFactory.Create <ImportPopulation>()).Returns(_createdPopulation); A.CallTo(() => _createdPopulation.IndividualPropertiesCache).Returns(A.Fake <IndividualPropertiesCache>()); sut = new ImportPopulationFactory(_objectBaseFactory, _progressManager, _individualCacheImporter, _cloner, _containerTask, _advancedParameterFactory); A.CallTo(() => _containerTask.CacheAllChildren <IParameter>(_cloneIndividual)).Returns(_allParameters); A.CallTo(() => _containerTask.CacheAllChildrenSatisfying(_cloneIndividual, A <Func <IParameter, bool> > ._)).Returns(_allCreateIndividualParameters); _popFile1 = A.Fake <IndividualPropertiesCache>(); _popFile2 = A.Fake <IndividualPropertiesCache>(); A.CallTo(() => _individualCacheImporter.ImportFrom(_file1, _allParameters, A <IImportLogger> ._)).Returns(_popFile1); A.CallTo(() => _individualCacheImporter.ImportFrom(_file2, _allParameters, A <IImportLogger> ._)).Returns(_popFile2); return(_completed); }
public void Visit(ImportPopulationMetaData importPopulation) { var population = new ImportPopulation(); _serializationManager.Deserialize(population.Settings, importPopulation.Properties.Data); _buildingBlock = population; }
public override void GlobalContext() { base.GlobalContext(); _individual = DomainFactoryForSpecs.CreateStandardIndividual(); sut = IoC.Resolve <IImportPopulationFactory>(); _population = sut.CreateFor(new[] { DomainHelperForSpecs.PopulationFilePathFor("pop_3_advanced_parameter") }, _individual, new CancellationToken()).Result; }
public void Visit(ImportPopulation importPopulation) { _metaData = new ImportPopulationMetaData(); //no need to compress population data. This is mostly only double arrays serializeContentFor(importPopulation, compress: false); _metaData.Properties.Data = _serializationManager.Serialize(importPopulation.Settings); }
public async Task CreatePopulation() { _cancellationTokenSource = new CancellationTokenSource(); try { _view.CreatingPopulation = true; Population = await _importPopulationFactory.CreateFor(filesToImport, _importPopulationSettingsDTO.Individual, _cancellationTokenSource.Token); PopulationCreated = Population.ImportSuccessful; this.DoWithinLatch(updateViewForPopulation); raisePopulationCreationFinish(success: Population.ImportSuccessful, hasWarningOrError: Population.ImportHasWarningOrError); } catch (Exception e) { raisePopulationCreationFinish(success: false, hasWarningOrError: false); if (!(e is OperationCanceledException)) { throw; } } finally { _view.CreatingPopulation = false; } }
public void LoadPopulation(ImportPopulation population) { _view.UpdateLayoutForEditing(); Population = population; //do in latch since no update should be perform this.DoWithinLatch(updateViewForPopulation); PopulationCreated = true; }
protected override void Context() { base.Context(); _population = A.Fake <ImportPopulation>(); _population.Name = "toto"; A.CallTo(() => _importPopulationFactory.CreateFor(A <IReadOnlyList <string> > ._, _baseIndividual, A <CancellationToken> ._)) .Returns(_population); sut.PopulationCreationFinished += (o, e) => { _success = e.Success; _hasWarningOrError = e.HasWarningOrError; }; }
protected override void Context() { _containerTask = A.Fake <IContainerTask>(); _progressManager = A.Fake <IProgressManager>(); _individualCacheImporter = A.Fake <IIndividualPropertiesCacheImporter>(); _cloner = A.Fake <ICloner>(); _objectBaseFactory = A.Fake <IObjectBaseFactory>(); _advancedParameterFactory = A.Fake <IAdvancedParameterFactory>(); _createdPopulation = A.Fake <ImportPopulation>(); _individual = new Individual(); _cloneIndividual = new Individual(); A.CallTo(() => _cloner.Clone(_individual)).Returns(_cloneIndividual); A.CallTo(() => _objectBaseFactory.Create <ImportPopulation>()).Returns(_createdPopulation); A.CallTo(() => _createdPopulation.IndividualPropertiesCache).Returns(A.Fake <IndividualPropertiesCache>()); sut = new ImportPopulationFactory(_objectBaseFactory, _progressManager, _individualCacheImporter, _cloner, _containerTask, _advancedParameterFactory); _popFile1 = A.Fake <IndividualPropertiesCache>(); _popFile2 = A.Fake <IndividualPropertiesCache>(); A.CallTo(() => _individualCacheImporter.ImportFrom(_file1, A <IImportLogger> ._)).Returns(_popFile1); A.CallTo(() => _individualCacheImporter.ImportFrom(_file2, A <IImportLogger> ._)).Returns(_popFile2); }
public ImportPopulationContextMenu(ImportPopulation randomPopulation) : base(randomPopulation) { }
public void Visit(ImportPopulation objToVisit) { openPresenter(objToVisit); }
protected override void Context() { base.Context(); _population = A.Fake <ImportPopulation>(); A.CallTo(() => _importPopulationPresenter.BuildingBlock).Returns(_population); }