Ejemplo n.º 1
0
        public void GetCachesByTerrainDifficultyTest( )
        {
            DataFilter filter = filterManager.GetDefaultFilter();

            filter.FromTerrainDifficulty = 4.9;

            IList <Cache> expected = new List <Cache>();

            expected.Add(new Cache {
                Id = 9
            });
            expected.Add(new Cache {
                Id = 64
            });
            expected.Add(new Cache {
                Id = 72
            });
            expected.Add(new Cache {
                Id = 80
            });
            expected.Add(new Cache {
                Id = 82
            });
            expected.Add(new Cache {
                Id = 89
            });
            expected.Add(new Cache {
                Id = 171
            });
            expected.Add(new Cache {
                Id = 299
            });
            expected.Add(new Cache {
                Id = 316
            });
            expected.Add(new Cache {
                Id = 413
            });

            IList <Cache> actual = target.GetCachesMatchingFilter(filter);

            Assert.AreEqual(expected.Count, actual.Count);

            foreach (Cache cache in expected)
            {
                Assert.IsTrue(actual.Contains(cache));
            }
        }
Ejemplo n.º 2
0
 public List <Cache> GetFilteredCacheList(DataFilter filter)
 {
     if (filter != null)
     {
         try {
             return(cacheDao.GetCachesMatchingFilter(filter));
         }
         catch {
             throw new Exception("Error: Unable to connect to database.");
         }
     }
     throw new Exception("Error: The provided data filter is invalid.");
 }