コード例 #1
0
        private IPactVerifier GetSubject()
        {
            _providerServiceValidatorFactoryCallInfo = null;
            _mockFileSystem = Substitute.For<IFileSystem>();
            _mockProviderServiceValidator = Substitute.For<IProviderServiceValidator>();
            _fakeHttpMessageHandler = new FakeHttpMessageHandler();

            return new PactVerifier(() => {}, () => {}, _mockFileSystem, (httpRequestSender, reporter, config) =>
            {
                _providerServiceValidatorFactoryCallInfo = new Tuple<bool, IHttpRequestSender>(true, httpRequestSender);

                return _mockProviderServiceValidator;
            }, new HttpClient(_fakeHttpMessageHandler), null);
        }
コード例 #2
0
        private IHttpRequestSender GetSubject(string baseAddress = "http://localhost")
        {
            _fakeHttpMessageHandler = new FakeHttpMessageHandler();
            _mockHttpRequestMessageMapper = Substitute.For<IHttpRequestMessageMapper>();
            _mockProviderServiceResponseMapper = Substitute.For<IProviderServiceResponseMapper>();

            var httpClient = new HttpClient(_fakeHttpMessageHandler);
            if (baseAddress != null)
            {
                httpClient.BaseAddress = new Uri(baseAddress);
            }

            return new HttpClientRequestSender(
                httpClient,
                _mockHttpRequestMessageMapper,
                _mockProviderServiceResponseMapper);
        }