/// <summary> /// Load data into the WebFactorFieldType instance. /// </summary> /// <param name="factorFieldType">The factor field type instance.</param> /// <param name='dataReader'>An open data reader.</param> public static void LoadData(this WebFactorFieldType factorFieldType, DataReader dataReader) { factorFieldType.Definition = dataReader.GetString(FactorFieldTypeData.DEFINITION_SWEDISH); factorFieldType.Id = dataReader.GetInt32(FactorFieldTypeData.ID); factorFieldType.Name = dataReader.GetString(FactorFieldTypeData.NAME); }
// // 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 public WebFactorFieldType GetFactorFieldType() { if (_factorFieldType.IsNull()) { _factorFieldType = FactorManagerTest.GetOneFactorFieldType(GetContext()); } return(_factorFieldType); }
/// <summary> /// Convert a WebFactorFieldType instance into /// an IFactorFieldType instance. /// </summary> /// <param name="userContext"> /// Information about the user that makes this method call. /// </param> /// <param name="webFactorFieldType">A WebFactorFieldType instance.</param> /// <returns>An IFactorFieldType instance.</returns> private IFactorFieldType GetFactorFieldType(IUserContext userContext, WebFactorFieldType webFactorFieldType) { IFactorFieldType factorFieldType; factorFieldType = new FactorFieldType(); factorFieldType.DataContext = GetDataContext(userContext); factorFieldType.Definition = webFactorFieldType.Definition; factorFieldType.Id = webFactorFieldType.Id; factorFieldType.Name = webFactorFieldType.Name; return(factorFieldType); }
public static WebFactorFieldType[] GetSomeFactorFieldTypes(WebServiceContext context, Int32 factorFieldTypeCount) { Int32 typeIndex; List <WebFactorFieldType> allFactorFieldTypes; WebFactorFieldType[] factorFieldTypes; allFactorFieldTypes = FactorManager.GetFactorFieldTypes(context); if (factorFieldTypeCount > allFactorFieldTypes.Count) { factorFieldTypeCount = allFactorFieldTypes.Count; } factorFieldTypes = new WebFactorFieldType[factorFieldTypeCount]; for (typeIndex = 0; typeIndex < factorFieldTypeCount; typeIndex++) { factorFieldTypes[typeIndex] = allFactorFieldTypes[typeIndex]; } return(factorFieldTypes); }
/// <summary> /// Get all factor field types. /// </summary> /// <param name="context">Web service request context.</param> /// <returns>Factor field types.</returns> public static List <WebFactorFieldType> GetFactorFieldTypes(WebServiceContext context) { List <WebFactorFieldType> factorFieldTypes; String cacheKey; WebFactorFieldType factorFieldType; // Get cached information. factorFieldTypes = null; cacheKey = Settings.Default.FactorFieldTypeCacheKey; if (!context.IsInTransaction()) { factorFieldTypes = (List <WebFactorFieldType>)context.GetCachedObject(cacheKey); } if (factorFieldTypes.IsNull()) { // Get information from database. factorFieldTypes = new List <WebFactorFieldType>(); using (DataReader dataReader = context.GetTaxonAttributeDatabase().GetFactorFieldTypes()) { while (dataReader.Read()) { factorFieldType = new WebFactorFieldType(); factorFieldType.LoadData(dataReader); factorFieldTypes.Add(factorFieldType); } if (!context.IsInTransaction()) { // Add information to cache. context.AddCachedObject(cacheKey, factorFieldTypes, DateTime.Now + new TimeSpan(12, 0, 0), CacheItemPriority.AboveNormal); } } } return(factorFieldTypes); }
public WebFactorFieldTypeTest() { _factorFieldType = null; }