Force source generation tests in .net core (#1298)

This commit is contained in:
westey
2025-10-17 14:58:50 +00:00
committed by GitHub
parent 151efd2e80
commit e7a9128138
7 changed files with 33 additions and 5 deletions
@@ -62,7 +62,8 @@ public class InMemoryAgentThreadTests
// Arrange
InMemoryChatMessageStore store = [new(ChatRole.User, "TestMsg")];
var storeState = store.Serialize();
var json = JsonSerializer.SerializeToElement(new { storeState });
var threadStateWrapper = new InMemoryAgentThread.InMemoryAgentThreadState { StoreState = storeState };
var json = JsonSerializer.SerializeToElement(threadStateWrapper, TestJsonSerializerContext.Default.InMemoryAgentThreadState);
// Act
var thread = new TestInMemoryAgentThread(json);
@@ -77,7 +78,7 @@ public class InMemoryAgentThreadTests
public void Constructor_WithInvalidJson_ThrowsArgumentException()
{
// Arrange
var invalidJson = JsonSerializer.SerializeToElement(42);
var invalidJson = JsonSerializer.SerializeToElement(42, TestJsonSerializerContext.Default.Int32);
// Act & Assert
Assert.Throws<ArgumentException>(() => new TestInMemoryAgentThread(invalidJson));