tests: add additional test coverage
This commit is contained in:
@@ -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)!;
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user