Add testing for validation
This commit is contained in:
@@ -148,7 +148,12 @@ public class ValidationConfiguration
|
||||
{
|
||||
try
|
||||
{
|
||||
return JsonSerializer.Deserialize<ValidationConfiguration>(json) ?? Default;
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
PropertyNameCaseInsensitive = true,
|
||||
Converters = { new System.Text.Json.Serialization.JsonStringEnumConverter() }
|
||||
};
|
||||
return JsonSerializer.Deserialize<ValidationConfiguration>(json, options) ?? Default;
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -183,10 +188,12 @@ public class ValidationConfiguration
|
||||
/// <param name="path">Path where the JSON file should be saved</param>
|
||||
public async Task SaveToFileAsync(string path)
|
||||
{
|
||||
var json = JsonSerializer.Serialize(this, new JsonSerializerOptions
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true
|
||||
});
|
||||
WriteIndented = true,
|
||||
Converters = { new System.Text.Json.Serialization.JsonStringEnumConverter() }
|
||||
};
|
||||
var json = JsonSerializer.Serialize(this, options);
|
||||
await File.WriteAllTextAsync(path, json);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user