Пример #1
0
        protected override async Task Context()
        {
            await base.Context();

            _snapshot = new Snapshots.ValueOrigin
            {
                Id          = 5,
                Source      = ValueOriginSourceId.Database,
                Method      = ValueOriginDeterminationMethodId.InVitro,
                Description = "Good morning"
            };
        }
Пример #2
0
        protected override Task Context()
        {
            _tableFormulaMapper = A.Fake <TableFormulaMapper>();
            _valueOriginMapper  = A.Fake <ValueOriginMapper>();
            _entityPathResolver = A.Fake <IEntityPathResolver>();
            _logger             = A.Fake <IOSPSuiteLogger>();
            _containerTask      = new ContainerTaskForSpecs();
            sut = new ParameterMapper(_tableFormulaMapper, _valueOriginMapper, _entityPathResolver, _logger, _containerTask);

            //5 mm is the value
            _parameter = DomainHelperForSpecs.ConstantParameterWithValue(10)
                         .WithName("P1")
                         .WithDescription("P1 description")
                         .WithDimension(DomainHelperForSpecs.LengthDimensionForSpecs());

            _parameter.DisplayUnit = _parameter.Dimension.Unit("mm");
            _snapshotValueOrigin   = new ValueOrigin();

            A.CallTo(() => _valueOriginMapper.MapToSnapshot(_parameter.ValueOrigin)).Returns(_snapshotValueOrigin);
            return(_completed);
        }
Пример #3
0
 protected override async Task Because()
 {
     _snapshotValueOrigin = await sut.MapToSnapshot(_valueOrigin);
 }
        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 OSPSuite.Core.Domain.ValueOrigin {
                Method = ValueOriginDeterminationMethods.InVitro, Description = "PKA"
            };
            _snapshotValueOrigin = new 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(Constants.Parameters.IS_SMALL_MOLECULE));
            _compound.Add(DomainHelperForSpecs.ConstantParameterWithValue((int)PlasmaProteinBindingPartner.Glycoprotein).WithName(Constants.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);
        }