public void Invoke_HandlesExceptions_ReturnsExpectedHealth() { var opts = new HealthEndpointOptions(); var contributors = new List <IHealthContributor>() { new TestContrib("h1"), new TestContrib("h2", true), new TestContrib("h3") }; var ep = new HealthEndpoint(opts, new DefaultHealthAggregator(), contributors); var info = ep.Invoke(null); foreach (var contrib in contributors) { TestContrib tc = (TestContrib)contrib; if (tc.Throws) { Assert.False(tc.Called); } else { Assert.True(tc.Called); } } Assert.Equal(HealthStatus.UP, info.Status); }
public void Invoke_CallsAllContributors() { var opts = new HealthEndpointOptions(); var contributors = new List <IHealthContributor>() { new TestContrib("h1"), new TestContrib("h2"), new TestContrib("h3") }; var ep = new HealthEndpoint(opts, new DefaultHealthAggregator(), contributors); var info = ep.Invoke(null); foreach (var contrib in contributors) { TestContrib tc = (TestContrib)contrib; Assert.True(tc.Called); } }