public void Creation() { NoOpRequestFactoryInterceptor interceptor1 = new NoOpRequestFactoryInterceptor(); NoOpRequestFactoryInterceptor interceptor2 = new NoOpRequestFactoryInterceptor(); requestFactory = new InterceptingClientHttpRequestFactory(requestFactoryMock, new IClientHttpRequestInterceptor[] { interceptor1, interceptor2 }); IClientHttpRequest request = requestFactory.CreateRequest(new Uri("http://example.com"), HttpMethod.GET); Assert.IsTrue(interceptor1.invoked); Assert.IsTrue(interceptor2.invoked); Assert.IsTrue(this.requestFactoryMock.created); Assert.IsFalse(this.requestMock.executed); IClientHttpResponse response = request.Execute(); Assert.IsTrue(this.requestMock.executed); Assert.AreSame(this.responseMock, response); }
public void Creation() { NoOpRequestFactoryInterceptor interceptor1 = new NoOpRequestFactoryInterceptor(); NoOpRequestFactoryInterceptor interceptor2 = new NoOpRequestFactoryInterceptor(); requestFactory = new InterceptingClientHttpRequestFactory(requestFactoryMock, new IClientHttpRequestInterceptor[] { interceptor1, interceptor2 }); IClientHttpRequest request = requestFactory.CreateRequest(new Uri("http://example.com"), HttpMethod.GET); Assert.IsTrue(interceptor1.invoked); Assert.IsTrue(interceptor2.invoked); Assert.IsTrue(this.requestFactoryMock.created); Assert.IsFalse(this.requestMock.executed); IClientHttpResponse response = request.Execute(); Assert.IsTrue(this.requestMock.executed); Assert.AreSame(this.responseMock, response); }