コード例 #1
0
        public void Aggregate_NullContributorList_ReturnsExpectedHealth()
        {
            var agg    = new DefaultHealthAggregator();
            var result = agg.Aggregate(null);

            Assert.NotNull(result);
            Assert.Equal(HealthStatus.UNKNOWN, result.Status);
            Assert.NotNull(result.Details);
        }
コード例 #2
0
        public void Aggregate_SingleContributor_ReturnsExpectedHealth()
        {
            List <IHealthContributor> contribs = new List <IHealthContributor>()
            {
                new UpContributor()
            };
            var agg    = new DefaultHealthAggregator();
            var result = agg.Aggregate(contribs);

            Assert.NotNull(result);
            Assert.Equal(HealthStatus.UP, result.Status);
            Assert.NotNull(result.Details);
        }
コード例 #3
0
        public void Aggregate_DuplicateContributor_ReturnsExpectedHealth()
        {
            var contribs = new List <IHealthContributor>()
            {
                new UpContributor(),
                new UpContributor()
            };
            var agg    = new DefaultHealthAggregator();
            var result = agg.Aggregate(contribs);

            Assert.NotNull(result);
            Assert.Equal(HealthStatus.UP, result.Status);
            Assert.Contains("Up-1", result.Details.Keys);
        }
コード例 #4
0
        public void Aggregate_MultipleContributor_OrderDoesntMatter_ReturnsExpectedHealth()
        {
            List <IHealthContributor> contribs = new List <IHealthContributor>()
            {
                new UpContributor(),
                new OutOfSserviceContributor(),
                new UnknownContributor()
            };
            var agg    = new DefaultHealthAggregator();
            var result = agg.Aggregate(contribs);

            Assert.NotNull(result);
            Assert.Equal(HealthStatus.OUT_OF_SERVICE, result.Status);
            Assert.NotNull(result.Details);
        }
コード例 #5
0
        public void AggregatesInParallel()
        {
            var t        = new Stopwatch();
            var contribs = new List <IHealthContributor>()
            {
                new UpContributor(500),
                new UpContributor(500),
                new UpContributor(500)
            };
            var agg = new DefaultHealthAggregator();

            t.Start();
            var result = agg.Aggregate(contribs);

            t.Stop();
            Assert.NotNull(result);
            Assert.Equal(HealthStatus.UP, result.Status);
            Assert.InRange(t.ElapsedMilliseconds, 450, 1200);
        }