public void Invoke_HandlesExceptions() { var opts = new InfoEndpointOptions(); var contributors = new List <IInfoContributor>() { new TestContrib(), new TestContrib(true), new TestContrib() }; var ep = new InfoEndpoint(opts, contributors, GetLogger <InfoEndpoint>()); var info = ep.Invoke(); foreach (var contrib in contributors) { var tc = (TestContrib)contrib; if (tc.Throws) { Assert.False(tc.Called); } else { Assert.True(tc.Called); } } }
public void Invoke_NoContributors_ReturnsExpectedInfo() { var opts = new InfoEndpointOptions(); var contributors = new List <IInfoContributor>(); var ep = new InfoEndpoint(opts, contributors, GetLogger <InfoEndpoint>()); var info = ep.Invoke(); Assert.NotNull(info); Assert.Empty(info); }
public void Invoke_CallsAllContributors() { var opts = new InfoEndpointOptions(); var contributors = new List <IInfoContributor>() { new TestContrib(), new TestContrib(), new TestContrib() }; var ep = new InfoEndpoint(opts, contributors, GetLogger <InfoEndpoint>()); var info = ep.Invoke(); foreach (var contrib in contributors) { var tc = (TestContrib)contrib; Assert.True(tc.Called); } }