Example #1
0
        protected override void Context()
        {
            _speciesRepository = A.Fake <ISpeciesRepository>();
            _view = A.Fake <IIndividualSettingsView>();
            _defaultValueRetriever       = A.Fake <IIndividualDefaultValueRetriever>();
            _individualSettingsDTOMapper = A.Fake <IIndividualToIIndividualSettingsDTOMapper>();
            _individualMapper            = A.Fake <IIndividualSettingsDTOToIndividualMapper>();
            _calculationMethodRepository = A.Fake <ICalculationMethodCategoryRepository>();
            _subPopulation            = A.Fake <IEnumerable <CategoryParameterValueVersionDTO> >();
            _editValueOriginPresenter = A.Fake <IEditValueOriginPresenter>();
            _individualSettingsDTO    = new IndividualSettingsDTO();
            _individualPropertiesDTO  = new ObjectBaseDTO();

            _speciesPopulation = A.Fake <SpeciesPopulation>();
            _species           = A.Fake <Species>();
            _gender            = A.Fake <Gender>();
            _cmCat1            = new CalculationMethodCategory();
            _cmCat2            = new CalculationMethodCategory();
            _cmCat1.Add(new CalculationMethod());
            _cmCat2.Add(new CalculationMethod());
            _individualSettingsDTO.Species           = _species;
            _individualSettingsDTO.SpeciesPopulation = _speciesPopulation;
            _individualSettingsDTO.Gender            = _gender;

            A.CallTo(() => _defaultValueRetriever.DefaultSettings()).Returns(_individualSettingsDTO);

            A.CallTo(() => _calculationMethodRepository.All()).Returns(new[] { _cmCat1, _cmCat2 });
            _individualSettingsDTO.SubPopulation = _subPopulation;
            _parentPresenter = A.Fake <IIndividualPresenter>();
            sut = new IndividualSettingsPresenter(_view, _speciesRepository, _calculationMethodRepository, _defaultValueRetriever,
                                                  _individualSettingsDTOMapper, _individualMapper, _editValueOriginPresenter);
            sut.InitializeWith(_parentPresenter);
        }
Example #2
0
        public void PrepareForCreating()
        {
            _individualSettingsDTO = _defaultValueRetriever.DefaultSettings();
            _view.BindToSettings(_individualSettingsDTO);

            updatePopulationControls();
            retrieveDefaultValues();
        }