public override void GlobalContext() { base.GlobalContext(); _project = LoadProject("331_TestGI"); _spatialStructure = _project.SpatialStructureCollection.First(); _organism = _spatialStructure.TopContainers.FindByName(Constants.ORGANISM); }
public void UpdateSpatialStructre(IMoBiSpatialStructure spatialStructure) { foreach (var topContainer in spatialStructure.TopContainers) { UpdateContainerTo3_1_3(topContainer); } }
protected override void Context() { base.Context(); _spatialStructure = A.Fake <IMoBiSpatialStructure>(); _topContainer = A.Fake <IContainer>(); A.CallTo(() => _spatialStructure.TopContainers).Returns(new[] { _topContainer }); }
private SpatialStructureDTO createSpatialStuctureDTOFrom(IMoBiSpatialStructure spatialStructure) { var dto = new SpatialStructureDTO(); dto.Id = spatialStructure.Id; dto.Name = spatialStructure.Name; dto.Icon = spatialStructure.Icon; if (_localisation.Is(Localisations.ContainerOnly)) { dto.TopContainer = spatialStructure.TopContainers.MapAllUsing(_dtoContainerMapper); } if (_localisation.Is(Localisations.NeighborhoodsOnly)) { dto.Neighborhoods = _dtoContainerMapper.MapFrom(spatialStructure.NeighborhoodsContainer); } if (_localisation.Is(Localisations.Everywhere)) { dto.TopContainer = spatialStructure.TopContainers.MapAllUsing(_dtoContainerMapper); dto.Neighborhoods = _dtoContainerMapper.MapFrom(spatialStructure.NeighborhoodsContainer); } return(dto); }
protected override void Context() { base.Context(); _parent = new Container().WithName("bla"); _distributedParameter = new DistributedParameter().WithName("Dis").WithParentContainer(_parent); _spatialStructure = new MoBiSpatialStructure().WithTopContainer(_parent); sut.Edit(_spatialStructure); }
protected override void Context() { base.Context(); _cloneManager = A.Fake <ICloneManager>(); _diagramManager = A.Fake <ISpatialStructureDiagramManager>(); _spatialStructure = new MoBiSpatialStructure { DiagramManager = _diagramManager }; }
/// <summary> /// Creates the Spatial Structure of the SBML Model with the TopContainer. /// </summary> internal void CreateSpatialStructureFromModel(IContainer topContainer, Model model) { SpatialStructure = _spatialStructureFactory.Create().DowncastTo <IMoBiSpatialStructure>() .WithName(SBMLConstants.SBML_MODEL + model.getName()) .WithTopContainer(topContainer) .WithDescription(SBMLConstants.SBML_NOTES + model.getNotesString() + SBMLConstants.SPACE + SBMLConstants.SBML_METAID + model.getMetaId()); SpatialStructure.AddTopContainer(_eventsTopContainer); }
protected SpatialStructureDTO CreateSpatialStuctureDTOFrom(IMoBiSpatialStructure spatialStructure) { return(new SpatialStructureDTO { Id = spatialStructure.Id, Name = spatialStructure.Name, Icon = spatialStructure.Icon, TopContainer = spatialStructure.TopContainers.MapAllUsing(_containerDTOMapper), Neighborhoods = _containerDTOMapper.MapFrom(spatialStructure.NeighborhoodsContainer) }); }
protected override void Context() { base.Context(); _returnedBuildingBlocks = new List <IBuildingBlock>(); _childReactionBuilder = new ReactionBuilder().WithName("Test").WithId("FindME"); _reactionParameter = new Parameter().WithName("Para").WithId("ReactionPara"); _childReactionBuilder.AddParameter(_reactionParameter); _reactionBuildingBlock = new MoBiReactionBuildingBlock() { _childReactionBuilder }; _allBuildingBlocks.Add(_reactionBuildingBlock); _moleculeBuilder = new MoleculeBuilder(); _moleculeParameter = new Parameter().WithName("para"); _moleculeBuilder.AddParameter(_moleculeParameter); _moleculeBuildingBlock = new MoleculeBuildingBlock() { _moleculeBuilder }; _allBuildingBlocks.Add(_moleculeBuildingBlock); _passiveTranportBuilder = new TransportBuilder(); _passiveTransportParameter = new Parameter().WithName("PTParameter"); _passiveTranportBuilder.AddParameter(_passiveTransportParameter); _passiveTranportBuildingBlock = new PassiveTransportBuildingBlock() { _passiveTranportBuilder }; _allBuildingBlocks.Add(_passiveTranportBuildingBlock); _applicationBuilder = new ApplicationBuilder(); _eventGroupBuildingBlock = new EventGroupBuildingBlock() { _applicationBuilder }; _applicationBuilderParameter = new ApplicationBuilder().WithName("AppParameter"); _applicationBuilder.Add(_applicationBuilderParameter); _allBuildingBlocks.Add(_eventGroupBuildingBlock); _parameter = new Parameter().WithName("Para"); var container = new Container().WithName("Cont"); container.Add(_parameter); _objectBaseFactory = A.Fake <IObjectBaseFactory>(); _parameterFactory = A.Fake <IParameterFactory>(); A.CallTo(() => _objectBaseFactory.Create <IContainer>()).Returns(new Container()); A.CallTo(() => _objectBaseFactory.Create <IMoBiSpatialStructure>()).Returns(new MoBiSpatialStructure()); var diagramManagerFactory = A.Fake <IDiagramManagerFactory>(); _spatialStructure = new MoBiSpatialStructureFactory(_objectBaseFactory, _parameterFactory, A.Fake <IIconRepository>(), diagramManagerFactory).Create() as IMoBiSpatialStructure; _spatialStructure.AddTopContainer(container); _allBuildingBlocks.Add(_spatialStructure); _formula = new ExplicitFormula(); _moleculeBuildingBlock.AddFormula(_formula); }
protected override void Context() { _objectBaseFactory = A.Fake <IObjectBaseFactory>(); _parameterFactory = A.Fake <IParameterFactory>(); _iconRepository = A.Fake <IIconRepository>(); _volumeParameter = A.Fake <IParameter>().WithName(Constants.Parameters.VOLUME); A.CallTo(() => _parameterFactory.CreateVolumeParameter()).Returns(_volumeParameter); _spatialStructure = new MoBiSpatialStructure(); A.CallTo(() => _objectBaseFactory.Create <IMoBiSpatialStructure>()).Returns(_spatialStructure); A.CallTo(() => _objectBaseFactory.Create <IContainer>()).ReturnsLazily(x => new Container()); _diagramManagerFactory = A.Fake <IDiagramManagerFactory>(); sut = new MoBiSpatialStructureFactory(_objectBaseFactory, _parameterFactory, _iconRepository, _diagramManagerFactory); }
protected override void Context() { base.Context(); _spatialStructure = new MoBiSpatialStructure() { Id = "1" }; _project = new MoBiProject(); _project.AddBuildingBlock(new MoleculeStartValuesBuildingBlock { SpatialStructureId = _spatialStructure.Id, MoleculeBuildingBlockId = "" }); }
protected override void Context() { _view = A.Fake <IEditFavoritesView>(); _editParameterListPresenter = A.Fake <IEditParameterListPresenter>(); _favoriteRepository = A.Fake <IFavoriteRepository>(); _entityPathResolver = new EntityPathResolver(new ObjectPathFactory(A.Fake <IAliasCreator>())); _favoriteTask = A.Fake <IFavoriteTask>(); sut = new EditFavoritesInSpatialStructurePresenter(_view, _favoriteRepository, _entityPathResolver, _editParameterListPresenter, _favoriteTask); _spatialStructure = new MoBiSpatialStructure(); var cont = new Container().WithName("root"); _para = new Parameter().WithName("P").WithParentContainer(cont); _fav = new Parameter().WithName("F").WithParentContainer(cont); _spatialStructure.AddTopContainer(cont); A.CallTo(() => _favoriteRepository.All()).Returns(new[] { _entityPathResolver.PathFor(_fav) }); }
protected override void Context() { _spatialStructureDiagramManager = A.Fake <ISpatialStructureDiagramManager>(); _spatialStructure = new MoBiSpatialStructure { DiagramManager = _spatialStructureDiagramManager }.WithName("SpSt"); _spatialStructure.NeighborhoodsContainer = new Container().WithName(Constants.NEIGHBORHOODS); _parent = new Container().WithName("Top").WithMode(ContainerMode.Logical).WithId(_parentId); _containerToRemove = new Container().WithName("A").WithMode(ContainerMode.Physical).WithParentContainer(_parent); _otherContainer = new Container().WithName("B").WithMode(ContainerMode.Physical).WithParentContainer(_parent); _spatialStructure.AddTopContainer(_parent); _neighborhood = new NeighborhoodBuilder().WithFirstNeighbor(_containerToRemove).WithSecondNeighbor(_otherContainer).WithName("A2B"); _spatialStructure.AddNeighborhood(_neighborhood); _context = A.Fake <IMoBiContext>(); sut = new RemoveContainerFromSpatialStructureCommand(_parent, _containerToRemove, _spatialStructure); }
protected override void Context() { _buildConfiguration = new MoBiBuildConfiguration(); _moleculeBuidingBlock = new MoleculeBuildingBlock().WithName("M"); _buildConfiguration.Molecules = _moleculeBuidingBlock; _reactionBuildingBlock = new MoBiReactionBuildingBlock().WithName("R"); _reactionBuildingBlock.Add(new ReactionBuilder().WithName("R1")); _buildConfiguration.Reactions = _reactionBuildingBlock; _passiveTransportBuildingBlock = new PassiveTransportBuildingBlock().WithName("PT"); _passiveTransportBuildingBlock.Add(new TransportBuilder().WithName("PT2")); _passiveTransportBuildingBlock.Add(new TransportBuilder().WithName("PT1")); _buildConfiguration.PassiveTransports = _passiveTransportBuildingBlock; _eventGroupBuildingBlock = new EventGroupBuildingBlock().WithName("EG"); _buildConfiguration.EventGroups = _eventGroupBuildingBlock; _msvBuildingBlock = new MoleculeStartValuesBuildingBlock().WithName("MSV"); _buildConfiguration.MoleculeStartValues = _msvBuildingBlock; _psvBuildingBlock = new ParameterStartValuesBuildingBlock().WithName("PSV"); _buildConfiguration.ParameterStartValues = _psvBuildingBlock; _spatialStructure = new MoBiSpatialStructure().WithName("SPST"); _buildConfiguration.SpatialStructure = _spatialStructure; _observerBuildingBlock = new ObserverBuildingBlock().WithName("O"); _buildConfiguration.Observers = _observerBuildingBlock; _objectPathFactory = new ObjectPathFactory(new AliasCreator()); _entityPathResolver = new EntityPathResolver(_objectPathFactory); sut = new AffectedBuildingBlockRetriever(_entityPathResolver); //common setup _simulation = new MoBiSimulation { BuildConfiguration = _buildConfiguration }; }
protected override void Context() { base.Context(); _project = A.Fake <IMoBiProject>(); _objectBaseRepository = A.Fake <IWithIdRepository>(); _spatialStructure = A.Fake <IMoBiSpatialStructure>(); _simulationSettings = A.Fake <ISimulationSettings>(); _moBiReactionBuildingBlock = A.Fake <IMoBiReactionBuildingBlock>(); _moleculeBuildingBlock = A.Fake <IMoleculeBuildingBlock>(); A.CallTo(() => _context.CurrentProject).Returns(_project); A.CallTo(() => _context.Create <IMoleculeBuildingBlock>()).Returns(_moleculeBuildingBlock); A.CallTo(() => _context.Create <IMoBiReactionBuildingBlock>()).Returns(_moBiReactionBuildingBlock); A.CallTo(() => _spatialStructureFactory.CreateDefault(AppConstants.DefaultNames.SpatialStructure)).Returns(_spatialStructure); A.CallTo(() => _simulationSettingsFactory.CreateDefault()).Returns(_simulationSettings); _topContainer = A.Fake <IContainer>(); A.CallTo(() => _context.Create <IContainer>()).Returns(_topContainer); _passiveTransportBuildingBlock = A.Fake <IPassiveTransportBuildingBlock>(); A.CallTo(() => _context.Create <IPassiveTransportBuildingBlock>()).Returns(_passiveTransportBuildingBlock); _observerBuildingBlock = A.Fake <IObserverBuildingBlock>(); A.CallTo(() => _context.Create <IObserverBuildingBlock>()).Returns(_observerBuildingBlock); _eventGroupBuildingBlock = A.Fake <IEventGroupBuildingBlock>(); A.CallTo(() => _context.Create <IEventGroupBuildingBlock>()).Returns(_eventGroupBuildingBlock); A.CallTo(() => _context.ObjectRepository).Returns(_objectBaseRepository); }
private StartValuesDTO createDto(string name, IMoleculeBuildingBlock moleculeBuildingBlock, IMoBiSpatialStructure spatialStructure) { var dto = new StartValuesDTO { Name = name, Molecules = moleculeBuildingBlock, SpatialStructrue = spatialStructure }; dto.AddUsedNames(AppConstants.UnallowedNames); dto.AddUsedNames(_unallowedNames); return(dto); }
private static IParameter searchParameterInContainers(IObjectPath parameterPath, IMoBiSpatialStructure spatialStructure) { if (spatialStructure == null) { return(null); } IParameter parameter = null; foreach (var top in spatialStructure.TopContainers) { parameter = parameterPath.Resolve <IParameter>(top); if (parameter != null) { break; } } if (parameter == null) { parameter = parameterPath.Resolve <IParameter>(spatialStructure.NeighborhoodsContainer); } return(parameter); }
public void Visit(IMoBiSpatialStructure objToVisit) { retrieveTask(objToVisit); }
public override void RestoreExecutionData(IMoBiContext context) { base.RestoreExecutionData(context); _spatialStructure = context.Get <IMoBiSpatialStructure>(SpatialStructureId); }
protected override void ClearReferences() { base.ClearReferences(); _spatialStructure = null; // Keep references to neighborhoods to execute the reverse command. }
protected override void ClearReferences() { base.ClearReferences(); _spatialStructure = null; }
public RemoveContainerFromSpatialStructureCommand(IContainer parent, IContainer childToRemove, IMoBiSpatialStructure spatialStructure) : base(parent, childToRemove, spatialStructure) { _spatialStructure = spatialStructure; SpatialStructureId = _spatialStructure.Id; }
protected override void Context() { base.Context(); _returnedBuildingBlocks = new List <IBuildingBlock>(); _childReactionBuilder = new ReactionBuilder().WithName("Test").WithId("FindME"); _reactionBuildingBlock = new MoBiReactionBuildingBlock() { _childReactionBuilder }; _allBuildingBlocks.Add(_reactionBuildingBlock); _moleculeBuilder = new MoleculeBuilder(); _moleculeBuildingBlock = new MoleculeBuildingBlock() { _moleculeBuilder }; _allBuildingBlocks.Add(_moleculeBuildingBlock); _obseverBuilder = new ObserverBuilder(); _observerBuildingBlock = new ObserverBuildingBlock() { _obseverBuilder }; _allBuildingBlocks.Add(_observerBuildingBlock); _passiveTranportBuilder = new TransportBuilder(); _passiveTranportBuildingBlock = new PassiveTransportBuildingBlock() { _passiveTranportBuilder }; _allBuildingBlocks.Add(_passiveTranportBuildingBlock); _applicationBuilder = new ApplicationBuilder(); _eventGroupBuildingBlock = new EventGroupBuildingBlock() { _applicationBuilder }; _allBuildingBlocks.Add(_eventGroupBuildingBlock); _parameter = new Parameter().WithName("Para"); var container = new Container().WithName("Cont"); container.Add(_parameter); _objectBaseFactory = A.Fake <IObjectBaseFactory>(); _parmaeterFactory = A.Fake <IParameterFactory>(); A.CallTo(() => _objectBaseFactory.Create <IContainer>()).Returns(A.Fake <IContainer>()); A.CallTo(() => _objectBaseFactory.Create <IMoBiSpatialStructure>()).Returns(new MoBiSpatialStructure()); var diagramManagerFactory = A.Fake <IDiagramManagerFactory>(); _spatialStructure = new MoBiSpatialStructureFactory(_objectBaseFactory, _parmaeterFactory, A.Fake <IconRepository>(), diagramManagerFactory).Create().DowncastTo <IMoBiSpatialStructure>(); _spatialStructure.AddTopContainer(container); _allBuildingBlocks.Add(_spatialStructure); _formula = new ExplicitFormula(); _moleculeBuildingBlock.AddFormula(_formula); _parameterStartValue = new ParameterStartValue { Path = new ObjectPath { "test" }, StartValue = 1, Dimension = A.Fake <IDimension>() }; _parameterStartValueBuildingBlock = new ParameterStartValuesBuildingBlock() { _parameterStartValue }; _allBuildingBlocks.Add(_parameterStartValueBuildingBlock); _moleculeStartValue = new MoleculeStartValue { ContainerPath = new ObjectPath { "test" }, Name = "drug" }; _moleculeStartValuesBuildingBlock = new MoleculeStartValuesBuildingBlock() { _moleculeStartValue }; _allBuildingBlocks.Add(_moleculeStartValuesBuildingBlock); }
public AddContainerToSpatialStructureCommand(IContainer parent, IContainer child, IMoBiSpatialStructure spatialStructure) : base(parent, child, spatialStructure) { _spatialStructure = spatialStructure; SpatialStructureId = spatialStructure.Id; }
private bool addNeighborhood(INeighborhoodBuilder neighborhoodBuilder, MoBiMacroCommand command, IMoBiSpatialStructure spatialStructure) { var forbiddenNames = spatialStructure.NeighborhoodsContainer.Children.Select(x => x.Name).Union(AppConstants.UnallowedNames).ToList(); if (forbiddenNames.Contains(neighborhoodBuilder.Name)) { string newName = _dialogCreator.AskForInput(AppConstants.Dialog.AskForChangedName(neighborhoodBuilder.Name, ObjectTypes.NeighborhoodBuilder), AppConstants.Captions.NewName, neighborhoodBuilder.Name, forbiddenNames); if (string.IsNullOrEmpty(newName)) { return(false); } neighborhoodBuilder.Name = newName; } command.AddCommand(new AddContainerToSpatialStructureCommand(spatialStructure.NeighborhoodsContainer, neighborhoodBuilder, spatialStructure).Run(Context)); return(true); }
protected override void Context() { base.Context(); _spSt = A.Fake <IMoBiSpatialStructure>(); sut.Edit(_spSt); }
protected override void Because() { _result = sut.CreateDefault(AppConstants.DefaultNames.SpatialStructure); }
private void removeNeighborhoods(IContainer entityToRemove, Cache <string, INeighborhoodBuilder> removedIds, IMoBiSpatialStructure spatialStructure, IMoBiContext context) { var containerTask = context.Resolve <IContainerTask>(); var neighborhoodsToDelete = containerTask.AllNeighborhoodBuildersConnectedWith(spatialStructure, entityToRemove).ToList(); foreach (var neighborhoodBuilder in neighborhoodsToDelete) { if (!removedIds.Contains(neighborhoodBuilder.Id)) { spatialStructure.RemoveNeighborhood(neighborhoodBuilder); spatialStructure.DiagramManager.RemoveObjectBase(neighborhoodBuilder); removedIds.Add(neighborhoodBuilder); } } }
private IMoBiCommand addNeighborhoodsToProject(IList <INeighborhoodBuilder> neighborhoods, IMoBiSpatialStructure spatialStructure) { if (neighborhoods == null || !neighborhoods.Any()) { return(new MoBiEmptyCommand()); } var command = new MoBiMacroCommand { CommandType = AppConstants.Commands.AddCommand, ObjectType = ObjectTypes.NeighborhoodBuilder, Description = AppConstants.Commands.AddDependentDescription(spatialStructure, ObjectTypes.NeighborhoodBuilder, ObjectTypes.SpatialStructure) }; return(neighborhoods.Any(existingItem => !addNeighborhood(existingItem, command, spatialStructure)) ? CancelCommand(command) : command); }
public void Visit(IMoBiSpatialStructure spatialStructure) { _found = spatialStructure.Contains(_entity); }