Disable STJ reflection for testing. (#266)

* Disable STJ reflection for testing.

* Remove params method and redundant overload.

---------

Co-authored-by: Stephen Toub <stoub@microsoft.com>
This commit is contained in:
Eirik Tsarpalis 2025-04-10 16:02:00 +01:00 • committed by GitHub
commit e3aa54eb3c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -19,10 +19,8 @@ public static class McpJsonUtilitiesTests
public static void DefaultOptions_UseReflectionWhenEnabled()
{
var options = McpJsonUtilities.DefaultOptions;
bool isReflectionEnabled = JsonSerializer.IsReflectionEnabledByDefault;
Type anonType = new { Id = 42 }.GetType();
Assert.True(isReflectionEnabled); // To be disabled once https://github.com/dotnet/extensions/pull/6241 is incorporated
Assert.Equal(isReflectionEnabled, options.TryGetTypeInfo(anonType, out _));
Assert.Equal(JsonSerializer.IsReflectionEnabledByDefault, options.TryGetTypeInfo(anonType, out _));
}
}