Ejemplo n.º 1
0
        public StatisticDataset GetCacheDistributionByTerrainDifficulty(DataFilter filter)
        {
            filterManager.ValidateFilter(filter);
            var data = new StatisticDataset {
                Data           = cacheDao.GetCacheDistributionByTerrainDifficulty(filter),
                Caption        = "Distribution of caches by terrain difficulty",
                Column2Caption = "Difficulty Level",
                Column3Caption = "Share [%]"
            };

            return(data);
        }
Ejemplo n.º 2
0
        public void GetCacheDistributionByTerrainDifficultyTest( )
        {
            DataFilter filter = filterManager.GetDefaultFilter();

            filter.FromPosition = new GeoPosition(47.0, 12.5);
            filter.ToPosition   = new GeoPosition(48.0, 14.0);

            var expected = new List <StatisticData> {
                new StatisticData {
                    Name = "3", Value = "17,5097"
                },
                new StatisticData {
                    Name = "2", Value = "15,1751"
                },
                new StatisticData {
                    Name = "1,5", Value = "14,7860"
                },
                new StatisticData {
                    Name = "2,5", Value = "13,2296"
                },
                new StatisticData {
                    Name = "3,5", Value = "12,4514"
                },
                new StatisticData {
                    Name = "4", Value = "10,1167"
                },
                new StatisticData {
                    Name = "1", Value = "7,3930"
                },
                new StatisticData {
                    Name = "4,5", Value = "6,2257"
                },
                new StatisticData {
                    Name = "5", Value = "3,1128"
                }
            };

            IList <StatisticData> actual = target.GetCacheDistributionByTerrainDifficulty(filter);

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

            foreach (StatisticData data in expected)
            {
                Assert.IsTrue(actual.Contains(data));
            }
        }