Esempio n. 1
0
        public void Invoke_HandlesExceptions()
        {
            var opts         = new InfoOptions();
            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)
            {
                TestContrib tc = (TestContrib)contrib;
                if (tc.Throws)
                {
                    Assert.False(tc.Called);
                }
                else
                {
                    Assert.True(tc.Called);
                }
            }
        }
Esempio n. 2
0
        public void Invoke_CallsAllContributors()
        {
            var opts         = new InfoOptions();
            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)
            {
                TestContrib tc = (TestContrib)contrib;
                Assert.True(tc.Called);
            }
        }