protected override void Context() { base.Context(); _project = new MoBiProject(); var molecule = new MoleculeBuilder().WithName(_moleculeName); var moleculeParameter = new Parameter().WithName(_moleculeParameterName); molecule.Add(moleculeParameter); var molecules = new MoleculeBuildingBlock() { molecule }; _project.AddBuildingBlock(molecules); var parameter = new Parameter().WithName(_parameterName); var root = new Container().WithName("Root"); root.Add(parameter); var spatialStructure = new MoBiSpatialStructure().WithTopContainer(root); _project.AddBuildingBlock(spatialStructure); var reactionBuilder = new ReactionBuilder().WithName(_reactionName); var reactions = new MoBiReactionBuildingBlock() { reactionBuilder }; _project.AddBuildingBlock(reactions); A.CallTo(() => _context.CurrentProject).Returns(_project); }
protected override void Context() { base.Context(); _templateMoleculeStartValues = new MoleculeStartValuesBuildingBlock(); A.CallTo(_context.Context.ObjectRepository).WithReturnType <bool>().Returns(true); var moleculeBuildingBlock = new MoleculeBuildingBlock(); A.CallTo(_context.Context).WithReturnType <IMoleculeBuildingBlock>().Returns(moleculeBuildingBlock); var spatialStructure = new SpatialStructure(); A.CallTo(_context.Context).WithReturnType <ISpatialStructure>().Returns(spatialStructure); A.CallTo(() => _moleculeStartValuesCreator.CreateFrom(spatialStructure, moleculeBuildingBlock)).Returns(_templateMoleculeStartValues); _newEndogenousValue = new MoleculeStartValue { ContainerPath = new ObjectPath("Organism", AppConstants.Organs.ENDOGENOUS_IGG, "Plasma"), Name = "M", IsPresent = true }; _existingEndogenousValue = new MoleculeStartValue { ContainerPath = new ObjectPath("Organism", AppConstants.Organs.ENDOGENOUS_IGG, "Cell"), Name = "M", IsPresent = true }; _existingTemplateEndogenousValue = new MoleculeStartValue { ContainerPath = new ObjectPath("Organism", AppConstants.Organs.ENDOGENOUS_IGG, "Cell"), Name = "M", IsPresent = true }; _templateMoleculeStartValues.Add(_newEndogenousValue); _templateMoleculeStartValues.Add(_existingTemplateEndogenousValue); _moleculeStartValueBuildingBlock.Add(_existingEndogenousValue); }
protected override void Context() { base.Context(); var moleculeBuildingBlock1 = new MoleculeBuildingBlock().WithName("Tada"); var moleculeBuilderA = new MoleculeBuilder().WithName("MSVa"); var moleculeBuilderB = new MoleculeBuilder().WithName("MSVb"); moleculeBuildingBlock1.Add(moleculeBuilderA); moleculeBuildingBlock1.Add(moleculeBuilderB); var moleculeBuildingBlock2 = new MoleculeBuildingBlock().WithName("Toto"); moleculeBuilderA = new MoleculeBuilder().WithName("MSVa"); moleculeBuilderB = new MoleculeBuilder().WithName("MSVb"); moleculeBuildingBlock2.Add(moleculeBuilderA); moleculeBuildingBlock2.Add(moleculeBuilderB); _object1 = moleculeBuildingBlock1; _object2 = moleculeBuildingBlock2; _comparerSettings.OnlyComputingRelevant = false; }
protected override void Context() { _quantity = A.Fake <IParameter>().WithName("P"); base.Context(); _parameter.Name = "P"; var moleculeBuilder1 = new MoleculeBuilder().WithName("Mol1"); var moleculeBuilder2 = new MoleculeBuilder().WithName("Mol2"); var transporterMolecule1 = new TransporterMoleculeContainer { TransportName = "TRANSPORT", Name = "TRANSPORTER" }; var molecule1 = new Container().WithName("Mol1"); molecule1.Add(transporterMolecule1); var molecule2 = new Container().WithName("Mol2"); var transporterMolecule2 = new TransporterMoleculeContainer { TransportName = "TRANSPORT", Name = "TRANSPORTER" }; molecule2.Add(transporterMolecule2); moleculeBuilder1.AddTransporterMoleculeContainer(transporterMolecule1); moleculeBuilder2.AddTransporterMoleculeContainer(transporterMolecule2); var moleculeBuildingBlock = new MoleculeBuildingBlock { moleculeBuilder1, moleculeBuilder2 }; _buildingBlockInfo.UntypedBuildingBlock = moleculeBuildingBlock; transporterMolecule1.AddParameter(_parameter); _quantity.ParentContainer.Name = transporterMolecule1.TransportName; _quantity.ParentContainer.ParentContainer.Name = moleculeBuilder1.Name; }
protected override void Context() { base.Context(); _spatialStructure = new SpatialStructure(); var root = new Container { Name = _rootContainerString, Mode = ContainerMode.Physical }; root.Add(new Container { Name = _childContainerString, Mode = ContainerMode.Physical }); _spatialStructure.AddTopContainer(root); _moleculeBuildingBlock = new MoleculeBuildingBlock { Name = "MoleculeBB1" }; _moleculeBuildingBlock.Add(new MoleculeBuilder { Name = M1, DefaultStartFormula = new ConstantFormula(5.0), Dimension = DimensionFactoryForSpecs.ConcentrationDimension }); _defaultStartFormula = new ExplicitFormula("M/V"); _moleculeBuildingBlock.Add(new MoleculeBuilder { Name = M2, DefaultStartFormula = _defaultStartFormula, Dimension = DimensionFactoryForSpecs.ConcentrationDimension }); A.CallTo(() => _cloneManagerForBuildingBlock.Clone(_defaultStartFormula, A <FormulaCache> ._)).Returns(new ExplicitFormula("M/V")); }
protected override void Context() { base.Context(); _buildConfiguration = A.Fake <IMoBiBuildConfiguration>(); _psvInfo = new ParameterStartValuesBuildingBlockInfo { UntypedBuildingBlock = new ParameterStartValuesBuildingBlock().WithId("psvbb1") }; _templateMoleculeBuildingBlock = new MoleculeBuildingBlock { Id = "templateMoleculeBuildingBlock" }; _templateSpatialStructure = new MoBiSpatialStructure() { Id = "templateSpatialStructure" }; _moleculesInfo = new MoleculesInfo { UntypedBuildingBlock = _templateMoleculeBuildingBlock }; _spatialStructureInfo = new SpatialStructureInfo { UntypedBuildingBlock = _templateSpatialStructure }; _buildConfiguration.ParameterStartValuesInfo = _psvInfo; _buildConfiguration.SpatialStructureInfo = _spatialStructureInfo; _buildConfiguration.MoleculesInfo = _moleculesInfo; A.CallTo(() => _buildConfiguration.AllBuildingBlockInfos()).Returns(new IBuildingBlockInfo[] { _psvInfo, _moleculesInfo, _spatialStructureInfo }); _cloneBuildingBlock = new ParameterStartValuesBuildingBlock().WithId("psvbb2"); A.CallTo(() => _cloneManager.CloneBuidingBlock(_psvInfo.BuildingBlock)).Returns(_cloneBuildingBlock); A.CallTo(() => _simulation.MoBiBuildConfiguration).Returns(_buildConfiguration); A.CallTo(_nameCorrector).WithReturnType <bool>().Returns(true); }
public void TestComplexMoleculeBB() { MoleculeBuildingBlock x1 = _buildConfiguration.Molecules as MoleculeBuildingBlock; Assert.IsNotNull(x1); IMoleculeBuildingBlock x2 = SerializeAndDeserialize(x1); AssertForSpecs.AreEqualBuildingBlock(x2, x1); }
protected override void Context() { base.Context(); _moleculeBuildingBlock = new MoleculeBuildingBlock { Id = "1" }; sut.AddBuildingBlock(new MoleculeStartValuesBuildingBlock { MoleculeBuildingBlockId = "1", SpatialStructureId = "2" }); sut.AddBuildingBlock(new ParameterStartValuesBuildingBlock { MoleculeBuildingBlockId = "2", SpatialStructureId = "2" }); }
protected override void Context() { _quantity = _parameter; base.Context(); var moleculeBuilder = new MoleculeBuilder(); moleculeBuilder.AddParameter(_parameter); var moleculeBuildingBlock = new MoleculeBuildingBlock { moleculeBuilder }; _buildingBlockInfo.UntypedBuildingBlock = moleculeBuildingBlock; }
protected override void Context() { base.Context(); var moleculeBuindingBlock = new MoleculeBuildingBlock(); var molecule = new MoleculeBuilder { Name = "Mol", Dimension = Constants.Dimension.NO_DIMENSION }; moleculeBuindingBlock.Add(molecule); _nullStartValue = new MoleculeStartValue { Name = molecule.Name, StartValue = 1, Dimension = Constants.Dimension.NO_DIMENSION }; _moleculeStartValueBuildingBlock.Add(_nullStartValue); A.CallTo(_context.Context).WithReturnType <IMoleculeBuildingBlock>().Returns(moleculeBuindingBlock); }
protected override void Context() { base.Context(); _project = new MoBiProject(); var molecule = new MoleculeBuilder().WithName(_moleculeName); var moleculeParameter = new Parameter().WithName(_moleculeParameterName); molecule.Add(moleculeParameter); var molecules = new MoleculeBuildingBlock() { molecule }; _project.AddBuildingBlock(molecules); var parameter = new Parameter().WithName(_parameterName); var root = new Container().WithName(_topContainerName); root.Add(parameter); var spatialStructure = new MoBiSpatialStructure().WithTopContainer(root); spatialStructure.GlobalMoleculeDependentProperties = new Container().WithName(Constants.MOLECULE_PROPERTIES); spatialStructure.NeighborhoodsContainer = new Container().WithName(Constants.NEIGHBORHOODS); _project.AddBuildingBlock(spatialStructure); var reactionBuilder = new ReactionBuilder().WithName(_reactionName); var reactions = new MoBiReactionBuildingBlock() { reactionBuilder }; _project.AddBuildingBlock(reactions); _project.AddSimulation(new MoBiSimulation().WithName(_simulationName)); var eventGroupBuilder = new EventGroupBuilder().WithName(_eventGroupName); var eventGroupBuildingBlock = new EventGroupBuildingBlock(); eventGroupBuildingBlock.Add(eventGroupBuilder); _project.AddBuildingBlock(eventGroupBuildingBlock); A.CallTo(() => _context.CurrentProject).Returns(_project); }
protected override void Context() { base.Context(); _passiveTransports2 = new PassiveTransportBuildingBlock(); _project.AddBuildingBlock(_passiveTransports); _project.AddBuildingBlock(_passiveTransports2); _project.AddBuildingBlock(_molecules); var anotherMoleculeWithPassiveTransport = new MoleculeBuilder().WithName("MOLECULE"); var molecules2 = new MoleculeBuildingBlock { anotherMoleculeWithPassiveTransport }.WithName("MBB2"); var samePassiveTransport = new TransportBuilder().WithName("PASSIVE TRANSPORT").WithFormula(A.Fake <IFormula>()); anotherMoleculeWithPassiveTransport.Add(samePassiveTransport); A.CallTo(() => _formulaTask.FormulasAreTheSame(_passiveTransportKinetic, samePassiveTransport.Formula)).Returns(true); A.CallTo(() => _cloneManagerForModel.Clone <ITransportBuilder>(_passiveTransport)).ReturnsLazily(x => new TransportBuilder().WithFormula(_passiveTransportKinetic)); A.CallTo(() => _containerTask.CreateUniqueName(_passiveTransports, A <string> ._, true)).ReturnsLazily(x => x.Arguments[1].ConvertedTo <string>()); _project.AddBuildingBlock(molecules2); }
protected override void Context() { base.Context(); sut.SelectionPredicate = p => true; var id = "mp"; var physical = new Container().WithName("PHYS").WithMode(ContainerMode.Physical); var moleculeProperties = new Container().WithName(Constants.MOLECULE_PROPERTIES).WithParentContainer(physical); var p1 = new Parameter().WithName("P1"); moleculeProperties.Add(p1); var moleculeName = "Drug"; _moleculePropertiesDTO = new DummyMoleculeContainerDTO() { MoleculePropertiesContainer = new ObjectBaseDTO().WithId(id) }.WithId("ANY") .WithName(moleculeName); A.CallTo(() => _context.Get <IContainer>(id)).Returns(moleculeProperties); var objectBaseRepository = A.Fake <IWithIdRepository>(); A.CallTo(() => _context.ObjectRepository).Returns(objectBaseRepository); A.CallTo(() => objectBaseRepository.ContainsObjectWithId(id)).Returns(true); A.CallTo(() => _parameterMapper.MapFrom(p1, A <IContainer> ._, A <IObjectBaseDTO> ._)).Returns(_dtoP1); var project = A.Fake <IMoBiProject>(); var moleculeBuildingBlock = new MoleculeBuildingBlock(); var molecule = new MoleculeBuilder().WithName(moleculeName); var localP = new Parameter().WithName("local").WithMode(ParameterBuildMode.Local).WithParentContainer(molecule); var globalP = new Parameter().WithName("global").WithMode(ParameterBuildMode.Global).WithParentContainer(molecule); moleculeBuildingBlock.Add(molecule); A.CallTo(() => project.MoleculeBlockCollection).Returns(new[] { moleculeBuildingBlock }); A.CallTo(() => _parameterMapper.MapFrom(localP, A <IContainer> ._, A <IObjectBaseDTO> ._)).Returns(_dtoPlocal); A.CallTo(() => _parameterMapper.MapFrom(globalP, A <IContainer> ._, A <IObjectBaseDTO> ._)).Returns(_dtoPglobal); A.CallTo(() => _context.CurrentProject).Returns(project); }
protected override void Context() { base.Context(); var moleculeBuildingBlock1 = new MoleculeBuildingBlock().WithName("Tada"); var moleculeBuilderA = new MoleculeBuilder().WithName("DrugA"); var moleculeBuilderB = new MoleculeBuilder().WithName("DrugB"); moleculeBuildingBlock1.Add(moleculeBuilderA); moleculeBuildingBlock1.Add(moleculeBuilderB); var moleculeBuildingBlock2 = new MoleculeBuildingBlock().WithName("Tada"); moleculeBuilderA = new MoleculeBuilder().WithName("DrugA"); moleculeBuilderB = new MoleculeBuilder().WithName("DrugC"); moleculeBuildingBlock2.Add(moleculeBuilderA); moleculeBuildingBlock2.Add(moleculeBuilderB); _object1 = moleculeBuildingBlock1; _object2 = moleculeBuildingBlock2; }
protected override void Context() { base.Context(); _originalFormula1 = new ExplicitFormula().WithName("F1").WithId("X1"); _originalFormula2 = new ExplicitFormula().WithName("F2").WithId("X2"); _buildingBlockToClone = new MoleculeBuildingBlock(); var clonedBuildinBlock = new MoleculeBuildingBlock(); _buildingBlockToClone.AddFormula(_originalFormula1); _buildingBlockToClone.AddFormula(_originalFormula2); _cloneFormula1 = new ExplicitFormula().WithName("F1").WithId("X11"); _cloneFormula2 = new ExplicitFormula().WithName("F2").WithId("X22"); A.CallTo(() => _cloneManagerForBuildingBlock.Clone(_originalFormula2)).Returns(_cloneFormula2); A.CallTo(() => _cloneManagerForBuildingBlock.Clone(_buildingBlockToClone, A <IFormulaCache> ._)) .Invokes(x => { var formulaCache = x.GetArgument <IFormulaCache>(1); formulaCache.Add(_cloneFormula1); }) .Returns(clonedBuildinBlock); }
protected override void Context() { base.Context(); var moleculeBuildingBlock1 = new MoleculeBuildingBlock().WithName("X"); moleculeBuildingBlock1.Version = 1; var moleculeBuilderA = new MoleculeBuilder().WithName("MSVa"); moleculeBuilderA.AddParameter(new Parameter().WithMode(ParameterBuildMode.Local)); moleculeBuildingBlock1.Add(moleculeBuilderA); var moleculeBuildingBlock2 = new MoleculeBuildingBlock().WithName("X"); moleculeBuildingBlock2.Version = 1; moleculeBuilderA = new MoleculeBuilder().WithName("MSVa"); moleculeBuildingBlock2.Add(moleculeBuilderA); _object1 = moleculeBuildingBlock1; _object2 = moleculeBuildingBlock2; }
protected override void Context() { sut = new MoleculeBuildingBlock(); }