Beispiel #1
0
        public void WhenNoResponseRecordedEmptyIsReturned()
        {
            var proxy    = new ServerResponseProxy();
            var response = proxy.GetResponseText(Some.ApiKey());

            Assert.Equal("{}", response);
        }
Beispiel #2
0
        public void WhenApiKeysDontMatchEmptyResponseReturned()
        {
            var proxy = new ServerResponseProxy();

            proxy.SuccessResponseReturned(Some.ApiKey(), "this is never used");
            var response = proxy.GetResponseText(Some.ApiKey());

            Assert.Equal("{}", response);
        }
Beispiel #3
0
        public void NullApiKeysAreConsideredMatching()
        {
            var proxy        = new ServerResponseProxy();
            var responseText = "some response";

            proxy.SuccessResponseReturned(null, responseText);
            var response = proxy.GetResponseText(null);

            Assert.Equal(responseText, response);
        }
 public HttpLogShipper(LogBuffer logBuffer, string apiKey, SeqForwarderOutputConfig outputConfig, ServerResponseProxy serverResponseProxy, HttpClient outputHttpClient)
 {
     _apiKey              = apiKey;
     _httpClient          = outputHttpClient ?? throw new ArgumentNullException(nameof(outputHttpClient));
     _logBuffer           = logBuffer ?? throw new ArgumentNullException(nameof(logBuffer));
     _outputConfig        = outputConfig ?? throw new ArgumentNullException(nameof(outputConfig));
     _serverResponseProxy = serverResponseProxy ?? throw new ArgumentNullException(nameof(serverResponseProxy));
     _connectionSchedule  = new ExponentialBackoffConnectionSchedule(QuietWaitPeriod);
     _timer = new Timer(s => OnTick());
 }
Beispiel #5
0
        public void WhenApiKeysMatchTheResponseIsReturned()
        {
            var proxy        = new ServerResponseProxy();
            var apiKey       = Some.ApiKey();
            var responseText = "some response";

            proxy.SuccessResponseReturned(apiKey, responseText);
            var response = proxy.GetResponseText(apiKey);

            Assert.Equal(responseText, response);
        }