Пример #1
0
 /// <summary>
 /// Check the data in current object
 /// </summary>
 /// <param name='taxonNameCategory'>The taxon name category.</param>
 public static void CheckData(this WebTaxonNameCategory taxonNameCategory)
 {
     if (!taxonNameCategory.IsDataChecked)
     {
         taxonNameCategory.CheckStrings();
         taxonNameCategory.IsDataChecked = true;
     }
 }
        /// <summary>
        /// Gets a reference taxon name category.
        /// </summary>
        /// <returns></returns>
        private WebTaxonNameCategory GetReferenceTaxonNameCategory()
        {
            WebTaxonNameCategory refTaxonNameCategory = new WebTaxonNameCategory();
            // First we create a taxon category that we later use...
            string categoryName = "Svenskt";
            Int32  sortOrder    = 20;
            string shortName    = @"Mitt söta korta namn";

            refTaxonNameCategory.Name      = categoryName;
            refTaxonNameCategory.ShortName = shortName;
            refTaxonNameCategory.SortOrder = sortOrder;
            return(refTaxonNameCategory);
        }
Пример #3
0
 /// <summary>
 /// Load data into the WebTaxonNameCategory instance.
 /// </summary>
 /// <param name="taxonNameCategory"> The taxon name category</param>
 /// <param name='dataReader'>An open data reader.</param>
 public static void LoadData(this WebTaxonNameCategory taxonNameCategory, DataReader dataReader)
 {
     taxonNameCategory.Id = dataReader.GetInt32(TaxonCommon.ID);
     taxonNameCategory.IsLocaleIdSpecified = dataReader.IsNotDbNull(LocaleData.LOCALE_ID);
     if (taxonNameCategory.IsLocaleIdSpecified)
     {
         taxonNameCategory.LocaleId = dataReader.GetInt32(LocaleData.LOCALE_ID);
     }
     taxonNameCategory.Name      = dataReader.GetString(TaxonCategoryData.CATEGORY_NAME);
     taxonNameCategory.ShortName = dataReader.GetString(TaxonCommon.SHORT_NAME);
     taxonNameCategory.SortOrder = dataReader.GetInt32(TaxonCommon.SORT_ORDER);
     taxonNameCategory.TypeId    = dataReader.GetInt32(TaxonCategoryData.TYPE);
 }
        public void LoadData()
        {
            WebTaxonNameCategory webTaxonNameCategory;

            using (DataReader dataReader = GetContext().GetTaxonDatabase().GetTaxonNameCategories(Settings.Default.TestLocaleId))
            {
                webTaxonNameCategory = new WebTaxonNameCategory();
                Assert.IsTrue(dataReader.Read());
                webTaxonNameCategory.LoadData(dataReader);

                Assert.IsTrue(webTaxonNameCategory.Name.IsNotEmpty());
            }
        }
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion

        #region Helper functions


        /// <summary>
        /// Get reference dat for a taxon name category
        /// </summary>
        /// <returns></returns>
        private WebTaxonNameCategory GetReferenceTaxonNameCategory()
        {
            WebTaxonNameCategory refTaxonNameCategory = new WebTaxonNameCategory();

            string categoryName = "Test namn categori";
            string shortName    = "hi";
            var    sortOrder    = 10;

            refTaxonNameCategory.Name      = categoryName;
            refTaxonNameCategory.ShortName = shortName;
            refTaxonNameCategory.SortOrder = sortOrder;

            return(refTaxonNameCategory);
        }
        public WebTaxonNameCategory CreateTaxonNameCategory()
        {
            taxonNameCategory = TaxonService.Data.TaxonManager.CreateTaxonNameCategory(GetContext(), GetReferenceTaxonNameCategory());

            return(taxonNameCategory);
        }
 public WebTaxonNameCategoryExtensionTest()
 {
     taxonNameCategory = null;
 }