コード例 #1
0
 public void ChildState_TurnToGood_IsHealthy(ReportingStrategy reportingStrategy)
 {
     _healthStatus = new PassiveAggregatingHealthCheck(_dateTimeFake, COMPONENT_NAME, healthMonitor, reportingStrategy);
     _healthStatus.SetBad("", TimeSpan.FromSeconds(1), "child");
     _getHealthResult().IsHealthy.ShouldBe(false);
     _healthStatus.SetGood("", TimeSpan.FromSeconds(1), "child");
     _getHealthResult().IsHealthy.ShouldBe(true);
 }
コード例 #2
0
        public void UnhealthyOnAtLeastOneChild_UnsetBadChild_IsHealthy(ReportingStrategy reportingStrategy)
        {
            _healthStatus = new PassiveAggregatingHealthCheck(_dateTimeFake, COMPONENT_NAME, healthMonitor, reportingStrategy);
            _healthStatus.SetBad("", TimeSpan.FromSeconds(1), "parent", "child");
            _getHealthResult().IsHealthy.ShouldBe(false);

            _healthStatus.Unset("parent", "child");
            _getHealthResult().IsHealthy.ShouldBe(true);
        }
コード例 #3
0
        public void BadState_Expires(ReportingStrategy reportingStrategy)
        {
            _healthStatus = new PassiveAggregatingHealthCheck(_dateTimeFake, COMPONENT_NAME, healthMonitor, reportingStrategy);
            _healthStatus.SetBad("", TimeSpan.FromSeconds(1), "level1");
            var result = _getHealthResult();

            result.IsHealthy.ShouldBe(false);

            _dateTimeFake.UtcNow += TimeSpan.FromSeconds(1);
            result = _getHealthResult();
            result.IsHealthy.ShouldBe(true);
        }