Ejemplo n.º 1
0
        public void IsReportingEnabled_ZeroSuspension_ReturnTrue()
        {
            FreezeSystemTime(SystemTime.Now());
            MetricsState.SuspendReporting(TimeSpan.FromMinutes(0));

            var result = MetricsState.IsReportingEnabled();

            Assert.That(result, Is.True);
        }
Ejemplo n.º 2
0
        public void IsReportingEnabled_SuspensionNotOverButEnabledExplicitly_ReturnTrue()
        {
            var suspension = TimeSpan.FromSeconds(10);

            FreezeSystemTime(SystemTime.Now());
            MetricsState.SuspendReporting(suspension);
            MetricsState.EnableReporting();

            var result = MetricsState.IsReportingEnabled();

            Assert.That(result, Is.True);
        }
Ejemplo n.º 3
0
        public void IsReportingEnabled_SuspensionEnded_ReturnTrue()
        {
            var now = SystemTime.Now();

            FreezeSystemTime(now);
            const int seconds    = 10;
            var       suspension = TimeSpan.FromSeconds(seconds);

            MetricsState.SuspendReporting(suspension);
            var futureNow = now.AddSeconds(seconds + 1);

            FreezeSystemTime(futureNow);

            var result = MetricsState.IsReportingEnabled();

            Assert.That(result, Is.True);
        }
Ejemplo n.º 4
0
        public void IsReportingEnabled_SuspensionIsOverButDisabledExplicitly_ReturnFalse()
        {
            var now = SystemTime.Now();

            FreezeSystemTime(now);
            const int seconds    = 10;
            var       suspension = TimeSpan.FromSeconds(seconds);

            MetricsState.SuspendReporting(suspension);
            var futureNow = now.AddSeconds(seconds + 1);

            FreezeSystemTime(futureNow);
            MetricsState.DisableReporting();

            var result = MetricsState.IsReportingEnabled();

            Assert.That(result, Is.False);
        }
Ejemplo n.º 5
0
        public void IsReportingEnabled_NoSuspension_ReturnTrue()
        {
            var result = MetricsState.IsReportingEnabled();

            Assert.That(result, Is.True);
        }