diff --git a/src/Robware.Lib.ApiClient.Tests/ApiClientTests.cs b/src/Robware.Lib.ApiClient.Tests/ApiClientTests.cs index b438b20..ba803ab 100644 --- a/src/Robware.Lib.ApiClient.Tests/ApiClientTests.cs +++ b/src/Robware.Lib.ApiClient.Tests/ApiClientTests.cs @@ -4,7 +4,6 @@ using System.Threading.Tasks; using FluentAssertions; using Microsoft.Extensions.Caching.Memory; using NSubstitute; -using Robware.Lib.ApiClient; using Xunit; namespace Robware.Lib.ApiClient.Tests { diff --git a/src/Robware.Lib.ApiClient.Tests/CacheDurationsTests.cs b/src/Robware.Lib.ApiClient.Tests/CacheDurationsTests.cs index 0d8941f..d12a3c5 100644 --- a/src/Robware.Lib.ApiClient.Tests/CacheDurationsTests.cs +++ b/src/Robware.Lib.ApiClient.Tests/CacheDurationsTests.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using FluentAssertions; -using Robware.Lib.ApiClient; using Xunit; namespace Robware.Lib.ApiClient.Tests { diff --git a/src/Robware.Lib.ApiClient/ApiCallException.cs b/src/Robware.Lib.ApiClient/ApiCallException.cs index dc64d3a..edbbf3f 100644 --- a/src/Robware.Lib.ApiClient/ApiCallException.cs +++ b/src/Robware.Lib.ApiClient/ApiCallException.cs @@ -3,7 +3,9 @@ using System.Net.Http; namespace Robware.Lib.ApiClient { public class ApiCallException : Exception { - private readonly HttpResponseMessage Response; + // ReSharper disable once NotAccessedField.Local + // ReSharper disable once MemberCanBePrivate.Global + public readonly HttpResponseMessage Response; public ApiCallException(HttpResponseMessage response):base($"Error calling API {response.RequestMessage.RequestUri}: {(int)response.StatusCode}, {response.ReasonPhrase}") { Response = response; diff --git a/src/Robware.Lib.ApiClient/ApiClient.cs b/src/Robware.Lib.ApiClient/ApiClient.cs index c18dc6d..56613ab 100644 --- a/src/Robware.Lib.ApiClient/ApiClient.cs +++ b/src/Robware.Lib.ApiClient/ApiClient.cs @@ -21,10 +21,10 @@ namespace Robware.Lib.ApiClient { _cacheDurations = cacheDurations; } - private IDictionary ParseQueryParameters(object query) { + private static IDictionary ParseQueryParameters(object query) { var type = query.GetType(); var props = type.GetProperties(); - return props.ToDictionary(info => info.Name, info => info.GetValue(query, null).ToString()); + return props.ToDictionary(info => info.Name, info => info.GetValue(query, null)?.ToString()); } private async Task DoCachedCall(string callerName, string url, bool skipCache, Func> call) {