private Data.ArtDatabankenService.PeriodType GetPeriodType(Boolean refresh)
 {
     if (_periodType.IsNull() || refresh)
     {
         _periodType = PeriodManagerTest.GetOnePeriodType();
     }
     return(_periodType);
 }
 private Data.ArtDatabankenService.Period GetPeriod(Boolean refresh)
 {
     if (_period.IsNull() || refresh)
     {
         _period = PeriodManagerTest.GetOnePeriod();
     }
     return(_period);
 }
        public void CanLoadSpeciesFactForNonExistingTaxon()
        {
            var paramSelection = new UserParameterSelection();

            paramSelection.Taxa = new Data.ArtDatabankenService.TaxonList();
            paramSelection.Taxa.Add(11);

            paramSelection.Factors = new Data.ArtDatabankenService.FactorList();
            paramSelection.Factors.Add(1991);

            paramSelection.IndividualCategories = IndividualCategoryManagerTest.GetSomeIndividualCategories();
            paramSelection.Periods = PeriodManagerTest.GetSomePeriods();

            var speciesFacts = Data.ArtDatabankenService.SpeciesFactManager.GetSpeciesFactsByUserParameterSelection(paramSelection);

            Assert.IsTrue(speciesFacts.Count == 1);
        }
        public void CanCreateNewSpeciesFactForNonExistentTaxon()
        {
            var paramSelection = new UserParameterSelection();

            paramSelection.Taxa = new Data.ArtDatabankenService.TaxonList();
            paramSelection.Taxa.Add(11);

            paramSelection.Factors = new Data.ArtDatabankenService.FactorList();
            paramSelection.Factors.Add(1991);

            paramSelection.IndividualCategories = IndividualCategoryManagerTest.GetSomeIndividualCategories();
            paramSelection.Periods = PeriodManagerTest.GetSomePeriods();

            var speciesFacts = Data.ArtDatabankenService.SpeciesFactManager.GetSpeciesFactsByUserParameterSelection(paramSelection);

            Data.ArtDatabankenService.SpeciesFactManager.UpdateSpeciesFacts(speciesFacts);
        }
        public void GetSpeciesFactByUserParameterSelection()
        {
            FactorList factors;

            Data.ArtDatabankenService.IndividualCategoryList individualCategories;
            Int32 count;

            Data.ArtDatabankenService.PeriodList periods;
            ReferenceList references;

            Data.ArtDatabankenService.SpeciesFactList speciesFacts;
            Data.ArtDatabankenService.TaxonList       hosts, taxa;
            UserParameterSelection userParmeterSelection;

            userParmeterSelection = new UserParameterSelection();
            factors = FactorManagerTest.GetSomeFactors();
            hosts   = TaxonManagerTest.GetSomeTaxa();
            individualCategories = IndividualCategoryManagerTest.GetSomeIndividualCategories();
            periods    = PeriodManagerTest.GetSomePeriods();
            references = ReferenceManagerTest.GetSomeReferences();
            taxa       = hosts;

            userParmeterSelection.Taxa.Merge(taxa);
            speciesFacts = Data.ArtDatabankenService.SpeciesFactManager.GetSpeciesFactsByUserParameterSelection(userParmeterSelection);
            Assert.IsTrue(speciesFacts.IsNotEmpty());
            count = speciesFacts.Count;

            userParmeterSelection.Factors.Merge(factors);
            speciesFacts = Data.ArtDatabankenService.SpeciesFactManager.GetSpeciesFactsByUserParameterSelection(userParmeterSelection);
            if (speciesFacts.IsNotEmpty())
            {
                Assert.IsTrue(count > speciesFacts.Count);
            }
            userParmeterSelection.Factors.Clear();

            userParmeterSelection.Hosts.Merge(hosts);
            speciesFacts = Data.ArtDatabankenService.SpeciesFactManager.GetSpeciesFactsByUserParameterSelection(userParmeterSelection);
            if (speciesFacts.IsNotEmpty())
            {
                Assert.IsTrue(count > speciesFacts.Count);
            }
            userParmeterSelection.Hosts.Clear();

            userParmeterSelection.IndividualCategories.Merge(individualCategories);
            speciesFacts = Data.ArtDatabankenService.SpeciesFactManager.GetSpeciesFactsByUserParameterSelection(userParmeterSelection);
            if (speciesFacts.IsNotEmpty())
            {
                Assert.IsTrue(count > speciesFacts.Count);
            }
            userParmeterSelection.IndividualCategories.Clear();

            userParmeterSelection.Periods.Merge(periods);
            speciesFacts = Data.ArtDatabankenService.SpeciesFactManager.GetSpeciesFactsByUserParameterSelection(userParmeterSelection);
            if (speciesFacts.IsNotEmpty())
            {
                Assert.IsTrue(count > speciesFacts.Count);
            }
            userParmeterSelection.Periods.Clear();

            userParmeterSelection.References.Merge(references);
            speciesFacts = Data.ArtDatabankenService.SpeciesFactManager.GetSpeciesFactsByUserParameterSelection(userParmeterSelection);
            if (speciesFacts.IsNotEmpty())
            {
                Assert.IsTrue(count > speciesFacts.Count);
            }
            userParmeterSelection.References.Clear();
        }