protected override void Context() { base.Context(); _eventGroupBuilder1 = new EventGroupBuilder().WithName("EG1"); _eventGroupBuilder2 = new EventGroupBuilder().WithName("EG2"); _eventBuildingBlockCreator = new EventGroupBuildingBlock { _eventGroupBuilder1, _eventGroupBuilder2 }; _startTime1 = DomainHelperForSpecs.ConstantParameterWithValue().WithName(Constants.Parameters.START_TIME); _startTime2 = DomainHelperForSpecs.ConstantParameterWithValue().WithName(Constants.Parameters.START_TIME); _dose = DomainHelperForSpecs.ConstantParameterWithValue().WithName(CoreConstants.Parameters.DOSE); _dosePerBodyWeight = DomainHelperForSpecs.ConstantParameterWithValue().WithName(CoreConstants.Parameters.DOSE_PER_BODY_WEIGHT); _p1 = DomainHelperForSpecs.ConstantParameterWithValue().WithName("P1"); _p2 = DomainHelperForSpecs.ConstantParameterWithValue().WithName("P2"); _eventBuilder1 = new EventBuilder().WithName("E1"); _eventBuilder2 = new EventBuilder().WithName("E2"); _eventGroupBuilder1.Add(_eventBuilder1); _eventGroupBuilder2.Add(_eventBuilder2); _eventBuilder1.Add(_startTime1); _eventBuilder1.Add(_p1); _eventBuilder2.Add(_startTime2); _eventBuilder1.Add(_dosePerBodyWeight); _eventBuilder2.Add(_dose); _eventBuilder2.Add(_p2); }
protected override void Context() { base.Context(); _eventGroupBuildingBlock = new EventGroupBuildingBlock(); _eventGroup = new EventGroupBuilder().WithName("EG"); _eventGroupBuildingBlock.Add(_eventGroup); var parameter = new Parameter().WithName("P1").WithParentContainer(_eventGroup); }
public void Visit(IEventGroupBuildingBlock eventGroupBuildingBlock) { convert(eventGroupBuildingBlock); var inversedVolume = _dimensionFactory.Dimension(AppConstants.DimensionNames.INVERSED_VOLUME); eventGroupBuildingBlock.Each(eg => convertSpecialParameter(eg, "Number_Of_Particles_Factor", 1000, inversedVolume)); _converted = true; }
protected override void Context() { base.Context(); _eventBuildingBlock = new EventGroupBuildingBlock(); var applicationBuilder = new ApplicationBuilder().WithName("App1"); _moleculeBuilder = new ApplicationMoleculeBuilder(); applicationBuilder.AddMolecule(_moleculeBuilder); _eventBuildingBlock.Add(applicationBuilder); }
protected override void Context() { sut = new Converter531To541(); _eventGroubBuildingBlock = new EventGroupBuildingBlock(); _eventGroup = new EventGroupBuilder().WithName("EG"); _rootApplication = new ApplicationBuilder().WithName("App").WithContainerType(ContainerType.Other); _eventGroubBuildingBlock.Add(_eventGroup); _eventGroubBuildingBlock.Add(_rootApplication); _container = new Container().WithName("PSI").WithParentContainer(_eventGroup); _application = new ApplicationBuilder().WithName("App").WithContainerType(ContainerType.Other).WithParentContainer(_eventGroup); }
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() { _spatialStructureFactory = A.Fake <IPKSimSpatialStructureFactory>(); _modelObserverQuery = A.Fake <IModelObserverQuery>(); _modelPassiveTransportQuery = A.Fake <IModelPassiveTransportQuery>(); _parameterStartValueCreator = A.Fake <IPKSimParameterStartValuesCreator>(); _moleculesAndReactionsCreator = A.Fake <IMoleculesAndReactionsCreator>(); _eventBuildingBlockCreator = A.Fake <IEventBuildingBlockCreator>(); _moleculeStartValueCreator = A.Fake <IPKSimMoleculeStartValuesCreator>(); _moleculeCalculationRetriever = A.Fake <IMoleculeCalculationRetriever>(); _distributedTableConverter = A.Fake <IDistributedParameterToTableParameterConverter>(); _parameterDefaultStateUpdater = A.Fake <IParameterDefaultStateUpdater>(); _cm1 = new CoreCalculationMethod(); _cm2 = new CoreCalculationMethod(); _simulation = new IndividualSimulation { Properties = new SimulationProperties() }; _simulation.SimulationSettings = new SimulationSettings(); _simulation.ModelConfiguration = new ModelConfiguration(); _individual = new Individual().WithName("MyIndividuyal"); _compound = A.Fake <Compound>().WithName("MyCompound"); _protocol = new SimpleProtocol().WithName("MyProtocol"); _spatialStructure = A.Fake <ISpatialStructure>(); _passiveTransportBuilingBlock = A.Fake <IPassiveTransportBuildingBlock>(); _observerBuildingBlock = A.Fake <IObserverBuildingBlock>(); _eventBuildingBlock = A.Fake <IEventGroupBuildingBlock>(); _parameterValuesBuildingBlock = A.Fake <IParameterStartValuesBuildingBlock>(); _moleculeStartValueBuildingBlock = A.Fake <IMoleculeStartValuesBuildingBlock>(); _simulation.AddUsedBuildingBlock(new UsedBuildingBlock("Individual", PKSimBuildingBlockType.Individual) { BuildingBlock = _individual }); _simulation.AddUsedBuildingBlock(new UsedBuildingBlock("Compound", PKSimBuildingBlockType.Compound) { BuildingBlock = _compound }); _simulation.AddUsedBuildingBlock(new UsedBuildingBlock("Protocol", PKSimBuildingBlockType.Protocol) { BuildingBlock = _protocol }); A.CallTo(() => _moleculeCalculationRetriever.AllMoleculeCalculationMethodsUsedBy(_simulation)).Returns(new[] { _cm1, _cm2 }); A.CallTo(() => _spatialStructureFactory.CreateFor(_individual, _simulation)).Returns(_spatialStructure); A.CallTo(() => _modelPassiveTransportQuery.AllPassiveTransportsFor(_simulation)).Returns(_passiveTransportBuilingBlock); A.CallTo(() => _modelObserverQuery.AllObserversFor(A <IMoleculeBuildingBlock> .Ignored, _simulation)).Returns(_observerBuildingBlock); A.CallTo(() => _eventBuildingBlockCreator.CreateFor(_simulation)).Returns(_eventBuildingBlock); A.CallTo(() => _parameterStartValueCreator.CreateFor(A <IBuildConfiguration> .Ignored, A <Simulation> .Ignored)).Returns(_parameterValuesBuildingBlock); A.CallTo(() => _moleculeStartValueCreator.CreateFor(A <IBuildConfiguration> .Ignored, A <Simulation> .Ignored)).Returns(_moleculeStartValueBuildingBlock); sut = new BuildConfigurationTask(_spatialStructureFactory, _modelObserverQuery, _modelPassiveTransportQuery, _parameterStartValueCreator, _moleculesAndReactionsCreator, _eventBuildingBlockCreator, _moleculeStartValueCreator, _moleculeCalculationRetriever, _distributedTableConverter, _parameterDefaultStateUpdater); }
private void validateEventGroupBuildingBlock(IEventGroupBuildingBlock eventGroups, IMoleculeBuildingBlock moleculeBuildingBlock, ValidationResult validationResult) { var allMolecules = moleculeBuildingBlock.Select(mb => mb.Name); foreach (var eventGroup in eventGroups) { var applicationBuilders = eventGroup.GetAllContainersAndSelf <IApplicationBuilder>(); foreach (var applicationBuilder in applicationBuilders.Where(applicationBuilder => !allMolecules.Contains(applicationBuilder.MoleculeName))) { validationResult.AddMessage(NotificationType.Error, applicationBuilder, Validation.ApplicatedMoleculeNotPresent(applicationBuilder.MoleculeName, applicationBuilder.Name, moleculeBuildingBlock.Name), eventGroups); } } validateBuildingBlockWithFormulaCache(eventGroups, validationResult); }
public void TestComplexEventGroupBB() { EventGroupBuildingBlock x1 = _buildConfiguration.EventGroups as EventGroupBuildingBlock; Assert.IsNotNull(x1); ApplicationBuilder a1 = CreateObject <ApplicationBuilder>().WithName("App.Builder"); x1.Add(a1); var applicationMoleculeBuilder = CreateObject <ApplicationMoleculeBuilder>().WithName("AppMolecule"); IFormula f2 = CreateObject <ConstantFormula>().WithDimension(DimensionLength).WithValue(3.4); applicationMoleculeBuilder.Formula = f2; applicationMoleculeBuilder.RelativeContainerPath = new ObjectPath(new[] { "A", "B" }); a1.AddMolecule(applicationMoleculeBuilder); IEventGroupBuildingBlock x2 = SerializeAndDeserialize(x1); AssertForSpecs.AreEqualBuildingBlock(x2, x1); }
protected override void Context() { base.Context(); _eventBuildingBlock = new EventGroupBuildingBlock().WithName("Events"); _applicationBuilder = new ApplicationBuilder().WithName("Tada"); _applicationBuilder.MoleculeName = "B"; _eventBuildingBlock.Add(_applicationBuilder); _molceuleBuidingBlock = new MoleculeBuildingBlock().WithName("Molecules"); _molceuleBuidingBlock.Add(new MoleculeBuilder().WithName("A")); _buildConfiguration = new BuildConfiguration(); _buildConfiguration.Molecules = _molceuleBuidingBlock; _buildConfiguration.MoleculeStartValues = new MoleculeStartValuesBuildingBlock(); _buildConfiguration.Observers = new ObserverBuildingBlock(); _buildConfiguration.ParameterStartValues = new ParameterStartValuesBuildingBlock(); _buildConfiguration.PassiveTransports = new PassiveTransportBuildingBlock(); _buildConfiguration.Reactions = new ReactionBuildingBlock(); _buildConfiguration.SpatialStructure = new SpatialStructure(); _buildConfiguration.EventGroups = _eventBuildingBlock; }
public IEventGroupBuildingBlock CreateFor(Simulation simulation) { try { _simulation = simulation; _eventGroupBuildingBlock = _objectBaseFactory.Create <IEventGroupBuildingBlock>().WithName(simulation.Name); _cloneManagerForBuildingBlock.FormulaCache = _eventGroupBuildingBlock.FormulaCache; createApplications(_simulation.CompoundPropertiesList); createNonApplicationEvents(); return(_eventGroupBuildingBlock); } finally { _simulation = null; _eventGroupBuildingBlock = null; } }
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(); _eventGroupBuildingBlock = new EventGroupBuildingBlock(); var eventGroup = new EventGroupBuilder().WithName("EG"); _eventGroupBuildingBlock.Add(eventGroup); var ehcStartEvent = new EventBuilder().WithName(Converter321To331.EHCStartEvent); eventGroup.Add(ehcStartEvent); var eabOldStart = new EventAssignmentBuilder().WithName("EAB1").WithFormula(new ExplicitFormula("ln(2) / EHC_Halftime * M * EHC_EjectionFraction")); eabOldStart.UseAsValue = false; eabOldStart.ObjectPath = new ObjectPath(new[] { "Organism", "Gallbladder", "Gallbladder emptying rate" }); ehcStartEvent.AddAssignment(eabOldStart); var assignmentBuilder = new EventAssignmentBuilder().WithName("EAB2").WithFormula(new ExplicitFormula("DontChange")); assignmentBuilder.ObjectPath = new ObjectPath(new[] { "PATH" }); ehcStartEvent.AddAssignment(assignmentBuilder); var ehcStopEvent = new EventBuilder().WithName(Converter321To331.EHCStopEvent); var eabOldStop = new EventAssignmentBuilder().WithName("EAB1").WithFormula(new ConstantFormula(0)); eabOldStop.UseAsValue = false; eabOldStop.ObjectPath = new ObjectPath(new[] { "Organism", "Gallbladder", "Gallbladder emptying rate" }); ehcStopEvent.AddAssignment(eabOldStop); assignmentBuilder = new EventAssignmentBuilder().WithName("EAB2").WithFormula(new ExplicitFormula("DontChange")); assignmentBuilder.ObjectPath = new ObjectPath(new[] { "PATH" }); ehcStopEvent.AddAssignment(assignmentBuilder); eventGroup.Add(ehcStopEvent); var protocolSchemaItem = new Container().WithName("ProtocolSchemaItem").WithParentContainer(eventGroup); _drugMassParameter = new Parameter().WithName("DrugMass").WithParentContainer(protocolSchemaItem).WithValue(1); applications = new EventGroupBuilder().WithName("Applications"); applications.Add(new Parameter().WithName("TotalDrugMass")); _eventGroupBuildingBlock.Add(applications); }
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); }
protected override void Context() { base.Context(); _eventGroupBuildingBlock = _simulationTransfer.Simulation.BuildConfiguration.EventGroups; }
private void convertEventGroupBuildingBlock(IEventGroupBuildingBlock eventGroups) { var allApplications = eventGroups.SelectMany(eg => eg.GetAllContainersAndSelf <IApplicationBuilder>()); allApplications.Each(app => app.ContainerType = ContainerType.Application); }
public void Visit(IEventGroupBuildingBlock eventGroupBuildingBlock) { convertEventGroupBuildingBlock(eventGroupBuildingBlock); _converted = true; }
protected override void Context() { base.Context(); _eventGroupBuilder = new EventGroupBuildingBlock(); A.CallTo(() => _context.Context.Create <IEventGroupBuilder>()).Returns(new EventGroupBuilder()); }
public void Visit(IEventGroupBuildingBlock eventGroupBuildingBlock) { Visit(eventGroupBuildingBlock.DowncastTo <IBuildingBlock>()); eventGroupBuildingBlock.OfType <IApplicationBuilder>().Each(Visit); _converted = false; }
public void UpdateDefaultFor(IEventGroupBuildingBlock eventGroupBuildingBlock) { eventGroupBuildingBlock.Each(updateDefaultStateForEventParameters); }
public void Visit(IEventGroupBuildingBlock eventGroupBuildingBlock) { ConvertAllParametersIn(eventGroupBuildingBlock); }
protected override void Context() { base.Context(); _buildingBlock = A.Fake <IEventGroupBuildingBlock>().WithId("BB"); _eventGroupBuilder = A.Fake <IEventGroupBuilder>().WithId("EGB"); }
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 void Visit(IEventGroupBuildingBlock objToVisit) { retrieveTask(objToVisit); }
public void Visit(IEventGroupBuildingBlock eventGroupBuildingBlock) { _found = eventGroupBuildingBlock.Contains(_entity); }
public override void GlobalContext() { base.GlobalContext(); _eventGroupBuildingBlock = LoadPKML <IEventGroupBuildingBlock>("Events"); }