1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2025-06-07 16:06:15 +00:00

Test implementation fixes

This commit is contained in:
JKorf 2024-05-02 22:29:32 +02:00
parent 71d54e2f9a
commit d64e200f2f
2 changed files with 5 additions and 2 deletions

View File

@ -10,6 +10,7 @@ namespace CryptoExchange.Net.Testing.Implementations
{ {
internal class TestRequest : IRequest internal class TestRequest : IRequest
{ {
private readonly Dictionary<string, IEnumerable<string>> _headers = new Dictionary<string, IEnumerable<string>>();
private readonly TestResponse _response; private readonly TestResponse _response;
public string Accept { set { } } public string Accept { set { } }
@ -31,9 +32,10 @@ namespace CryptoExchange.Net.Testing.Implementations
public void AddHeader(string key, string value) public void AddHeader(string key, string value)
{ {
_headers.Add(key, new[] { value });
} }
public Dictionary<string, IEnumerable<string>> GetHeaders() => new(); public Dictionary<string, IEnumerable<string>> GetHeaders() => _headers;
public Task<IResponse> GetResponseAsync(CancellationToken cancellationToken) => Task.FromResult<IResponse>(_response); public Task<IResponse> GetResponseAsync(CancellationToken cancellationToken) => Task.FromResult<IResponse>(_response);

View File

@ -170,8 +170,9 @@ namespace CryptoExchange.Net.Testing
var expectedMethod = reader.ReadLine(); var expectedMethod = reader.ReadLine();
var expectedPath = reader.ReadLine(); var expectedPath = reader.ReadLine();
var expectedAuth = bool.Parse(reader.ReadLine()!); var expectedAuth = bool.Parse(reader.ReadLine()!);
var response = reader.ReadToEnd();
TestHelpers.ConfigureRestClient(_client, "", System.Net.HttpStatusCode.OK); TestHelpers.ConfigureRestClient(_client, response, System.Net.HttpStatusCode.OK);
var result = await methodInvoke(_client).ConfigureAwait(false); var result = await methodInvoke(_client).ConfigureAwait(false);
// Check request/response properties // Check request/response properties