diff --git a/test/Aevatar.Core.Tests/GAgentTestKitBase.cs b/test/Aevatar.Core.Tests/GAgentTestKitBase.cs index b00a38c2..161698cb 100644 --- a/test/Aevatar.Core.Tests/GAgentTestKitBase.cs +++ b/test/Aevatar.Core.Tests/GAgentTestKitBase.cs @@ -1,13 +1,28 @@ using System.Linq.Expressions; using Aevatar.Core.Abstractions; using Aevatar.Core.Tests.TestGAgents; -using Aevatar.TestKit; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using Orleans.TestKit; using Aevatar.TestKit.Extensions; + namespace Aevatar.Core.Tests; public abstract class GAgentTestKitBase : TestKitBase { + protected GAgentTestKitBase() + { + // Configure proper logging for test environment + // This replaces the NullLoggerFactory with a proper one that won't cause NullReferenceExceptions + var loggerFactory = LoggerFactory.Create(builder => + { + builder.AddConsole().SetMinimumLevel(LogLevel.Warning); // Only show warnings and errors in tests + }); + + Silo.ServiceProvider.AddService(loggerFactory); + } + protected async Task CreatePublishingGAgentAsync(params IGAgent[] gAgentsToPublish) { var publishingGAgent = await Silo.CreateGrainAsync(Guid.NewGuid());