Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mikechu-optimizely committed Jul 24, 2023
1 parent 0f138e8 commit 84caaa9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
17 changes: 11 additions & 6 deletions OptimizelySDK.Tests/ConfigTest/HttpProjectConfigManagerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ public class HttpProjectConfigManagerTest

private Mock<TestNotificationCallbacks> NotificationCallbackMock =
new Mock<TestNotificationCallbacks>();

private const string ExpectedRfc1123DateTime = "Thu, 03 Nov 2022 16:00:00 GMT";
private readonly DateTime _pastLastModified = new DateTimeOffset(new DateTime(2022, 11, 3, 16, 0, 0, DateTimeKind.Utc)).UtcDateTime;

private readonly DateTime _pastLastModified =
new DateTimeOffset(new DateTime(2022, 11, 3, 16, 0, 0, DateTimeKind.Utc)).UtcDateTime;

[SetUp]
public void Setup()
Expand Down Expand Up @@ -120,10 +122,12 @@ public void TestSettingIfModifiedSinceInRequestHeader()
HttpClientMock.Verify(_ => _.SendAsync(
It.Is<HttpRequestMessage>(requestMessage =>
requestMessage.Headers.IfModifiedSince.HasValue &&
requestMessage.Headers.IfModifiedSince.Value.UtcDateTime.ToString("r") == ExpectedRfc1123DateTime
requestMessage.Headers.IfModifiedSince.Value.UtcDateTime.ToString("r") ==
ExpectedRfc1123DateTime
)), Times.Once);
LoggerMock.Verify(
_ => _.Log(LogLevel.DEBUG, $"Set If-Modified-Since in request header: {ExpectedRfc1123DateTime}"),
_ => _.Log(LogLevel.DEBUG,
$"Set If-Modified-Since in request header: {ExpectedRfc1123DateTime}"),
Times.AtLeastOnce);

httpManager.Dispose();
Expand All @@ -147,9 +151,10 @@ public void TestSettingLastModifiedFromResponseHeader()
.WithBlockingTimeoutPeriod(TimeSpan.FromMilliseconds(500))
.WithStartByDefault()
.Build();

LoggerMock.Verify(
_ => _.Log(LogLevel.DEBUG, $"Set LastModifiedSince from response header: {ExpectedRfc1123DateTime}"),
_ => _.Log(LogLevel.DEBUG,
$"Set LastModifiedSince from response header: {ExpectedRfc1123DateTime}"),
Times.AtLeastOnce);

httpManager.Dispose();
Expand Down
6 changes: 4 additions & 2 deletions OptimizelySDK/Config/HttpProjectConfigManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ private string GetRemoteDatafileResponse()
if (!string.IsNullOrEmpty(LastModifiedSince))
{
request.Headers.Add("If-Modified-Since", LastModifiedSince);
Logger.Log(LogLevel.DEBUG, $"Set If-Modified-Since in request header: {LastModifiedSince}");
Logger.Log(LogLevel.DEBUG,
$"Set If-Modified-Since in request header: {LastModifiedSince}");
}

if (!string.IsNullOrEmpty(DatafileAccessToken))
Expand Down Expand Up @@ -150,7 +151,8 @@ private string GetRemoteDatafileResponse()
if (result.Content.Headers.LastModified.HasValue)
{
LastModifiedSince = result.Content.Headers.LastModified?.UtcDateTime.ToString("r");
Logger.Log(LogLevel.DEBUG, $"Set LastModifiedSince from response header: {LastModifiedSince}");
Logger.Log(LogLevel.DEBUG,
$"Set LastModifiedSince from response header: {LastModifiedSince}");
}

var content = result.Content.ReadAsStringAsync();
Expand Down

0 comments on commit 84caaa9

Please sign in to comment.