protected override async Task Context() { await base.Context(); _snapshot = await sut.MapToSnapshot(_individual); _project = new PKSimProject(); _snapshotContext = new SnapshotContext(_project, ProjectVersions.V11); _snapshot.Name = "New individual"; _snapshot.Description = "The description that will be deserialized"; //clear enzyme before mapping them again _individual.RemoveExpressionProfile(_expressionProfile1); _individual.RemoveExpressionProfile(_expressionProfile2); //reset parameter _parameterKidney.ResetToDefault(); _project.AddBuildingBlock(_expressionProfile1); _project.AddBuildingBlock(_expressionProfile2); _newOriginData = new Model.OriginData(); A.CallTo(() => _originDataMapper.MapToModel(_snapshot.OriginData, A <SnapshotContext> ._)).Returns(_newOriginData); A.CallTo(() => _individualFactory.CreateAndOptimizeFor(_newOriginData, _snapshot.Seed)) .Returns(_individual); }
protected override async Task Context() { await base.Context(); _snapshot = await sut.MapToSnapshot(_individual); _snapshot.Name = "New individual"; _snapshot.Description = "The description that will be deserialized"; //clear enzyme before mapping them again _individual.RemoveMolecule(_enzyme); _individual.RemoveMolecule(_transporter); //reset parameter _parameterKidney.ResetToDefault(); _molecule1 = new IndividualEnzyme().WithName("Mol1"); _molecule2 = new IndividualEnzyme().WithName("Mol2"); A.CallTo(() => _moleculeMapper.MapToModel(_enzymeSnapshot, _individual)).Returns(_molecule1); A.CallTo(() => _moleculeMapper.MapToModel(_transporterSnapshot, _individual)).Returns(_molecule2); _newOriginData = new Model.OriginData(); A.CallTo(() => _originDataMapper.MapToModel(_snapshot.OriginData)).Returns(_newOriginData); A.CallTo(() => _individualFactory.CreateAndOptimizeFor(_newOriginData, _snapshot.Seed)) .Returns(_individual); }
protected override async Task Because() { _newOriginData = await sut.MapToModel(_snapshot); }
protected override Task Context() { _parameterMapper = A.Fake <ParameterMapper>(); _calculationMethodCacheMapper = A.Fake <CalculationMethodCacheMapper>(); _originDataTask = A.Fake <IOriginDataTask>(); _dimensionRepository = A.Fake <IDimensionRepository>(); _individualModelTask = A.Fake <IIndividualModelTask>(); _speciesRepository = A.Fake <ISpeciesRepository>(); _valueOriginMapper = A.Fake <ValueOriginMapper>(); sut = new OriginDataMapper(_parameterMapper, _calculationMethodCacheMapper, _valueOriginMapper, _originDataTask, _dimensionRepository, _individualModelTask, _speciesRepository); _ageSnapshotParameter = new Parameter { Value = 1 }; _heightSnapshotParameter = new Parameter { Value = 2 }; _weightSnapshotParameter = new Parameter { Value = 3 }; _gestationalAgeSnapshotParameter = new Parameter { Value = 4 }; _speciesPopulation = new SpeciesPopulation { Name = "SpeciesPopulation", IsHeightDependent = true, IsAgeDependent = true }; _gender = new Gender { Name = "Unknown" }; _species = new Species { Name = "Human" }; _species.AddPopulation(_speciesPopulation); _anotherPopulation = new SpeciesPopulation { Name = "Another species population", IsHeightDependent = true, IsAgeDependent = true }; _speciesPopulation.AddGender(_gender); _anotherGender = new Gender { Name = "AnotherGender" }; A.CallTo(() => _speciesRepository.All()).Returns(new[] { _species }); _originData = new Model.OriginData { Age = 35, AgeUnit = "years", Height = 17.8, HeightUnit = "m", Weight = 73, WeightUnit = "kg", Species = _species, SpeciesPopulation = _speciesPopulation, Gender = _gender, GestationalAge = 40 }; A.CallTo(() => _parameterMapper.ParameterFrom(null, A <string> ._, A <IDimension> ._)).Returns(null); A.CallTo(() => _parameterMapper.ParameterFrom(_originData.Age, A <string> ._, A <IDimension> ._)).Returns(_ageSnapshotParameter); A.CallTo(() => _parameterMapper.ParameterFrom(_originData.Height, A <string> ._, A <IDimension> ._)).Returns(_heightSnapshotParameter); A.CallTo(() => _parameterMapper.ParameterFrom(_originData.Weight, A <string> ._, A <IDimension> ._)).Returns(_weightSnapshotParameter); A.CallTo(() => _parameterMapper.ParameterFrom(_originData.GestationalAge, A <string> ._, A <IDimension> ._)).Returns(_gestationalAgeSnapshotParameter); _valueOriginSnapshot = new ValueOrigin(); A.CallTo(() => _valueOriginMapper.MapToSnapshot(_originData.ValueOrigin)).Returns(_valueOriginSnapshot); return(_completed); }