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

Small improvements

This commit is contained in:
JKorf 2024-06-23 14:41:59 +02:00
parent 6fed657ea6
commit 09ed7d1436
2 changed files with 10 additions and 5 deletions

View File

@ -92,8 +92,11 @@ namespace CryptoExchange.Net.Converters.SystemTextJson
if (reader.TokenType == JsonTokenType.EndArray) if (reader.TokenType == JsonTokenType.EndArray)
break; break;
var attribute = attributes.SingleOrDefault(a => a.ArrayProperty.Index == index); var attribute = attributes.SingleOrDefault(a => a.ArrayProperty.Index == index);
var targetType = attribute.PropertyInfo.PropertyType; if (attribute == null)
continue;
var targetType = attribute.PropertyInfo.PropertyType;
object? value = null; object? value = null;
if (attribute.JsonConverterType != null) if (attribute.JsonConverterType != null)

View File

@ -50,6 +50,7 @@ namespace CryptoExchange.Net.Testing
/// <param name="name">Method name for looking up json test values</param> /// <param name="name">Method name for looking up json test values</param>
/// <param name="nestedJsonProperty">Use nested json property for compare</param> /// <param name="nestedJsonProperty">Use nested json property for compare</param>
/// <param name="ignoreProperties">Ignore certain properties</param> /// <param name="ignoreProperties">Ignore certain properties</param>
/// <param name="useFirstUpdateItem">Use the first item of an array update</param>
/// <param name="addressPath">Path</param> /// <param name="addressPath">Path</param>
/// <returns></returns> /// <returns></returns>
/// <exception cref="Exception"></exception> /// <exception cref="Exception"></exception>
@ -58,7 +59,8 @@ namespace CryptoExchange.Net.Testing
string name, string name,
string? nestedJsonProperty = null, string? nestedJsonProperty = null,
List<string>? ignoreProperties = null, List<string>? ignoreProperties = null,
string? addressPath = null) string? addressPath = null,
bool? useFirstUpdateItem = null)
{ {
var listener = new EnumValueTraceListener(); var listener = new EnumValueTraceListener();
Trace.Listeners.Add(listener); Trace.Listeners.Add(listener);
@ -159,9 +161,9 @@ namespace CryptoExchange.Net.Testing
throw new Exception($"{name} Update send to client did not trigger in update handler"); throw new Exception($"{name} Update send to client did not trigger in update handler");
if (_stjCompare == true) if (_stjCompare == true)
SystemTextJsonComparer.CompareData(name, update, compareData, nestedJsonProperty ?? _nestedPropertyForCompare, ignoreProperties); SystemTextJsonComparer.CompareData(name, update, compareData, nestedJsonProperty ?? _nestedPropertyForCompare, ignoreProperties, useFirstUpdateItem ?? false);
else else
JsonNetComparer.CompareData(name, update, compareData, nestedJsonProperty ?? _nestedPropertyForCompare, ignoreProperties); JsonNetComparer.CompareData(name, update, compareData, nestedJsonProperty ?? _nestedPropertyForCompare, ignoreProperties, useFirstUpdateItem ?? false);
} }
} }