protected override Task Context() { _parameterMapper = A.Fake <ParameterMapper>(); _eventMappingFactory = A.Fake <IEventMappingFactory>(); sut = new EventMappingMapper(_parameterMapper, _eventMappingFactory); _event = new PKSimEvent() .WithName("E1") .WithId("EventId"); _eventMapping = new EventMapping { TemplateEventId = _event.Id, StartTime = DomainHelperForSpecs.ConstantParameterWithValue(1) }; _snapshotEventStartTime1 = new Parameter { Name = "P1" }; _project = new PKSimProject(); _project.AddBuildingBlock(_event); A.CallTo(() => _parameterMapper.MapToSnapshot(_eventMapping.StartTime)).Returns(_snapshotEventStartTime1); return(_completed); }
protected override async Task Context() { await base.Context(); _parameter.IsDefault = true; _snapshotParameter = await sut.MapToSnapshot(_parameter); _snapshotParameter.Value = 50; //50 mm }
protected override async Task Context() { await base.Context(); _parameter.Value = 1; _parameter.Dimension = Constants.Dimension.NO_DIMENSION; _parameter.DisplayUnit = Constants.Dimension.NO_DIMENSION.DefaultUnit; _snapshotParameter = await sut.MapToSnapshot(_parameter); _parameter.Value = 10; }
protected override async Task Context() { await base.Context(); _container = new Container().WithName("ORG"); _container.Add(_parameter); _snapshot = new SnapshotParameter { Name = "NOT FOUND", }; }
protected override async Task Context() { await base.Context(); _container = new Container().WithName("ORG"); _container.Add(_parameter); _snapshot = new SnapshotParameter { Name = _parameter.Name, Value = 5, Unit = _parameter.DisplayUnit.Name }; }
protected override async Task Context() { await base.Context(); _snapshot = await sut.MapToSnapshot(_alternativeWithSpecies); var newAlternativeWithSpecies = new ParameterAlternativeWithSpecies(); A.CallTo(() => _parameterAlternativeFactory.CreateAlternativeFor(_parameterGroup)).Returns(newAlternativeWithSpecies); _snapshotParameter = new Parameter { Name = "P1" }; _alternativeParameter = DomainHelperForSpecs.ConstantParameterWithValue(1).WithName(_snapshotParameter.Name); newAlternativeWithSpecies.Add(_alternativeParameter); _snapshot.Parameters = new[] { _snapshotParameter }; }
protected override async Task Context() { await base.Context(); _snapshot = await sut.MapToSnapshot(_alternativeWithSpecies); var newAlternative = new ParameterAlternative(); A.CallTo(() => _parameterAlternativeFactory.CreateAlternativeFor(_parameterGroup)).Returns(newAlternative); _parameterGroup.Name = CoreConstants.Groups.COMPOUND_SOLUBILITY; _snapshotParameter = new Parameter { Name = CoreConstants.Parameters.SOLUBILITY_TABLE }; _alternativeParameter = DomainHelperForSpecs.ConstantParameterWithValue(1).WithName(_snapshotParameter.Name); _alternativeParameter.Formula = new OSPSuite.Core.Domain.Formulas.TableFormula(); newAlternative.Add(_alternativeParameter); _snapshot.Parameters = new[] { _snapshotParameter }; }
protected override async Task Context() { await base.Context(); _parameterValue = 1500; _parameter.Value = _parameterValue; _snapshotParameter = await sut.MapToSnapshot(_parameter); _snapshotParameter.Value = _parameter.ValueInDisplayUnit; _snapshotParameter.TableFormula = new TableFormula(); var modelTableFormula = new OSPSuite.Core.Domain.Formulas.TableFormula(); A.CallTo(() => _tableFormulaMapper.MapToModel(_snapshotParameter.TableFormula, A <SnapshotContext> ._)).Returns(modelTableFormula); //Set a first value that is not the parameter value modelTableFormula.AddPoint(0, 1122); //set some dummy value to ensure reset _parameter.Value = 12345; }
protected override async Task Because() { _snapshotParameter = await sut.MapToSnapshot(_parameter); }
protected override Task Context() { _parameterMapper = A.Fake <ParameterMapper>(); _expressionContainerMapper = A.Fake <ExpressionContainerMapper>(); _executionContext = A.Fake <IExecutionContext>(); _individualMoleculeFactoryResolver = A.Fake <IIndividualMoleculeFactoryResolver>(); _ontogenyMapper = A.Fake <OntogenyMapper>(); _ontogenyTask = A.Fake <IOntogenyTask <Individual> >(); _individualMoleculeParametersTask = A.Fake <IMoleculeParameterTask>(); sut = new MoleculeMapper(_parameterMapper, _expressionContainerMapper, _ontogenyMapper, _individualMoleculeFactoryResolver, _executionContext, _ontogenyTask, _individualMoleculeParametersTask); _ontogeny = new DatabaseOntogeny { Name = "Ontogeny" }; _enzyme = new IndividualEnzyme { Name = "Enzyme", Description = "Help", Ontogeny = _ontogeny, }; _transporter = new IndividualTransporter { Name = "Transporter", Description = "Help" }; _otherProtein = new IndividualOtherProtein { Name = "OtherProtein", Description = "Help" }; _enzymeGlobalParameter = DomainHelperForSpecs.ConstantParameterWithValue(5, isDefault: true).WithName(CoreConstants.Parameters.HALF_LIFE_LIVER); _enzymeGlobalParameterSnapshot = new Parameter(); A.CallTo(() => _parameterMapper.MapToSnapshot(_enzymeGlobalParameter)).Returns(_enzymeGlobalParameterSnapshot); _expressionContainer1 = new MoleculeExpressionContainer { Name = "Exp Container1" }; _expressionContainer2 = new MoleculeExpressionContainer { Name = "Exp Container2" }; _enzyme.AddChildren(_expressionContainer1, _expressionContainer2, _enzymeGlobalParameter); _relativeExpressionParameter1 = DomainHelperForSpecs.ConstantParameterWithValue(0.5).WithName(CoreConstants.Parameters.REL_EXP); _relativeExpressionParameterNorm1 = DomainHelperForSpecs.ConstantParameterWithValue(1).WithName(CoreConstants.Parameters.REL_EXP_NORM); _expressionContainer1.Add(_relativeExpressionParameter1); _expressionContainer1.Add(_relativeExpressionParameterNorm1); _relativeExpressionParameterNotSet = DomainHelperForSpecs.ConstantParameterWithValue(0).WithName(CoreConstants.Parameters.REL_EXP); _relativeExpressionParameterNotSetNorm = DomainHelperForSpecs.ConstantParameterWithValue(0).WithName(CoreConstants.Parameters.REL_EXP_NORM); _expressionContainer2.Add(_relativeExpressionParameterNotSet); _expressionContainer2.Add(_relativeExpressionParameterNotSetNorm); _relativeExpressionContainerSnapshot1 = new ExpressionContainer(); _relativeExpressionContainerSnapshot2 = new ExpressionContainer(); A.CallTo(() => _expressionContainerMapper.MapToSnapshot(_expressionContainer1)).Returns(_relativeExpressionContainerSnapshot1); A.CallTo(() => _expressionContainerMapper.MapToSnapshot(_expressionContainer2)).Returns(_relativeExpressionContainerSnapshot2); _snapshotOntogeny = new Snapshots.Ontogeny(); A.CallTo(() => _ontogenyMapper.MapToSnapshot(_ontogeny)).Returns(_snapshotOntogeny); _individual = new Individual(); return(_completed); }
protected override Task Context() { _parameterMapper = A.Fake <ParameterMapper>(); _expressionContainerMapper = A.Fake <ExpressionContainerMapper>(); _expressionProfileFactory = A.Fake <IExpressionProfileFactory>(); _ontogenyMapper = A.Fake <OntogenyMapper>(); _ontogenyTask = A.Fake <IOntogenyTask>(); _moleculeExpressionTask = A.Fake <IMoleculeExpressionTask <Individual> >(); _moleculeParameterTask = A.Fake <IMoleculeParameterTask>(); sut = new ExpressionProfileMapper( _parameterMapper, _expressionContainerMapper, _ontogenyMapper, _ontogenyTask, _moleculeExpressionTask, _expressionProfileFactory, _moleculeParameterTask); _ontogeny = new DatabaseOntogeny { Name = "Ontogeny" }; _expressionProfileEnzyme = DomainHelperForSpecs.CreateExpressionProfile <IndividualEnzyme>("Enzyme"); _expressionProfileEnzyme.Molecule.Ontogeny = _ontogeny; _expressionProfileEnzyme.Description = "Help"; _expressionProfileTransporter = DomainHelperForSpecs.CreateExpressionProfile <IndividualTransporter>("Transporter"); _expressionProfileTransporter.Description = "Help"; _expressionProfileOtherProtein = DomainHelperForSpecs.CreateExpressionProfile <IndividualOtherProtein>("OtherProtein"); _enzymeGlobalParameter = DomainHelperForSpecs.ConstantParameterWithValue(5, isDefault: true) .WithName(CoreConstants.Parameters.HALF_LIFE_LIVER); _enzymeGlobalParameterSnapshot = new Parameter(); A.CallTo(() => _parameterMapper.MapToSnapshot(_enzymeGlobalParameter)).Returns(_enzymeGlobalParameterSnapshot); _expressionContainer1 = new MoleculeExpressionContainer { Name = "Exp Container1" }; _expressionContainer2 = new MoleculeExpressionContainer { Name = "Exp Container2" }; _expressionProfileEnzyme.Individual.AddChildren(_expressionContainer1, _expressionContainer2, _enzymeGlobalParameter); _expressionProfileEnzyme.Molecule.DowncastTo <IndividualEnzyme>().Localization = Localization.Intracellular | Localization.BloodCellsMembrane; _relativeExpressionParameter1 = DomainHelperForSpecs.ConstantParameterWithValue(0.5).WithName(CoreConstants.Parameters.REL_EXP); _expressionContainer1.Add(_relativeExpressionParameter1); _relativeExpressionParameterNotSet = DomainHelperForSpecs.ConstantParameterWithValue(0).WithName(CoreConstants.Parameters.REL_EXP); _expressionContainer2.Add(_relativeExpressionParameterNotSet); _relativeExpressionContainerSnapshot1 = new ExpressionContainer(); _relativeExpressionContainerSnapshot2 = new ExpressionContainer(); A.CallTo(() => _expressionContainerMapper.MapToSnapshot(_expressionContainer1)).Returns(_relativeExpressionContainerSnapshot1); A.CallTo(() => _expressionContainerMapper.MapToSnapshot(_expressionContainer2)).Returns(_relativeExpressionContainerSnapshot2); _snapshotOntogeny = new Snapshots.Ontogeny(); A.CallTo(() => _ontogenyMapper.MapToSnapshot(_ontogeny)).Returns(_snapshotOntogeny); _individual = new Individual(); return(_completed); }