A little bit of clean up
This commit is contained in:
parent
f79cd3dad4
commit
8b5185847d
4 changed files with 5 additions and 5 deletions
|
@ -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 {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using FluentAssertions;
|
||||
using Robware.Lib.ApiClient;
|
||||
using Xunit;
|
||||
|
||||
namespace Robware.Lib.ApiClient.Tests {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -21,10 +21,10 @@ namespace Robware.Lib.ApiClient {
|
|||
_cacheDurations = cacheDurations;
|
||||
}
|
||||
|
||||
private IDictionary<string, string> ParseQueryParameters(object query) {
|
||||
private static IDictionary<string, string> 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<TResult> DoCachedCall<TResult>(string callerName, string url, bool skipCache, Func<Task<TResult>> call) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue