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

Small test fixes

This commit is contained in:
JKorf 2024-08-05 16:13:08 +02:00
parent 87b0c8d7a2
commit e3fece41f3
2 changed files with 12 additions and 1 deletions

View File

@ -151,7 +151,12 @@ namespace CryptoExchange.Net.Testing.Comparers
private static void CheckObject(string method, JProperty prop, object obj, List<string>? ignoreProperties)
{
var resultProperties = obj.GetType().GetProperties().Select(p => (p, ((JsonPropertyNameAttribute?)p.GetCustomAttributes(typeof(JsonPropertyNameAttribute), true).SingleOrDefault())?.Name));
var resultProperties = obj.GetType().GetProperties(
System.Reflection.BindingFlags.Public
| System.Reflection.BindingFlags.NonPublic
| System.Reflection.BindingFlags.GetProperty
| System.Reflection.BindingFlags.SetProperty
| System.Reflection.BindingFlags.Instance).Select(p => (p, ((JsonPropertyNameAttribute?)p.GetCustomAttributes(typeof(JsonPropertyNameAttribute), true).SingleOrDefault())?.Name));
// Property has a value
var property = resultProperties.SingleOrDefault(p => p.Name == prop.Name).p;

View File

@ -9,12 +9,18 @@ namespace CryptoExchange.Net.Testing
{
if (message.Contains("Cannot map"))
throw new Exception("Enum value error: " + message);
if (message.Contains("Received null enum value"))
throw new Exception("Enum null error: " + message);
}
public override void WriteLine(string message)
{
if (message.Contains("Cannot map"))
throw new Exception("Enum value error: " + message);
if (message.Contains("Received null enum value"))
throw new Exception("Enum null error: " + message);
}
}
}