Ejemplo n.º 1
0
        protected override Task Context()
        {
            _alternativeMapper            = A.Fake <AlternativeMapper>();
            _parameterMapper              = A.Fake <ParameterMapper>();
            _calculationMethodCacheMapper = A.Fake <CalculationMethodCacheMapper>();
            _processMapper   = A.Fake <CompoundProcessMapper>();
            _compoundFactory = A.Fake <ICompoundFactory>();
            sut = new CompoundMapper(_parameterMapper, _alternativeMapper, _calculationMethodCacheMapper, _processMapper, _compoundFactory);

            _compound = new Model.Compound
            {
                Name        = "Compound",
                Description = "Description"
            };

            addPkAParameters(_compound, 0, 8, CompoundType.Base);
            addPkAParameters(_compound, 1, 4, CompoundType.Acid);
            addPkAParameters(_compound, 2, 7, CompoundType.Neutral);

            _compound.AddParameterAlternativeGroup(createParameterAlternativeGroup(CoreConstants.Groups.COMPOUND_LIPOPHILICITY));
            _compound.AddParameterAlternativeGroup(createParameterAlternativeGroup(CoreConstants.Groups.COMPOUND_FRACTION_UNBOUND));
            _compound.AddParameterAlternativeGroup(createParameterAlternativeGroup(CoreConstants.Groups.COMPOUND_SOLUBILITY));
            _compound.AddParameterAlternativeGroup(createParameterAlternativeGroup(CoreConstants.Groups.COMPOUND_INTESTINAL_PERMEABILITY));
            _compound.AddParameterAlternativeGroup(createParameterAlternativeGroup(CoreConstants.Groups.COMPOUND_PERMEABILITY));

            _compound.Add(DomainHelperForSpecs.ConstantParameterWithValue(1).WithName(CoreConstants.Parameters.IS_SMALL_MOLECULE));
            _compound.Add(DomainHelperForSpecs.ConstantParameterWithValue((int)PlasmaProteinBindingPartner.Glycoprotein).WithName(CoreConstants.Parameters.PLASMA_PROTEIN_BINDING_PARTNER));

            _partialProcess  = new EnzymaticProcess().WithName("EnzymaticProcess");
            _systemicProcess = new SystemicProcess().WithName("SystemicProcess");
            _compound.AddProcess(_partialProcess);
            _compound.AddProcess(_systemicProcess);

            _calculationMethodCacheSnapshot = new CalculationMethodCache();
            A.CallTo(() => _calculationMethodCacheMapper.MapToSnapshot(_compound.CalculationMethodCache)).Returns(_calculationMethodCacheSnapshot);

            _snapshotProcess1 = new CompoundProcess();
            _snapshotProcess2 = new CompoundProcess();
            A.CallTo(() => _processMapper.MapToSnapshot(_partialProcess)).Returns(_snapshotProcess1);
            A.CallTo(() => _processMapper.MapToSnapshot(_systemicProcess)).Returns(_snapshotProcess2);

            return(_completed);
        }
Ejemplo n.º 2
0
        protected override Task Context()
        {
            _parameterMapper              = A.Fake <ParameterMapper>();
            _alternativeMapper            = A.Fake <AlternativeMapper>();
            _calculationMethodCacheMapper = A.Fake <CalculationMethodCacheMapper>();
            _processMapper     = A.Fake <CompoundProcessMapper>();
            _compoundFactory   = A.Fake <ICompoundFactory>();
            _valueOriginMapper = A.Fake <ValueOriginMapper>();
            sut = new CompoundMapper(_parameterMapper, _alternativeMapper, _calculationMethodCacheMapper, _processMapper, _valueOriginMapper, _compoundFactory);

            _compound = new Model.Compound
            {
                Name        = "Compound",
                Description = "Description"
            };
            _pkaValueOrigin = new ValueOrigin {
                Method = ValueOriginDeterminationMethods.InVitro, Description = "PKA"
            };
            _snapshotValueOrigin = new Snapshots.ValueOrigin {
                Method = ValueOriginDeterminationMethodId.InVivo, Description = "PKA"
            };

            addPkAParameters(_compound, 0, 8, CompoundType.Base);
            addPkAParameters(_compound, 1, 4, CompoundType.Acid);
            addPkAParameters(_compound, 2, 7, CompoundType.Neutral);

            _compoundIntestinalPermeabilityAlternativeGroup = createParameterAlternativeGroup(CoreConstants.Groups.COMPOUND_INTESTINAL_PERMEABILITY);
            _compound.AddParameterAlternativeGroup(createParameterAlternativeGroup(CoreConstants.Groups.COMPOUND_LIPOPHILICITY));
            _compound.AddParameterAlternativeGroup(createParameterAlternativeGroup(CoreConstants.Groups.COMPOUND_FRACTION_UNBOUND));
            _compound.AddParameterAlternativeGroup(createParameterAlternativeGroup(CoreConstants.Groups.COMPOUND_SOLUBILITY));
            _compound.AddParameterAlternativeGroup(createParameterAlternativeGroup(CoreConstants.Groups.COMPOUND_PERMEABILITY));
            _compound.AddParameterAlternativeGroup(_compoundIntestinalPermeabilityAlternativeGroup);

            _compoundIntestinalPermeabilityAlternativeGroup.DefaultAlternative.IsDefault = true;
            //Calculated alternative will not be the default alternative for intestinal perm
            _calculatedAlternative = new ParameterAlternative {
                Name = PKSimConstants.UI.CalculatedAlernative, IsDefault = false
            };
            _compoundIntestinalPermeabilityAlternativeGroup.AddAlternative(_calculatedAlternative);
            //Mapping of a calculated alternative returns null
            A.CallTo(() => _alternativeMapper.MapToSnapshot(_calculatedAlternative)).Returns(Task.FromResult <Alternative>(null));

            _compound.Add(DomainHelperForSpecs.ConstantParameterWithValue(1).WithName(CoreConstants.Parameters.IS_SMALL_MOLECULE));
            _compound.Add(DomainHelperForSpecs.ConstantParameterWithValue((int)PlasmaProteinBindingPartner.Glycoprotein).WithName(CoreConstants.Parameters.PLASMA_PROTEIN_BINDING_PARTNER));

            _partialProcess  = new EnzymaticProcess().WithName("EnzymaticProcess");
            _systemicProcess = new SystemicProcess().WithName("SystemicProcess");
            _compound.AddProcess(_partialProcess);
            _compound.AddProcess(_systemicProcess);

            _calculationMethodCacheSnapshot = new CalculationMethodCache();
            A.CallTo(() => _calculationMethodCacheMapper.MapToSnapshot(_compound.CalculationMethodCache)).Returns(_calculationMethodCacheSnapshot);

            _snapshotProcess1 = new CompoundProcess();
            _snapshotProcess2 = new CompoundProcess();
            A.CallTo(() => _processMapper.MapToSnapshot(_partialProcess)).Returns(_snapshotProcess1);
            A.CallTo(() => _processMapper.MapToSnapshot(_systemicProcess)).Returns(_snapshotProcess2);

            _molweightParameter = DomainHelperForSpecs.ConstantParameterWithValue(400).WithName(Constants.Parameters.MOL_WEIGHT);
            _molweightParameter.ValueOrigin.Method = ValueOriginDeterminationMethods.InVivo;

            //Do not update F value origin to ensure that it's being synchronized when mapping from snapshot
            _halogenFParameter = DomainHelperForSpecs.ConstantParameterWithValue(5).WithName(Constants.Parameters.F);

            _compound.Add(_molweightParameter);
            _compound.Add(_halogenFParameter);
            return(_completed);
        }