Example #1
0
 private Data.ArtDatabankenService.FactorTreeSearchCriteria GetSearchCriteria(Boolean refresh)
 {
     if (_searchCriteria.IsNull() || refresh)
     {
         _searchCriteria = new Data.ArtDatabankenService.FactorTreeSearchCriteria();
     }
     return(_searchCriteria);
 }
        public static Data.ArtDatabankenService.FactorTreeNode GetLandscapeFactorTreeNode()
        {
            List <Int32> factorIds;

            Data.ArtDatabankenService.FactorTreeNodeList       factorTrees;
            Data.ArtDatabankenService.FactorTreeSearchCriteria searchCriteria;

            searchCriteria = new Data.ArtDatabankenService.FactorTreeSearchCriteria();
            factorIds      = new List <Int32>();
            factorIds.Add(LANDSCAPE_FACTOR_ID);
            searchCriteria.RestrictSearchToFactorIds = factorIds;
            factorTrees = Data.ArtDatabankenService.FactorManager.GetFactorTreesBySearchCriteria(searchCriteria);
            return(factorTrees[0]);
        }
        public void GetFactorTreesBySearchCriteria()
        {
            List <Int32> factorIds;

            Data.ArtDatabankenService.FactorTreeNodeList       factorTrees;
            Data.ArtDatabankenService.FactorTreeSearchCriteria searchCriteria;

            factorIds = new List <Int32>();
            factorIds.Add(LANDSCAPES_FACTOR_ID);

            searchCriteria = new Data.ArtDatabankenService.FactorTreeSearchCriteria();
            searchCriteria.RestrictSearchToFactorIds = factorIds;

            factorTrees = Data.ArtDatabankenService.FactorManager.GetFactorTreesBySearchCriteria(searchCriteria);
            Assert.IsNotNull(factorTrees);
            Assert.IsTrue(factorTrees.IsNotEmpty());
            Assert.AreEqual(factorTrees.Count, 1);

            // Test problem with factor 691.
            // The children to factor 691 are not shown.
            factorIds = new List <Int32>();
            factorIds.Add(HISTORIC_DECREASE_FACTOR_ID);
            searchCriteria = new Data.ArtDatabankenService.FactorTreeSearchCriteria();
            searchCriteria.RestrictSearchToFactorIds = factorIds;
            factorTrees = Data.ArtDatabankenService.FactorManager.GetFactorTreesBySearchCriteria(searchCriteria);
            Assert.IsTrue(factorTrees.IsNotEmpty());
            Assert.AreEqual(factorTrees.Count, 1);
            Assert.IsTrue(factorTrees[0].Children.IsNotEmpty());
            Assert.AreEqual(factorTrees[0].Children.Count, 2);

            // Test problem with getting two factor trees
            // where one is a subpart of the other.
            factorIds = new List <Int32>();
            factorIds.Add(985);
            factorIds.Add(1321);
            searchCriteria = new Data.ArtDatabankenService.FactorTreeSearchCriteria();
            searchCriteria.RestrictSearchToFactorIds = factorIds;
            factorTrees = Data.ArtDatabankenService.FactorManager.GetFactorTreesBySearchCriteria(searchCriteria);
            Assert.IsTrue(factorTrees.IsNotEmpty());
            Assert.AreEqual(2, factorTrees.Count);
            Assert.AreEqual(985, factorTrees[0].Id);
            Assert.AreEqual(1321, factorTrees[1].Id);
        }
Example #4
0
 public FactorTreeSearchCriteriaTest()
 {
     _searchCriteria = null;
 }