public void UpdateSpeciesFacts()
        {
            int currentMaxSpeciesFactId = GetContext().GetTaxonAttributeDatabase().GetMaxSpeciesFactId();
            List <WebSpeciesFact> inSpeciesFacts, outSpeciesFacts;

            UseTransaction = true;

            // Create species facts.
            inSpeciesFacts = new List <WebSpeciesFact>
            {
                new WebSpeciesFact
                {
                    FactorId             = 34,
                    HostId               = 23,
                    IndividualCategoryId = 3,
                    PeriodId             = 2,
                    TaxonId              = 345
                },
                new WebSpeciesFact
                {
                    FactorId             = 57,
                    HostId               = 34,
                    IndividualCategoryId = 1,
                    PeriodId             = 3,
                    TaxonId              = 678
                }
            };
            SpeciesFactManager.CreateSpeciesFacts(GetContext(), inSpeciesFacts);
            outSpeciesFacts = SpeciesFactManager.GetSpeciesFactsByIds(GetContext(),
                                                                      new List <int>
            {
                GetContext().GetTaxonAttributeDatabase().GetMaxSpeciesFactId(),
                GetContext().GetTaxonAttributeDatabase().GetMaxSpeciesFactId() - 1
            });
            Assert.IsNotNull(outSpeciesFacts);
            Assert.IsTrue(outSpeciesFacts.IsNotEmpty());
            Assert.AreEqual(outSpeciesFacts.Count, inSpeciesFacts.Count);
            foreach (WebSpeciesFact createdSpeciesFact in outSpeciesFacts)
            {
                Assert.IsTrue(createdSpeciesFact.Id > currentMaxSpeciesFactId);
            }

            // Update species facts.
            List <int> speciesFactIds = outSpeciesFacts.Select(speciesFact => speciesFact.Id).ToList();

            inSpeciesFacts = SpeciesFactManager.GetSpeciesFactsByIds(GetContext(), speciesFactIds);
            SpeciesFactManager.UpdateSpeciesFacts(GetContext(), inSpeciesFacts);
            outSpeciesFacts = SpeciesFactManager.GetSpeciesFactsByIds(GetContext(), speciesFactIds);
            foreach (WebSpeciesFact speciesFact in outSpeciesFacts)
            {
                Assert.AreEqual(speciesFact.ModifiedBy, "TestFirstName TestLastName");
            }

            // Delete species facts.
            SpeciesFactManager.DeleteSpeciesFacts(GetContext(), outSpeciesFacts);
        }
        public void CreateSpeciesFacts()
        {
            Int32 currentMaxSpeciesFactId = GetContext().GetTaxonAttributeDatabase().GetMaxSpeciesFactId();
            List <WebSpeciesFact> inSpeciesFacts, outSpeciesFacts;

            UseTransaction = true;

            // Create species facts.
            inSpeciesFacts = new List <WebSpeciesFact>
            {
                new WebSpeciesFact
                {
                    FactorId               = 34,
                    FieldValue5            = "Hej ' hopp",
                    HostId                 = 23,
                    IndividualCategoryId   = 3,
                    IsFieldValue5Specified = true,
                    PeriodId               = 2,
                    TaxonId                = 345
                },
                new WebSpeciesFact
                {
                    FactorId             = 57,
                    HostId               = 34,
                    IndividualCategoryId = 1,
                    PeriodId             = 3,
                    TaxonId              = 678
                }
            };
            SpeciesFactManager.CreateSpeciesFacts(GetContext(), inSpeciesFacts);
            outSpeciesFacts = SpeciesFactManager.GetSpeciesFactsByIds(GetContext(),
                                                                      new List <int>
            {
                GetContext().GetTaxonAttributeDatabase().GetMaxSpeciesFactId(),
                GetContext().GetTaxonAttributeDatabase().GetMaxSpeciesFactId() - 1
            });
            Assert.IsNotNull(outSpeciesFacts);
            Assert.IsTrue(outSpeciesFacts.IsNotEmpty());
            Assert.AreEqual(outSpeciesFacts.Count, inSpeciesFacts.Count);
            foreach (WebSpeciesFact createdSpeciesFact in outSpeciesFacts)
            {
                Assert.IsTrue(createdSpeciesFact.Id > currentMaxSpeciesFactId);
            }
        }