public PublisherController(IGatePublisher gatePublisher, IOptions <SidecarOptions> options, ILogger <PublisherController> logger) { _gatePublisher = gatePublisher ?? throw new ArgumentNullException(nameof(gatePublisher)); _options = options.Value; _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public FallbackService(IHttpClientFactory httpClientFactory, IOptions <SidecarOptions> subscriberOptions) { httpClientFactory = httpClientFactory ?? throw new ArgumentNullException(nameof(httpClientFactory)); subscriberOptions = subscriberOptions ?? throw new ArgumentNullException(nameof(subscriberOptions)); if (string.IsNullOrEmpty(subscriberOptions.Value.FallbackUri)) { throw new ArgumentException("FallbackUri can not be null or empty", nameof(subscriberOptions)); } _sidecarOptions = subscriberOptions.Value; _httpClient = httpClientFactory.CreateClient(); }
public void Initialize() { _testableHttpMessageHandler = new TestableHttpMessageHandler(); var httpClientFactory = A.Fake <IHttpClientFactory>(); A.CallTo(() => httpClientFactory.CreateClient(Options.DefaultName)) .Returns(new HttpClient(_testableHttpMessageHandler)); _options = new SidecarOptions { FallbackUri = "http://fallback-host" }; _fallbackService = new FallbackService(httpClientFactory, Options.Create(_options)); }