-
Notifications
You must be signed in to change notification settings - Fork 697
Expand file tree
/
Copy pathRegressionTests.cs
More file actions
38 lines (33 loc) · 1.07 KB
/
RegressionTests.cs
File metadata and controls
38 lines (33 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using Microsoft.Extensions.AI;
using System.Text.Json;
namespace ModelContextProtocol.Tests;
/// <summary>
/// Regression tests for specific issues that were reported and fixed.
/// </summary>
public class RegressionTests
{
/// <summary>
/// Regression test for GitHub issue: ToJsonObject fails when dictionary values contain anonymous types.
/// This is a sampling pipeline regression from version 0.5.0-preview.1.
/// </summary>
[Fact]
public void Issue_AnonymousTypes_InAdditionalProperties_ShouldNotThrow()
{
// Anonymous types require reflection-based serialization
if (!JsonSerializer.IsReflectionEnabledByDefault)
{
return;
}
// Exact minimal repro from the issue
AIContent c = new()
{
AdditionalProperties = new()
{
["data"] = new { X = 1.0, Y = 2.0 }
}
};
// This should not throw NotSupportedException
var exception = Record.Exception(() => c.ToContentBlock());
Assert.Null(exception);
}
}