Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion test/Aevatar.Core.Tests/GAgentTestKitBase.cs
Original file line number Diff line number Diff line change
@@ -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<AevatarTestKitSilo>
{
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<ILoggerFactory>(loggerFactory);
}

protected async Task<PublishingGAgent> CreatePublishingGAgentAsync(params IGAgent[] gAgentsToPublish)
{
var publishingGAgent = await Silo.CreateGrainAsync<PublishingGAgent>(Guid.NewGuid());
Expand Down