Пример #1
0
        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);
        }
Пример #2
0
 protected override async Task Because()
 {
     _newOtherProtein = await sut.MapToModel(_snapshot, _individual) as IndividualOtherProtein;
 }