コード例 #1
0
        protected override void Context()
        {
            base.Context();
            _c1 = new CalculationMethod {
                Name = "C1", Category = "C"
            };
            _c1.AddSpecies(_originData.Species.Name);
            _c2 = new CalculationMethod {
                Name = "C2", Category = "C"
            };
            _c2.AddSpecies(_originData.Species.Name);
            var modelConfiguration = new ModelConfiguration();

            modelConfiguration.ModelName   = "Model";
            modelConfiguration.SpeciesName = "Species";
            var category = new CalculationMethodCategory {
                Name = "C"
            };

            category.Add(_c1);
            category.Add(_c2);
            modelConfiguration.AddCalculationMethodCategory(category);
            _oldModelProperties = new ModelProperties {
                ModelConfiguration = modelConfiguration
            };
            _newModelProperties = new ModelProperties {
                ModelConfiguration = modelConfiguration
            };
            _oldModelProperties.AddCalculationMethod(_c1);
            _newModelProperties.AddCalculationMethod(_c2);
        }
        protected override void Context()
        {
            base.Context();
            _categoryName = "categoryName";
            _calculationMethodCategory1 = new CalculationMethodCategory {
                Name = _categoryName + "1"
            };
            _calculationMethodCategory2 = new CalculationMethodCategory {
                Name = _categoryName + "2"
            };

            _cm1 = new CalculationMethod {
                Category = _categoryName + "1", Name = "name1"
            };
            _cm2 = new CalculationMethod {
                Category = _categoryName + "2", Name = "name2"
            };
            _cm3 = new CalculationMethod {
                Category = _categoryName + "2", Name = "name3"
            };
            _calculationMethodCategory1.Add(_cm1);
            _calculationMethodCategory2.Add(_cm2);
            _calculationMethodCategory2.Add(_cm3);

            _allCalculationMethodCategories.Add(_calculationMethodCategory1);
            _allCalculationMethodCategories.Add(_calculationMethodCategory2);

            var compound = new Compound();

            compound.CalculationMethodCache.AddCalculationMethod(_cm1);
            compound.CalculationMethodCache.AddCalculationMethod(_cm2);
            compound.CalculationMethodCache.AddCalculationMethod(_cm3);

            sut.Edit(compound, x => !string.Equals(x.Name, "categoryName2"));
        }
        protected override void Context()
        {
            base.Context();
            _categoryName = "tralal";
            _calculationMethodCategory = new CalculationMethodCategory {
                Name = _categoryName
            };
            _cm1 = new CalculationMethod();
            _cm2 = new CalculationMethod();
            _calculationMethodCategory.Add(_cm1);
            _calculationMethodCategory.Add(_cm2);

            _allCalculationMethodCategories.Add(_calculationMethodCategory);
        }
コード例 #4
0
        protected override Task Context()
        {
            _calculationMethodRepository         = A.Fake <ICalculationMethodRepository>();
            _calculationMethodCategoryRepository = A.Fake <ICalculationMethodCategoryRepository>();
            _logger = A.Fake <ILogger>();

            sut             = new CalculationMethodCacheMapper(_calculationMethodRepository, _calculationMethodCategoryRepository, _logger);
            _singleCategory = new CalculationMethodCategory {
                Name = "Multiple"
            };
            _multipleCategory = new CalculationMethodCategory {
                Name = "Single"
            };


            _calculationMethodWithMultipleOptions = new CalculationMethod
            {
                Name        = "CM1",
                DisplayName = "CM1",
                Category    = _multipleCategory.Name
            };

            _calculationMethodWithSingleOption = new CalculationMethod
            {
                Name        = "CM2",
                DisplayName = "CM2",
                Category    = _singleCategory.Name
            };

            _anotherCalculationMethodInMultipleOptions = new CalculationMethod
            {
                Name     = "Another CM",
                Category = _multipleCategory.Name
            };

            A.CallTo(() => _calculationMethodRepository.All()).Returns(new [] { _calculationMethodWithMultipleOptions, _anotherCalculationMethodInMultipleOptions, _calculationMethodWithSingleOption, });

            _singleCategory.Add(_calculationMethodWithSingleOption);
            _multipleCategory.Add(_calculationMethodWithMultipleOptions);
            _multipleCategory.Add(_anotherCalculationMethodInMultipleOptions);

            _calculationMethodCache = new CalculationMethodCache();
            _calculationMethodCache.AddCalculationMethod(_calculationMethodWithMultipleOptions);
            _calculationMethodCache.AddCalculationMethod(_calculationMethodWithSingleOption);

            A.CallTo(() => _calculationMethodCategoryRepository.FindBy(_singleCategory.Name)).Returns(_singleCategory);
            A.CallTo(() => _calculationMethodCategoryRepository.FindBy(_multipleCategory.Name)).Returns(_multipleCategory);

            return(Task.FromResult(true));
        }
