public void GetTaxaByIdTaxonIdsNullError()
        {
            List <WebTaxon> taxa;

            taxa = TaxonManager.GetTaxaById(GetContext(), null, TaxonInformationType.Basic);
            Assert.IsTrue(taxa.IsNotEmpty());
        }
        public void GetTaxaByIdTaxonIdsEmptyError()
        {
            List <WebTaxon> taxa;
            List <Int32>    taxonIds;

            taxonIds = new List <Int32>();
            taxa     = TaxonManager.GetTaxaById(GetContext(), taxonIds, TaxonInformationType.Basic);
            Assert.IsTrue(taxa.IsNotEmpty());
        }
        public void GetTaxaById()
        {
            Boolean                    taxonFound;
            List <Int32>               taxonIds;
            List <WebTaxon>            taxa;
            List <WebTaxonName>        taxonNames;
            WebTaxonNameSearchCriteria searchCriteria;

            foreach (TaxonInformationType taxonInformationType in Enum.GetValues(typeof(TaxonInformationType)))
            {
                taxa = TaxonManager.GetTaxaById(GetContext(), GetSomeTaxonIds(), taxonInformationType);
                Assert.IsNotNull(taxa);
                Assert.AreEqual(taxa.Count, GetSomeTaxonIds().Count);

                foreach (WebTaxon taxon in taxa)
                {
                    Assert.AreEqual(taxon.TaxonInformationType, taxonInformationType);

                    taxonFound = false;
                    foreach (Int32 taxonId in GetSomeTaxonIds())
                    {
                        if (taxonId == taxon.Id)
                        {
                            taxonFound = true;
                            break;
                        }
                    }
                    Assert.IsTrue(taxonFound);
                }
            }

            // Test that only valid relations in dt_hier are used.
            // Test taxon is 1097, Oedipodium Griffithianum which
            // has moved in the taxa tree more than once.

            taxonIds = new List <Int32>();
            taxonIds.Add(1097);
            taxa = TaxonManager.GetTaxaById(GetContext(), taxonIds, TaxonInformationType.PrintObs);
            Assert.IsNotNull(taxa);
            Assert.AreEqual(taxa.Count, taxonIds.Count);

            // Test problem with searching for taxon names equal to 'mossa'.
            searchCriteria = new WebTaxonNameSearchCriteria();
            searchCriteria.NameSearchString = "mossa";
            searchCriteria.NameSearchMethod = ArtDatabankenService.Data.SearchStringComparisonMethod.Iterative;
            taxonNames = TaxonManager.GetTaxonNamesBySearchCriteria(GetContext(), searchCriteria);
            taxonIds   = new List <Int32>();
            foreach (WebTaxonName taxonName in taxonNames)
            {
                if (!taxonIds.Contains(taxonName.Taxon.Id))
                {
                    taxonIds.Add(taxonName.Taxon.Id);
                }
            }
            taxa = TaxonManager.GetTaxaById(GetContext(), taxonIds, TaxonInformationType.Basic);
            Assert.IsTrue(taxa.IsNotEmpty());

            // Test with invalid taxa.
            taxonIds = new List <Int32>();
            taxonIds.Add(190);
            taxonIds.Add(1637);
            taxonIds.Add(1638);
            taxa = TaxonManager.GetTaxaById(GetContext(), taxonIds, TaxonInformationType.Basic);
            Assert.IsTrue(taxa.IsNotEmpty());
            Assert.AreEqual(taxonIds.Count, taxa.Count);
        }