using w4c_workflows.Services.Execution; namespace w4c_workflows.Tests; /// A self-cleaning temp directory for executor tests. internal sealed class TempDir : IDisposable { public string Path { get; } public TempDir() { Path = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "wf-test-" + Guid.NewGuid().ToString("N")); Directory.CreateDirectory(Path); } public string Write(string relativePath, string content) { var full = System.IO.Path.Combine(Path, relativePath); var dir = System.IO.Path.GetDirectoryName(full); if (!string.IsNullOrEmpty(dir)) Directory.CreateDirectory(dir); File.WriteAllText(full, content); return full; } public void Dispose() { try { Directory.Delete(Path, recursive: true); } catch { /* best effort */ } } } internal static class Invocation { /// Builds a minimal task invocation for a single-file language. public static TaskInvocation For( string language, string entryFile, string? input = null, string? workingDir = null, string? entryFunction = null) => new( TaskInvocation.TypeValue, "run-1", "task-1", "task-key", language, entryFile, entryFunction, new Dictionary(), input, workingDir, "tenant-1", 1); }