コード例 #5
0
 protected override void Context()
 {
     base.Context();
     _notIndividualCategory = new CalculationMethodCategory {
         CategoryType = CategoryType.Model
     };
     _humanCategory = new CalculationMethodCategory {
         CategoryType = CategoryType.Individual
     };
     _dogCategory = new CalculationMethodCategory {
         CategoryType = CategoryType.Individual
     };
     _cmHuman = new CalculationMethod();
     _cmHuman.AddSpecies(CoreConstants.Species.Human);
     _humanCategory.Add(_cmHuman);
     _cmDog = new CalculationMethod();
     _cmDog.AddSpecies("Dog");
     _dogCategory.Add(_cmDog);
     _allCategories.Add(_notIndividualCategory);
     _allCategories.Add(_humanCategory);
     _allCategories.Add(_dogCategory);
     _species = new Species {
         Name = CoreConstants.Species.Human
     };
 }
コード例 #6
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);
        }
コード例 #7
0
        protected override void Context()
        {
            base.Context();
            _c1 = new CalculationMethod {
                Name = "C1", Category = "C"
            };
            _c2 = new CalculationMethod {
                Name = "C2", Category = "C"
            };
            _c3 = new CalculationMethod {
                Name = "C3", Category = "AnotherCategory"
            };
            var modelConfiguration1 = new ModelConfiguration();

            modelConfiguration1.ModelName   = "Model";
            modelConfiguration1.SpeciesName = "Species";
            var category = new CalculationMethodCategory {
                Name = "C"
            };

            category.Add(_c1);
            category.Add(_c2);
            var anotherCategory = new CalculationMethodCategory {
                Name = "AnotherCategory"
            };

            anotherCategory.Add(_c3);
            var modelConfiguration2 = new ModelConfiguration();

            modelConfiguration2.ModelName   = "Model2";
            modelConfiguration2.SpeciesName = "Species2";

            modelConfiguration1.AddCalculationMethodCategory(category);
            modelConfiguration2.AddCalculationMethodCategory(category);
            modelConfiguration2.AddCalculationMethodCategory(anotherCategory);
            _oldModelProperties = new ModelProperties {
                ModelConfiguration = modelConfiguration1
            };
            _newModelProperties = new ModelProperties {
                ModelConfiguration = modelConfiguration2
            };

            _oldModelProperties.AddCalculationMethod(_c1);
            _newModelProperties.AddCalculationMethod(_c2);
            _newModelProperties.AddCalculationMethod(_c3);
        }
        protected override void Context()
        {
            base.Context();

            _catOnlyOne = new CalculationMethodCategory {
                Name = "Model"
            };
            _catOnlyOne.Add(new CalculationMethod {
                Name = "tralala"
            });
            _catTwo = new CalculationMethodCategory {
                Name = "Compound"
            };
            _catTwo.Add(new CalculationMethod {
                Name = "tralala"
            });
            _catTwo.Add(new CalculationMethod {
                Name = "tutu"
            });

            _allCalculationMethodCategories.Add(_catOnlyOne);
            _allCalculationMethodCategories.Add(_catTwo);
        }
        protected override void Context()
        {
            base.Context();
            _category = new CalculationMethodCategory {
                Name = "Compound"
            };
            var cm1 = new CalculationMethod {
                Name = "tralala", Category = _category.Name
            };

            _cm2 = new CalculationMethod {
                Name = "tutu", Category = _category.Name
            };
            _category.Add(cm1);
            _category.Add(_cm2);

            _withCalculationMethods = new CompoundProperties();
            _withCalculationMethods.AddCalculationMethod((cm1));
            _allCalculationMethodCategories.Add(_category);

            sut.Edit(_withCalculationMethods);

            _allDTOs[0].CalculationMethod = _cm2;
        }
コード例 #10
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);
 }