autogen/dotnet/test/Microsoft.AutoGen.Integration.Tests/InMemoryRuntimeIntegrationTests.cs
Ryan Sweet ff7f863e73
Improve e2e integration tests and isolate tests from other things; includes patch to Serializer (#5497)
* integration tests used to use the samples - now they are separate
* patch dictionary problem in serializer
* add Message Registry with dead letter queue that gets checked on new
subs.
2025-02-13 16:43:57 -08:00

32 lines
1.3 KiB
C#

// Copyright (c) Microsoft Corporation. All rights reserved.
// InMemoryRuntimeIntegrationTests.cs
using Xunit.Abstractions;
namespace Microsoft.AutoGen.Integration.Tests;
public class InMemoryRuntimeIntegrationTests(ITestOutputHelper testOutput)
{
[Fact]
public async Task HelloAgentsE2EInMemory()
{
// Locate InMemoryTests.AppHost.dll in the test output folder
var appHostAssemblyPath = Directory.GetFiles(AppContext.BaseDirectory, "InMemoryTests.AppHost.dll", SearchOption.AllDirectories)
.FirstOrDefault()
?? throw new FileNotFoundException("Could not find InMemoryTests.AppHost.dll in the test output folder");
var appHost = await DistributedApplicationTestFactory.CreateAsync(appHostAssemblyPath, testOutput);
await using var app = await appHost.BuildAsync().WaitAsync(TimeSpan.FromSeconds(15));
// Start the application and wait for resources
await app.StartAsync().WaitAsync(TimeSpan.FromSeconds(120));
await app.WaitForResourcesAsync().WaitAsync(TimeSpan.FromSeconds(120));
// Sleep 5 seconds to ensure the app is up
await Task.Delay(5000);
app.EnsureNoErrorsLogged();
app.EnsureLogContains("Hello World");
app.EnsureLogContains("HelloAgent said Goodbye");
await app.StopAsync().WaitAsync(TimeSpan.FromSeconds(15));
}
}