Ejemplo n.º 1
0
        public PipelineBuilderTests()
        {
            _fakeServiceProvider = new FakeServiceProvider();
            _sut = new PipelineBuilder(_fakeServiceProvider, Mock.Of <ILogger <PipelineBuilder> >());

            _fakeMessageContext = new FakeMessageContext(_fakeServiceProvider);
        }
Ejemplo n.º 2
0
        public void UseMiddleware_throws_on_Invoke_when_service_provider_unavailable()
        {
            var sutWithNoIoC     = new PipelineBuilder(null, Mock.Of <ILogger <PipelineBuilder> >());
            var contextWithNoIoC = new FakeMessageContext(null);

            var exception = Assert.Throws <InvalidOperationException>(() =>
            {
                sutWithNoIoC
                .UseMiddleware <InvokeAsyncMethodInjection>()
                .Build()
                .Invoke(contextWithNoIoC);
            });

            Assert.Equal("'IServiceProvider' is not available.", exception.Message);
        }