public void GetTaxaByQuery()
        {
            Data.ArtDatabankenService.Factor      factor;
            Data.ArtDatabankenService.FactorField factorField;
            SpeciesFactCondition      speciesFactCondition;
            SpeciesFactFieldCondition speciesFactFieldCondition;
            TaxonInformationType      taxonInformationType;

            Data.ArtDatabankenService.TaxonList taxa;

            taxonInformationType = TaxonInformationType.Basic;

            // Test one factor.
            speciesFactCondition = new SpeciesFactCondition();
            speciesFactCondition.Factors.Add(FactorManagerTest.GetOneFactor());
            taxa = Data.ArtDatabankenService.TaxonManager.GetTaxaByQuery(speciesFactCondition, taxonInformationType);
            Assert.IsTrue(taxa.IsNotEmpty());

            // Test several factors.
            speciesFactCondition = new SpeciesFactCondition();
            speciesFactCondition.Factors.AddRange(FactorManagerTest.GetSomeFactors());
            taxa = Data.ArtDatabankenService.TaxonManager.GetTaxaByQuery(speciesFactCondition, taxonInformationType);
            Assert.IsTrue(taxa.IsNotEmpty());

            // Test one period.
            speciesFactCondition = new SpeciesFactCondition();
            speciesFactCondition.Factors.Add(Data.ArtDatabankenService.FactorManager.GetFactor(Data.ArtDatabankenService.FactorId.RedlistCategory));
            speciesFactCondition.Periods.Add(PeriodManager.GetPeriod(PeriodId.Year2005));
            taxa = Data.ArtDatabankenService.TaxonManager.GetTaxaByQuery(speciesFactCondition, taxonInformationType);
            Assert.IsTrue(taxa.IsNotEmpty());

            // Test several periods.
            speciesFactCondition = new SpeciesFactCondition();
            speciesFactCondition.Factors.Add(Data.ArtDatabankenService.FactorManager.GetFactor(Data.ArtDatabankenService.FactorId.RedlistCategory));
            speciesFactCondition.Periods.AddRange(PeriodManager.GetPeriods());
            taxa = Data.ArtDatabankenService.TaxonManager.GetTaxaByQuery(speciesFactCondition, taxonInformationType);
            Assert.IsTrue(taxa.IsNotEmpty());

            // Test one species fact field enum (KeyInt) condition.
            speciesFactCondition = new SpeciesFactCondition();
            factor = Data.ArtDatabankenService.FactorManager.GetFactor(Data.ArtDatabankenService.FactorId.Redlist_OrganismLabel1);
            Assert.IsTrue(taxa.IsNotEmpty());
            speciesFactCondition.Factors.Add(factor);
            speciesFactFieldCondition = new SpeciesFactFieldCondition();
            factorField = factor.FactorDataType.MainField;
            speciesFactFieldCondition.FactorField = factorField;
            speciesFactFieldCondition.SetValue(factorField.FactorFieldEnum.Values[3].KeyInt);
            speciesFactCondition.SpeciesFactFieldConditions.Add(speciesFactFieldCondition);
            taxa = Data.ArtDatabankenService.TaxonManager.GetTaxaByQuery(speciesFactCondition, taxonInformationType);
            Assert.IsTrue(taxa.IsNotEmpty());

            // Test several species fact field enum (KeyInt) conditions.
            speciesFactCondition = new SpeciesFactCondition();
            factor = Data.ArtDatabankenService.FactorManager.GetFactor(Data.ArtDatabankenService.FactorId.Redlist_OrganismLabel1);
            Assert.IsTrue(taxa.IsNotEmpty());
            speciesFactCondition.Factors.Add(factor);

            speciesFactFieldCondition = new SpeciesFactFieldCondition();
            factorField = factor.FactorDataType.MainField;
            speciesFactFieldCondition.FactorField = factorField;
            speciesFactFieldCondition.SetValue(factorField.FactorFieldEnum.Values[3].KeyInt);
            speciesFactCondition.SpeciesFactFieldConditions.Add(speciesFactFieldCondition);

            speciesFactFieldCondition = new SpeciesFactFieldCondition();
            factorField = factor.FactorDataType.MainField;
            speciesFactFieldCondition.FactorField = factorField;
            speciesFactFieldCondition.SetValue(factorField.FactorFieldEnum.Values[4].KeyInt);
            speciesFactCondition.SpeciesFactFieldConditions.Add(speciesFactFieldCondition);

            speciesFactFieldCondition = new SpeciesFactFieldCondition();
            factorField = factor.FactorDataType.MainField;
            speciesFactFieldCondition.FactorField = factorField;
            speciesFactFieldCondition.SetValue(factorField.FactorFieldEnum.Values[5].KeyInt);
            speciesFactCondition.SpeciesFactFieldConditions.Add(speciesFactFieldCondition);

            taxa = ArtDatabanken.Data.ArtDatabankenService.TaxonManager.GetTaxaByQuery(speciesFactCondition, taxonInformationType);
            Assert.IsTrue(taxa.IsNotEmpty());

            // Test one species fact field enum (KeyText) condition.
            speciesFactCondition = new SpeciesFactCondition();
            factor = Data.ArtDatabankenService.FactorManager.GetFactor(Data.ArtDatabankenService.FactorId.Redlist_TaxonType);
            Assert.IsTrue(taxa.IsNotEmpty());
            speciesFactCondition.Factors.Add(factor);
            speciesFactCondition.Periods.Add(PeriodManager.GetPeriod(2));
            speciesFactFieldCondition = new SpeciesFactFieldCondition();
            factorField = factor.FactorDataType.MainField;
            speciesFactFieldCondition.FactorField = factorField;
            speciesFactFieldCondition.SetValue(factorField.FactorFieldEnum.Values[0].KeyText);
            speciesFactFieldCondition.IsEnumAsString = true;
            speciesFactCondition.SpeciesFactFieldConditions.Add(speciesFactFieldCondition);
            taxa = Data.ArtDatabankenService.TaxonManager.GetTaxaByQuery(speciesFactCondition, taxonInformationType);
            Assert.IsTrue(taxa.IsNotEmpty());

            // Test several species fact field enum (KeyText) condition.
            speciesFactCondition = new SpeciesFactCondition();
            factor = Data.ArtDatabankenService.FactorManager.GetFactor(Data.ArtDatabankenService.FactorId.Redlist_TaxonType);
            Assert.IsTrue(taxa.IsNotEmpty());
            speciesFactCondition.Factors.Add(factor);
            speciesFactCondition.Periods.Add(PeriodManager.GetPeriod(2));

            speciesFactFieldCondition = new SpeciesFactFieldCondition();
            factorField = factor.FactorDataType.MainField;
            speciesFactFieldCondition.FactorField = factorField;
            speciesFactFieldCondition.SetValue(factorField.FactorFieldEnum.Values[0].KeyText);
            speciesFactFieldCondition.IsEnumAsString = true;
            speciesFactCondition.SpeciesFactFieldConditions.Add(speciesFactFieldCondition);

            speciesFactFieldCondition = new SpeciesFactFieldCondition();
            factorField = factor.FactorDataType.MainField;
            speciesFactFieldCondition.FactorField = factorField;
            speciesFactFieldCondition.SetValue(factorField.FactorFieldEnum.Values[1].KeyText);
            speciesFactFieldCondition.IsEnumAsString = true;
            speciesFactCondition.SpeciesFactFieldConditions.Add(speciesFactFieldCondition);

            speciesFactFieldCondition = new SpeciesFactFieldCondition();
            factorField = factor.FactorDataType.MainField;
            speciesFactFieldCondition.FactorField = factorField;
            speciesFactFieldCondition.SetValue(factorField.FactorFieldEnum.Values[2].KeyText);
            speciesFactFieldCondition.IsEnumAsString = true;
            speciesFactCondition.SpeciesFactFieldConditions.Add(speciesFactFieldCondition);

            taxa = Data.ArtDatabankenService.TaxonManager.GetTaxaByQuery(speciesFactCondition, taxonInformationType);
            Assert.IsTrue(taxa.IsNotEmpty());
        }
        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();
        }