1
0
mirror of https://github.com/JKorf/CryptoExchange.Net.git synced 2026-08-20 21:02:55 +00:00

Unit testing update (#199)

This commit is contained in:
Jan Korf
2024-05-01 19:24:53 +02:00
committed by GitHub
parent 96c9a55c48
commit 050286ecd1
25 changed files with 1740 additions and 221 deletions
@@ -224,7 +224,7 @@ namespace CryptoExchange.Net.Converters.JsonNet
public override bool OriginalDataAvailable => _stream?.CanSeek == true;
/// <inheritdoc />
public async Task<bool> Read(Stream stream, bool bufferStream)
public async Task<CallResult> Read(Stream stream, bool bufferStream)
{
if (bufferStream && stream is not MemoryStream)
{
@@ -252,14 +252,15 @@ namespace CryptoExchange.Net.Converters.JsonNet
{
_token = await JToken.LoadAsync(jsonTextReader).ConfigureAwait(false);
IsJson = true;
return new CallResult(null);
}
catch (Exception)
catch (Exception ex)
{
// Not a json message
IsJson = false;
return new CallResult(new ServerError("JsonError: " + ex.Message));
}
return IsJson;
}
/// <inheritdoc />
public override string GetOriginalString()
@@ -290,7 +291,7 @@ namespace CryptoExchange.Net.Converters.JsonNet
private ReadOnlyMemory<byte> _bytes;
/// <inheritdoc />
public bool Read(ReadOnlyMemory<byte> data)
public CallResult Read(ReadOnlyMemory<byte> data)
{
_bytes = data;
@@ -305,14 +306,14 @@ namespace CryptoExchange.Net.Converters.JsonNet
{
_token = JToken.Load(jsonTextReader);
IsJson = true;
return new CallResult(null);
}
catch (Exception)
catch (Exception ex)
{
// Not a json message
IsJson = false;
return new CallResult(new ServerError("JsonError: " + ex.Message));
}
return IsJson;
}
/// <inheritdoc />