protected override void Context()
 {
    base.Context();
    _individual = A.Fake<Individual>();
    var originData = new OriginData();
    var diseaseState = new DiseaseState {DomainHelperForSpecs.ConstantParameterWithValue().WithName("P")};
    originData.DiseaseState = diseaseState;
    originData.AddDiseaseStateParameter(new OriginDataParameter {Name = "P"});
    originData.Population = new SpeciesPopulation();
    A.CallTo(() => _individual.OriginData).Returns(originData);
    var organism = new Organism {DomainHelperForSpecs.ConstantParameterWithValue(5).WithName(CoreConstants.Parameters.MEAN_WEIGHT)};
    A.CallTo(() => _individual.Organism).Returns(organism);
 }
Example #2
0
 protected override void Context()
 {
     base.Context();
     _organism   = new Organism();
     _individual = A.Fake <Individual>();
     _diseaseStateParameterDTO = A.Fake <IParameterDTO>();
     A.CallTo(() => _individual.Organism).Returns(_organism);
     _origin = new OriginData
     {
         DiseaseState = new DiseaseState {
             Name = "MyDiseaseState"
         }
     };
     _diseaseStateParameter = new OriginDataParameter();
     _origin.AddDiseaseStateParameter(_diseaseStateParameter);
     A.CallTo(() => _originDataParameterMapper.MapFrom(_diseaseStateParameter)).Returns(_diseaseStateParameterDTO);
     _individual.OriginData = _origin;
 }
Example #3
0
        private void updateDiseaseState(OriginData originData, IndividualSettingsDTO individualSettingsDTO)
        {
            var diseaseState = individualSettingsDTO.DiseaseState;
            var isHealthy    = diseaseState.IsHealthy;

            if (isHealthy)
            {
                originData.DiseaseState = null;
                return;
            }

            originData.DiseaseState = diseaseState;
            var diseaseStateParameter = individualSettingsDTO.DiseaseStateParameter;

            //This is a disease state without parameters
            if (diseaseStateParameter.IsNull())
            {
                return;
            }

            //disease parameters are saved in a collection and we need to save the name to differentiate them
            originData.AddDiseaseStateParameter(originDataParameterFrom(diseaseStateParameter, addName: true));
        }