示例#1
0
            protected override void Because()
            {
                var model = new Model(3, 1);

                model.setName("TestModel");
                model.setNotes("TestNotes");
                model.setMetaId("TestMetaId");
                sut.CreateEventsTopContainer();
                sut.CreateTopContainer(model);
                var compartment = new Compartment(3, 1);

                compartment.setName("Compartment");
                compartment.setId("c1");
                compartment.setSpatialDimensions(1);
                compartment.setSize(5);

                var compartment2 = new Compartment(3, 1);

                compartment2.setName("Compartment");
                compartment2.setId("c2");
                compartment2.setSpatialDimensions(2);
                compartment2.setSize(5);

                var compartment3 = new Compartment(3, 1);

                compartment3.setName("Compartment");
                compartment3.setId("c3");
                compartment3.setSpatialDimensions(3);
                compartment3.setSize(5);

                _container  = sut.CreateContainerFromCompartment(compartment);
                _container2 = sut.CreateContainerFromCompartment(compartment2);
                _container3 = sut.CreateContainerFromCompartment(compartment3);
                sut.CreateSpatialStructureFromModel(sut._topContainer, model);
            }
        public override void GlobalContext()
        {
            base.GlobalContext();
            _fourCompSim = DomainFactoryForSpecs.CreateDefaultSimulationForModel(CoreConstants.Model.FOUR_COMP);
            _fourComp    = _fourCompSim.Model.Root.Container(Constants.ORGANISM);

            _twoPoresSim = DomainFactoryForSpecs.CreateDefaultSimulationForModel(CoreConstants.Model.TWO_PORES);
            _twoPores    = _twoPoresSim.Model.Root.Container(Constants.ORGANISM);

            _organisms = new List <IContainer> {
                _fourComp, _twoPores
            };
        }
        public override void GlobalContext()
        {
            base.GlobalContext();
            _buildConfiguration = DomainFactoryForSpecs.CreateDefaultConfiguration();
            var spatialStructure = _buildConfiguration.SpatialStructure;

            _organism = spatialStructure.TopContainers.ElementAt(0);
            var volumeParameter = _organism.EntityAt <IParameter>(Constants.Parameters.VOLUME);

            volumeParameter.Persistable = true;
            _simulation = DomainFactoryForSpecs.CreateSimulationFor(_buildConfiguration);

            var simulationRunner = IoC.Resolve <ISimulationRunner>();

            simulationRunner.RunSimulation(_simulation);
        }
示例#4
0
        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);
        }
示例#5
0
 private bool isPureContainer(IContainer container)
 {
     return(!container.IsAnImplementationOf <IEventGroupBuilder>() &&
            !container.IsAnImplementationOf <IEventBuilder>() &&
            !container.IsAnImplementationOf <ITransportBuilder>());
 }
示例#6
0
 private IEnumerable <string> reactionNamesIn(IContainer container)
 {
     return((from molecule in container.GetAllChildren <IReaction>()
             select molecule.Name).ToList());
 }
示例#7
0
 private IEnumerable <string> moleculeNamesIn(IContainer container)
 {
     return((from molecule in container.GetAllChildren <IMoleculeAmount>()
             select molecule.Name).ToList());
 }
示例#8
0
 private IParameter startValueFor(IContainer molecule)
 {
     return(molecule.EntityAt <IParameter>(Constants.Parameters.START_VALUE));
 }
示例#9
0
 public override void GlobalContext()
 {
     base.GlobalContext();
     _simulation = IoC.Resolve <ConcentrationBaseModelHelperForSpecs>().CreateSimulation();
     _organism   = _simulation.Model.Root.GetSingleChildByName <IContainer>(ConstantsForSpecs.Organism);
 }
 public void Run(IContainer root)
 {
     root.AcceptVisitor(this);
 }
示例#11
0
 private IParameter organParameterFor(IContainer root, string organName, string parameterName)
 {
    return root.Container(Constants.ORGANISM)
       .Container(organName).Parameter(parameterName);
 }
示例#12
0
 private double LITTFor(IContainer individual)
 {
    return organParameterFor(individual, CoreConstants.Organ.LargeIntestine, ConverterConstants.Parameter.LITT).Value;
 }