Ejemplo n.º 1
0
        public void SaveAnimalLicensingDetail()
        {
            BOAnimalLicensingDetail detail = GetFirstLicensingDetail();
            int oldLife = detail.AverageLifespan;

            detail.AverageLifespan++;
            detail.Save();
            detail = GetFirstLicensingDetail();
            Assert.IsTrue(detail.AverageLifespan == oldLife + 1);

            detail.AverageLifespan--;
            detail.Save();
            detail = GetFirstLicensingDetail();
            Assert.IsTrue(detail.AverageLifespan == oldLife);
        }
Ejemplo n.º 2
0
        public void DeleteAnimalLicensingDetail()
        {
            foreach (BOTaxon taxon in mSearchResults.Taxa)
            {                                                                                           // seek the first taxon without a licensing display
                BOAnimalLicensingDisplay display = taxon.GetAnimalLicensing();
                if (display == null)
                {                                                                                       // add one, delete it, then try to get it again
                    BOAnimalLicensingDetail detail = new BOAnimalLicensingDetail();
                    int id;
                    detail.KingdomId                 = taxon.KingdomID;
                    detail.TaxonId                   = taxon.TaxonId;
                    detail.TaxonTypeId               = taxon.TaxonTypeID;
                    detail.AverageLifespan           = 2;
                    detail.AverageNumberOfOffspring  = 2;
                    detail.BirdFeeLevel              = 2;
                    detail.IncubationOrGestationDays = 20;
                    detail.MinimumMicrochipAge       = 1;
                    detail.MinimumMicrochipSize      = 1;
                    detail.OldestAcceptedAge         = 100;
                    detail.SexualMaturityAge         = 2;
                    detail = (BOAnimalLicensingDetail)detail.Save();
                    Assert.IsNotNull(detail);
                    Assert.IsTrue(detail.AnimalLicensingId > 0);

                    id = detail.AnimalLicensingId;
                    detail.Delete();
                    detail = new BOAnimalLicensingDetail(id);                           // try and get it again: should throw an exception
                    Assert.Fail("No exception thrown");                                 // should not get here
                    return;
                }
            }
            Assert.Fail("No species found without a licensing display");
        }