- Changed Task.Wait() to task.GetAwaiter().GetResult() to avoid deadlocks - Added named constant for killEntireProcessTree parameter - Added clarifying comment for FakeInput creation - Added comment explaining relative path construction for Examples directory Co-authored-by: tig <[email protected]>
@@ -36,6 +36,7 @@ public class FakeComponentFactory : ComponentFactoryImpl<ConsoleKeyInfo>
/// <inheritdoc/>
public override IInput<ConsoleKeyInfo> CreateInput ()
{
+ // Use provided input instance or create a new one if none was provided
FakeInput fakeInput = _input ?? new FakeInput ();
// Check for test context in environment variable
@@ -71,7 +71,7 @@ public static class ExampleRunner
// If entry point returns Task, wait for it
if (result is Task task)
- task.Wait ();
+ task.GetAwaiter ().GetResult ();
}
return new ()
@@ -126,7 +126,8 @@ public static class ExampleRunner
try
- process.Kill (true);
+ const bool killEntireProcessTree = true;
+ process.Kill (killEntireProcessTree);
catch
@@ -25,6 +25,9 @@ public class ExampleTests
[RequiresDynamicCode ("Calls ExampleDiscovery.DiscoverFromDirectory")]
public static IEnumerable<object []> AllExamples ()
+ // Navigate from test assembly location to repository root, then to Examples directory
+ // Test output is typically at: Tests/UnitTestsParallelizable/bin/Debug/net8.0/
+ // Examples are at: Examples/
string examplesDir = Path.GetFullPath (Path.Combine (AppContext.BaseDirectory, "..", "..", "..", "..", "..", "Examples"));
if (!Directory.Exists (examplesDir))