コード例 #1
0
        public void ParseHttpResponse_ShouldLogUnknownKeys()
        {
            // Arrange
            var testLogger = new TestLogger(LogLevel.Information);
            var parser     = new CentralConfigurationResponseParser(testLogger);

            // Act
            parser.ParseHttpResponse(_correctResponse, "{\"unknownKey\": \"value\"}");

            // Assert
            testLogger.Lines.Count.Should().Be(1);
            testLogger.Lines[0]
            .Should()
            .Contain(
                "Central configuration response contains keys that are not in the list of options that can be changed after Agent start: `[unknownKey, value]'");
        }
コード例 #2
0
        public void ParseHttpResponse_ShouldUseMaxAgeHeader()
        {
            // Arrange
            var response = new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.NotModified,
                Headers    = { CacheControl = new CacheControlHeaderValue {
                                   MaxAge      = TimeSpan.FromMinutes(5)
                               } }
            };

            // Act
            var(_, waitInfoS) = _parser.ParseHttpResponse(response, string.Empty);

            // Assert
            waitInfoS.Interval.Should().Be(TimeSpan.FromMinutes(5));
        }