tests: add additional test coverage

This commit is contained in:
Stevan Freeborn
2025-07-08 21:56:13 -05:00
parent 598eaaad94
commit 2732ae2b21
7 changed files with 198 additions and 10 deletions
+5 -1
View File
@@ -23,8 +23,12 @@ class SourceConverter : JsonConverter<Source>
private static Source DeserializeBase64Source(JsonElement root, JsonSerializerOptions options)
{
var mediaType = root.GetProperty("media_type").GetString() ?? throw new JsonException("Missing 'media_type' property");
var mediaType = root.TryGetProperty("media_type", out var mediaTypeElement)
? mediaTypeElement.GetString() ?? throw new JsonException("Missing 'media_type' property")
: throw new JsonException("Missing 'media_type' property");
var isImage = ImageType.IsValidImageType(mediaType);
return isImage
? JsonSerializer.Deserialize<ImageSource>(root.GetRawText(), options)!
: JsonSerializer.Deserialize<DocumentSource>(root.GetRawText(), options)!;
-5
View File
@@ -30,11 +30,6 @@ public abstract class Citation
[JsonPropertyName("document_title")]
public string DocumentTitle { get; init; } = string.Empty;
[JsonConstructor]
internal Citation()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="Citation"/> class with a specified type.
/// </summary>