public void GetPeriods() { List <WebPeriod> periods; periods = PeriodManager.GetPeriods(GetContext()); Assert.IsTrue(periods.IsNotEmpty()); }
public static Data.ArtDatabankenService.PeriodList GetSomePeriods() { Data.ArtDatabankenService.PeriodList periods; periods = new Data.ArtDatabankenService.PeriodList(); periods.AddRange(PeriodManager.GetPeriods().GetRange(0, 2)); return(periods); }
public void Periods() { UserParameterSelection userParameterSelection = GetUserParameterSelection(); Assert.AreEqual(userParameterSelection.Periods.IsNotEmpty(), userParameterSelection.HasPeriods); userParameterSelection.Periods.Merge(PeriodManager.GetPeriods()); Assert.IsTrue(userParameterSelection.Periods.IsNotEmpty()); Assert.IsTrue(userParameterSelection.Periods.Count > 2); Assert.IsTrue(userParameterSelection.HasPeriods); }
public void GetPeriods() { Data.ArtDatabankenService.PeriodList allPeriods; Data.ArtDatabankenService.PeriodList redlistPeriods; allPeriods = PeriodManager.GetPeriods(); Assert.IsTrue(allPeriods.IsNotEmpty()); redlistPeriods = PeriodManager.GetPeriods(Data.ArtDatabankenService.PeriodTypeId.SwedishRedlist); Assert.IsTrue(redlistPeriods.IsNotEmpty()); Assert.IsTrue(redlistPeriods.Count < allPeriods.Count); }
/// <summary> /// Save UserDataSet to xml file. /// </summary> /// <param name='fileName'>File name.</param> /// <param name='userDataSet'>UserDataSet to save.</param> /// <param name='dictionaryURI'>Path.</param> /// <param name='renewCommonDefinitions'>Indicates if common definitions should be updated.</param> public static void Serialize(String fileName, UserDataSet userDataSet, String dictionaryURI, Boolean renewCommonDefinitions) { BinaryFormatter formatter = new BinaryFormatter(); Stream stream = File.OpenWrite(fileName); formatter.Serialize(stream, userDataSet); stream.Close(); if (renewCommonDefinitions) { String factorFileName = dictionaryURI + @"\Factors.bin"; stream = File.OpenWrite(factorFileName); FactorList allFactors = FactorManager.GetFactors(); formatter.Serialize(stream, allFactors); stream.Close(); FactorTreeSearchCriteria searchCriteria = new FactorTreeSearchCriteria(); FactorTreeNodeList factorTrees = new FactorTreeNodeList(); foreach (Factor factor in allFactors) { List <Int32> factorIds = new List <Int32>(); factorIds.Add(factor.Id); searchCriteria.RestrictSearchToFactorIds = factorIds; } String factorTreeFileName = dictionaryURI + @"\FactorTrees.bin"; stream = File.OpenWrite(factorTreeFileName); formatter.Serialize(stream, factorTrees); stream.Close(); String speciesFactQualityFileName = dictionaryURI + @"\SpeciesFactQualities.bin"; stream = File.OpenWrite(speciesFactQualityFileName); formatter.Serialize(stream, SpeciesFactManager.GetSpeciesFactQualities()); stream.Close(); String periodsFileName = dictionaryURI + @"\Periods.bin"; stream = File.OpenWrite(periodsFileName); formatter.Serialize(stream, PeriodManager.GetPeriods()); stream.Close(); } }
public static WebPeriod GetOnePeriod(WebServiceContext context) { return(PeriodManager.GetPeriods(context)[0]); }
public static List <WebPeriod> GetSomePeriods(WebServiceContext context) { return(PeriodManager.GetPeriods(context)); }
public void GetTaxaByQuery() { Data.ArtDatabankenService.Factor factor; Data.ArtDatabankenService.FactorField factorField; SpeciesFactCondition speciesFactCondition; SpeciesFactFieldCondition speciesFactFieldCondition; TaxonInformationType taxonInformationType; Data.ArtDatabankenService.TaxonList taxa; taxonInformationType = TaxonInformationType.Basic; // Test one factor. speciesFactCondition = new SpeciesFactCondition(); speciesFactCondition.Factors.Add(FactorManagerTest.GetOneFactor()); taxa = Data.ArtDatabankenService.TaxonManager.GetTaxaByQuery(speciesFactCondition, taxonInformationType); Assert.IsTrue(taxa.IsNotEmpty()); // Test several factors. speciesFactCondition = new SpeciesFactCondition(); speciesFactCondition.Factors.AddRange(FactorManagerTest.GetSomeFactors()); taxa = Data.ArtDatabankenService.TaxonManager.GetTaxaByQuery(speciesFactCondition, taxonInformationType); Assert.IsTrue(taxa.IsNotEmpty()); // Test one period. speciesFactCondition = new SpeciesFactCondition(); speciesFactCondition.Factors.Add(Data.ArtDatabankenService.FactorManager.GetFactor(Data.ArtDatabankenService.FactorId.RedlistCategory)); speciesFactCondition.Periods.Add(PeriodManager.GetPeriod(PeriodId.Year2005)); taxa = Data.ArtDatabankenService.TaxonManager.GetTaxaByQuery(speciesFactCondition, taxonInformationType); Assert.IsTrue(taxa.IsNotEmpty()); // Test several periods. speciesFactCondition = new SpeciesFactCondition(); speciesFactCondition.Factors.Add(Data.ArtDatabankenService.FactorManager.GetFactor(Data.ArtDatabankenService.FactorId.RedlistCategory)); speciesFactCondition.Periods.AddRange(PeriodManager.GetPeriods()); taxa = Data.ArtDatabankenService.TaxonManager.GetTaxaByQuery(speciesFactCondition, taxonInformationType); Assert.IsTrue(taxa.IsNotEmpty()); // Test one species fact field enum (KeyInt) condition. speciesFactCondition = new SpeciesFactCondition(); factor = Data.ArtDatabankenService.FactorManager.GetFactor(Data.ArtDatabankenService.FactorId.Redlist_OrganismLabel1); Assert.IsTrue(taxa.IsNotEmpty()); speciesFactCondition.Factors.Add(factor); speciesFactFieldCondition = new SpeciesFactFieldCondition(); factorField = factor.FactorDataType.MainField; speciesFactFieldCondition.FactorField = factorField; speciesFactFieldCondition.SetValue(factorField.FactorFieldEnum.Values[3].KeyInt); speciesFactCondition.SpeciesFactFieldConditions.Add(speciesFactFieldCondition); taxa = Data.ArtDatabankenService.TaxonManager.GetTaxaByQuery(speciesFactCondition, taxonInformationType); Assert.IsTrue(taxa.IsNotEmpty()); // Test several species fact field enum (KeyInt) conditions. speciesFactCondition = new SpeciesFactCondition(); factor = Data.ArtDatabankenService.FactorManager.GetFactor(Data.ArtDatabankenService.FactorId.Redlist_OrganismLabel1); Assert.IsTrue(taxa.IsNotEmpty()); speciesFactCondition.Factors.Add(factor); speciesFactFieldCondition = new SpeciesFactFieldCondition(); factorField = factor.FactorDataType.MainField; speciesFactFieldCondition.FactorField = factorField; speciesFactFieldCondition.SetValue(factorField.FactorFieldEnum.Values[3].KeyInt); speciesFactCondition.SpeciesFactFieldConditions.Add(speciesFactFieldCondition); speciesFactFieldCondition = new SpeciesFactFieldCondition(); factorField = factor.FactorDataType.MainField; speciesFactFieldCondition.FactorField = factorField; speciesFactFieldCondition.SetValue(factorField.FactorFieldEnum.Values[4].KeyInt); speciesFactCondition.SpeciesFactFieldConditions.Add(speciesFactFieldCondition); speciesFactFieldCondition = new SpeciesFactFieldCondition(); factorField = factor.FactorDataType.MainField; speciesFactFieldCondition.FactorField = factorField; speciesFactFieldCondition.SetValue(factorField.FactorFieldEnum.Values[5].KeyInt); speciesFactCondition.SpeciesFactFieldConditions.Add(speciesFactFieldCondition); taxa = ArtDatabanken.Data.ArtDatabankenService.TaxonManager.GetTaxaByQuery(speciesFactCondition, taxonInformationType); Assert.IsTrue(taxa.IsNotEmpty()); // Test one species fact field enum (KeyText) condition. speciesFactCondition = new SpeciesFactCondition(); factor = Data.ArtDatabankenService.FactorManager.GetFactor(Data.ArtDatabankenService.FactorId.Redlist_TaxonType); Assert.IsTrue(taxa.IsNotEmpty()); speciesFactCondition.Factors.Add(factor); speciesFactCondition.Periods.Add(PeriodManager.GetPeriod(2)); speciesFactFieldCondition = new SpeciesFactFieldCondition(); factorField = factor.FactorDataType.MainField; speciesFactFieldCondition.FactorField = factorField; speciesFactFieldCondition.SetValue(factorField.FactorFieldEnum.Values[0].KeyText); speciesFactFieldCondition.IsEnumAsString = true; speciesFactCondition.SpeciesFactFieldConditions.Add(speciesFactFieldCondition); taxa = Data.ArtDatabankenService.TaxonManager.GetTaxaByQuery(speciesFactCondition, taxonInformationType); Assert.IsTrue(taxa.IsNotEmpty()); // Test several species fact field enum (KeyText) condition. speciesFactCondition = new SpeciesFactCondition(); factor = Data.ArtDatabankenService.FactorManager.GetFactor(Data.ArtDatabankenService.FactorId.Redlist_TaxonType); Assert.IsTrue(taxa.IsNotEmpty()); speciesFactCondition.Factors.Add(factor); speciesFactCondition.Periods.Add(PeriodManager.GetPeriod(2)); speciesFactFieldCondition = new SpeciesFactFieldCondition(); factorField = factor.FactorDataType.MainField; speciesFactFieldCondition.FactorField = factorField; speciesFactFieldCondition.SetValue(factorField.FactorFieldEnum.Values[0].KeyText); speciesFactFieldCondition.IsEnumAsString = true; speciesFactCondition.SpeciesFactFieldConditions.Add(speciesFactFieldCondition); speciesFactFieldCondition = new SpeciesFactFieldCondition(); factorField = factor.FactorDataType.MainField; speciesFactFieldCondition.FactorField = factorField; speciesFactFieldCondition.SetValue(factorField.FactorFieldEnum.Values[1].KeyText); speciesFactFieldCondition.IsEnumAsString = true; speciesFactCondition.SpeciesFactFieldConditions.Add(speciesFactFieldCondition); speciesFactFieldCondition = new SpeciesFactFieldCondition(); factorField = factor.FactorDataType.MainField; speciesFactFieldCondition.FactorField = factorField; speciesFactFieldCondition.SetValue(factorField.FactorFieldEnum.Values[2].KeyText); speciesFactFieldCondition.IsEnumAsString = true; speciesFactCondition.SpeciesFactFieldConditions.Add(speciesFactFieldCondition); taxa = Data.ArtDatabankenService.TaxonManager.GetTaxaByQuery(speciesFactCondition, taxonInformationType); Assert.IsTrue(taxa.IsNotEmpty()); }
public static Data.ArtDatabankenService.Period GetOnePeriod() { return(PeriodManager.GetPeriods()[0]); }