Esempio n. 1
0
        protected override void Context()
        {
            _parameterMapper            = A.Fake <IParameterToParameterDTOMapper>();
            _subPopulationDTOMapper     = A.Fake <ISubPopulationToSubPopulationDTOMapper>();
            _calculationMethodDTOMapper = A.Fake <ICalculationMethodToCategoryCalculationMethodDTOMapper>();
            _diseaseStateRepository     = A.Fake <IDiseaseStateRepository>();
            _originDataParameterMapper  = A.Fake <IOriginDataParameterToParameterDTOMapper>();

            _species = new Species {
                Name = "species"
            };
            _speciesPopulation = new SpeciesPopulation {
                Name = "population"
            };
            _speciesPopulation.AddGender(new Gender {
                Name = "gender"
            });
            _species.AddPopulation(_speciesPopulation);
            sut = new IndividualToIIndividualSettingsDTOMapper(
                _parameterMapper,
                _subPopulationDTOMapper,
                _calculationMethodDTOMapper,
                _diseaseStateRepository,
                _originDataParameterMapper
                );
        }
Esempio n. 2
0
 protected override void Context()
 {
     base.Context();
     _species = new Species {
         Name = CoreConstants.Species.RAT, Id = CoreConstants.Species.RAT
     };
     _species.AddPopulation(new SpeciesPopulation());
     _individual    = new Individual();
     _organism      = A.Fake <Organism>();
     _neighborhoods = A.Fake <IContainer>();
     _rootContainer = new RootContainer();
     A.CallTo(() => _entityBaseFactory.Create <IRootContainer>()).Returns(_rootContainer);
     A.CallTo(() => _entityBaseFactory.Create <Individual>()).Returns(_individual);
     A.CallTo(() => _entityBaseFactory.Create <Organism>()).Returns(_organism);
     A.CallTo(() => _entityBaseFactory.Create <IContainer>()).Returns(_neighborhoods);
 }
        public Species MapFrom(FlatSpecies flatSpecies)
        {
            var species = new Species {
                Id = flatSpecies.Id, Name = flatSpecies.Id, Icon = flatSpecies.IconName
            };

            foreach (var population in _populationRepository.All().Where(pop => pop.Species == flatSpecies.Id).OrderBy(x => x.Sequence))
            {
                species.AddPopulation(population);
            }

            foreach (var pvvCategory in _pvvCategoriesMapper.MapFrom(_flatParameterValueVersionRepository.All(), flatSpecies.Id))
            {
                species.AddPVVCategory(pvvCategory);
            }

            return(species);
        }
Esempio n. 4
0
        protected override void Context()
        {
            base.Context();
            var species = new Species {
                Name = CoreConstants.Species.HUMAN, Id = CoreConstants.Species.HUMAN
            };

            species.AddPopulation(new SpeciesPopulation {
                Name = CoreConstants.Population.ICRP
            });
            A.CallTo(() => _speciesRepository.All()).Returns(new[] { species });
            _individual    = new Individual();
            _organism      = A.Fake <Organism>();
            _neighborhoods = A.Fake <IContainer>();
            _rootContainer = new RootContainer();
            A.CallTo(() => _entityBaseFactory.Create <IRootContainer>()).Returns(_rootContainer);
            A.CallTo(() => _entityBaseFactory.Create <Individual>()).Returns(_individual);
            A.CallTo(() => _entityBaseFactory.Create <Organism>()).Returns(_organism);
            A.CallTo(() => _entityBaseFactory.Create <IContainer>()).Returns(_neighborhoods);
        }
Esempio n. 5
0
 protected override void Context()
 {
     _speciesRepository   = A.Fake <ISpeciesRepository>();
     _originDataTask      = A.Fake <IOriginDataTask>();
     _individualModelTask = A.Fake <IIndividualModelTask>();
     _male   = new Gender().WithName(CoreConstants.Gender.Male);
     _female = new Gender().WithName(CoreConstants.Gender.Female);
     _human  = new Species().WithName(CoreConstants.Species.Human);
     _icrp   = new SpeciesPopulation {
         IsHeightDependent = true, IsAgeDependent = true
     }.WithName(CoreConstants.Population.ICRP);
     _anotherPop = new SpeciesPopulation().WithName("Another Pop");
     _cmForHuman = new CalculationMethod();
     _cmForHuman.AddSpecies(_human.Name);
     _icrp.AddGender(_male);
     _human.AddPopulation(_icrp);
     _category = new CalculationMethodCategory();
     _category.Add(_cmForHuman);
     A.CallTo(() => _speciesRepository.All()).Returns(new[] { _human });
     A.CallTo(() => _originDataTask.AllCalculationMethodCategoryFor(_human)).Returns(new[] { _category });
     _batchOriginData = new OriginData();
     sut = new OriginDataMapper(_speciesRepository, _originDataTask, _individualModelTask);
 }
Esempio n. 6
0
        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);
        }