protected Quantity()
 {
     Persistable           = true;
     QuantityType          = QuantityType.Undefined;
     Dimension             = Constants.Dimension.NO_DIMENSION;
     NegativeValuesAllowed = false;
     ValueOrigin           = new ValueOrigin();
 }
        public void should_return_a_combination_of_type_and_descriptiion_if_those_properties_are_set()
        {
            var display = new ValueOrigin {
                Source = ValueOriginSources.Internet, Description = "Hello"
            }.Display;

            display.Contains("Hello").ShouldBeTrue();
            display.Contains(ValueOriginSources.Internet.Display).ShouldBeTrue();
        }
        protected override void Context()
        {
            base.Context();
            _sourceValueOrigin = new ValueOrigin();
            _targetValueOrigin = new ValueOrigin();

            _sourceValueOrigin.Source      = ValueOriginSources.Database;
            _sourceValueOrigin.Method      = ValueOriginDeterminationMethods.InVitro;
            _sourceValueOrigin.Description = "Hello";
        }
 protected override void Context()
 {
     base.Context();
     _valueOrigin1             = new ValueOrigin();
     _valueOrigin2             = new ValueOrigin();
     _valueOrigin1.Description = "Hello";
     _valueOrigin1.Source      = ValueOriginSources.Database;
     _valueOrigin1.Method      = ValueOriginDeterminationMethods.InVitro;
     _valueOrigin2.UpdateFrom(_valueOrigin1);
 }
 protected override void Context()
 {
     base.Context();
     _sourceValueOrigin = new ValueOrigin
     {
         Id          = 10,
         Description = "New description",
         Source      = ValueOriginSources.Database,
         Method      = ValueOriginDeterminationMethods.ManualFit,
     };
 }
Exemple #6
0
 public TimeParameter()
 {
     Tags = new Tags {
         new Tag(Constants.TIME)
     };
     Info                    = new ParameterInfo();
     Origin                  = new ParameterOrigin();
     ValueOrigin             = new ValueOrigin();
     CanBeVaried             = false;
     CanBeVariedInPopulation = false;
     NegativeValuesAllowed   = true;
 }
        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);
        }
 protected override void Because()
 {
     _unknownValueOrigin = ValueOrigin.Unknown;
 }
 public void shoud_return_true_if_they_are_both_undefined()
 {
     _sourceValueOrigin = new ValueOrigin();
     _sourceValueOrigin.Equals(_targetValueOrigin).ShouldBeTrue();
 }
 protected override void Because()
 {
     _clone = sut.Clone();
 }
 public void should_return_equal_if_they_are_both_undefined()
 {
     _valueOrigin1 = new ValueOrigin();
     _valueOrigin2 = new ValueOrigin();
     _valueOrigin1.ShouldBeEqualTo(_valueOrigin2);
 }
 public void should_return_comparable_if_they_are_both_undefined()
 {
     _valueOrigin1 = new ValueOrigin();
     _valueOrigin2 = new ValueOrigin();
     _valueOrigin1.CompareTo(_valueOrigin2).ShouldBeEqualTo(0);
 }