Ejemplo n.º 1
0
        // ------------------------- Distributions ------------------------------------

        public StatisticDataset GetCacheDistributionBySize(DataFilter filter)
        {
            filterManager.ValidateFilter(filter);
            var data = new StatisticDataset {
                Data           = cacheDao.GetCacheDistributionBySize(filter),
                Caption        = "Distribution of caches by size",
                Column2Caption = "Category of size",
                Column3Caption = "Share [%]"
            };

            return(data);
        }
Ejemplo n.º 2
0
        public void GetCacheDistributionBySizeTest()
        {
            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 = "Regular", Value = "47,8599"
                },
                new StatisticData {
                    Name = "Small", Value = "30,3502"
                },
                new StatisticData {
                    Name = "Micro", Value = "10,8949"
                },
                new StatisticData {
                    Name = "None", Value = "7,3930"
                },
                new StatisticData {
                    Name = "Large", Value = "2,3346"
                },
                new StatisticData {
                    Name = "Other", Value = "1,1673"
                },
            };

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

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

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