public void CheckDailySummaryHsaMultiplePerids()
        {
            var cache = new LoadMetricsCache();
            cache.Add(new LoadMetrics("server-1", 20.0, 40.0));
            cache.Add(new LoadMetrics("server-1", 40.0, 80.0, DateTimeOffset.UtcNow.AddMinutes(-80)));

            var query = new LoadMetricsSummaryQuery(cache);
            var summary = query.GetDailySummary("server-1");

            Assert.Equal(2, summary.Count);
        }
        public void CheckHourlySummaryOnlyGetsLast60Minutes()
        {
            var cache = new LoadMetricsCache();
            cache.Add(new LoadMetrics("server-1", 20.0, 40.0));
            cache.Add(new LoadMetrics("server-1", 40.0, 80.0, DateTimeOffset.UtcNow.AddMinutes(-65)));

            var query = new LoadMetricsSummaryQuery(cache);
            var summary = query.GetHourlySummary("server-1");

            Assert.Equal(1, summary.Count);
            Assert.Equal(20.0, summary.First().AvgCpuLoad);
            Assert.Equal(40.0, summary.First().AvgRamLoad);
        }
        public void CheckCorrectHourlySummary()
        {
            var cache = new LoadMetricsCache();
            cache.Add(new LoadMetrics("server-1", 20.0, 40.0));
            cache.Add(new LoadMetrics("server-1", 60.0, 60.0));

            var query = new LoadMetricsSummaryQuery(cache);
            var summary = query.GetHourlySummary("server-1");

            Assert.NotNull(summary);
            Assert.Equal(1, summary.Count);
            Assert.Equal(40.0, summary.First().AvgCpuLoad);
            Assert.Equal(50.0, summary.First().AvgRamLoad);
        }
        public void SummaryIsEmpty()
        {
            var cache = new LoadMetricsCache();
            var query = new LoadMetricsSummaryQuery(cache);

            var hourlySummary = query.GetHourlySummary("server-1");
            var dailySummary = query.GetDailySummary("server-1");

            Assert.Equal(0, hourlySummary.Count);
            Assert.Equal(0, dailySummary.Count);
        }