mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2025-06-07 16:06:15 +00:00
Added multilayer nested compare support for testing
This commit is contained in:
parent
050286ecd1
commit
ba3975993f
@ -25,7 +25,11 @@ namespace CryptoExchange.Net.Testing.Comparers
|
||||
var resultProperties = resultData.GetType().GetProperties().Select(p => (p, (JsonPropertyAttribute?)p.GetCustomAttributes(typeof(JsonPropertyAttribute), true).SingleOrDefault()));
|
||||
var jsonObject = JToken.Parse(json);
|
||||
if (nestedJsonProperty != null)
|
||||
jsonObject = jsonObject[nestedJsonProperty];
|
||||
{
|
||||
var nested = nestedJsonProperty.Split('.');
|
||||
foreach (var nest in nested)
|
||||
jsonObject = jsonObject![nest];
|
||||
}
|
||||
|
||||
if (userSingleArrayItem)
|
||||
jsonObject = ((JArray)jsonObject!)[0];
|
||||
|
@ -24,7 +24,11 @@ namespace CryptoExchange.Net.Testing.Comparers
|
||||
var resultProperties = resultData.GetType().GetProperties().Select(p => (p, (JsonPropertyNameAttribute?)p.GetCustomAttributes(typeof(JsonPropertyNameAttribute), true).SingleOrDefault()));
|
||||
var jsonObject = JToken.Parse(json);
|
||||
if (nestedJsonProperty != null)
|
||||
jsonObject = jsonObject[nestedJsonProperty];
|
||||
{
|
||||
var nested = nestedJsonProperty.Split('.');
|
||||
foreach(var nest in nested)
|
||||
jsonObject = jsonObject![nest];
|
||||
}
|
||||
|
||||
if (userSingleArrayItem)
|
||||
jsonObject = ((JArray)jsonObject!)[0];
|
||||
|
Loading…
x
Reference in New Issue
Block a user