You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

InMemoryRuntimeIntegrationTests.cs 1.4 kB

12345678910111213141516171819202122232425262728293031
  1. // Copyright (c) Microsoft Corporation. All rights reserved.
  2. // InMemoryRuntimeIntegrationTests.cs
  3. using Xunit.Abstractions;
  4. namespace Microsoft.AutoGen.Integration.Tests;
  5. public class InMemoryRuntimeIntegrationTests(ITestOutputHelper testOutput)
  6. {
  7. [Fact]
  8. public async Task HelloAgentsE2EInMemory()
  9. {
  10. // Locate InMemoryTests.AppHost.dll in the test output folder
  11. var appHostAssemblyPath = Directory.GetFiles(AppContext.BaseDirectory, "InMemoryTests.AppHost.dll", SearchOption.AllDirectories)
  12. .FirstOrDefault()
  13. ?? throw new FileNotFoundException("Could not find InMemoryTests.AppHost.dll in the test output folder");
  14. var appHost = await DistributedApplicationTestFactory.CreateAsync(appHostAssemblyPath, testOutput);
  15. await using var app = await appHost.BuildAsync().WaitAsync(TimeSpan.FromSeconds(15));
  16. // Start the application and wait for resources
  17. await app.StartAsync().WaitAsync(TimeSpan.FromSeconds(120));
  18. await app.WaitForResourcesAsync().WaitAsync(TimeSpan.FromSeconds(120));
  19. // Sleep 5 seconds to ensure the app is up
  20. await Task.Delay(5000);
  21. app.EnsureNoErrorsLogged();
  22. app.EnsureLogContains("Hello World");
  23. app.EnsureLogContains("HelloAgent said Goodbye");
  24. await app.StopAsync().WaitAsync(TimeSpan.FromSeconds(15));
  25. }
  26. }