Validate mimeType in ImageContentBlock.FromBytes and AudioContentBlock.FromBytes (#1321)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
This commit is contained in:
parent
3727dc4aaa
commit
539481f999
1 changed files with 26 additions and 2 deletions
|
|
@ -272,4 +272,22 @@ public class ContentBlockTests
|
|||
Assert.Equal("Paris", result.Input.GetProperty("city").GetString());
|
||||
Assert.Equal("metric", result.Input.GetProperty("units").GetString());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(null)]
|
||||
[InlineData("")]
|
||||
[InlineData(" ")]
|
||||
public void ImageContentBlock_FromBytes_ThrowsForNullOrWhiteSpaceMimeType(string? mimeType)
|
||||
{
|
||||
Assert.ThrowsAny<ArgumentException>(() => ImageContentBlock.FromBytes((byte[])[1, 2, 3], mimeType!));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(null)]
|
||||
[InlineData("")]
|
||||
[InlineData(" ")]
|
||||
public void AudioContentBlock_FromBytes_ThrowsForNullOrWhiteSpaceMimeType(string? mimeType)
|
||||
{
|
||||
Assert.ThrowsAny<ArgumentException>(() => AudioContentBlock.FromBytes((byte[])[1, 2, 3], mimeType!));
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue