summaryrefslogtreecommitdiff
path: root/tests/Agent.Core.Tests/TestDirectory.cs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Agent.Core.Tests/TestDirectory.cs')
-rw-r--r--tests/Agent.Core.Tests/TestDirectory.cs21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/Agent.Core.Tests/TestDirectory.cs b/tests/Agent.Core.Tests/TestDirectory.cs
new file mode 100644
index 0000000..075d050
--- /dev/null
+++ b/tests/Agent.Core.Tests/TestDirectory.cs
@@ -0,0 +1,21 @@
+namespace Agent.Core.Tests;
+
+internal sealed class TestDirectory : IDisposable
+{
+ public TestDirectory()
+ {
+ Path = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "agent-mcp-tests", Guid.NewGuid().ToString("N"));
+ Directory.CreateDirectory(Path);
+ }
+
+ public string Path { get; }
+ public string File(string relativePath, string content)
+ {
+ string path = System.IO.Path.Combine(Path, relativePath);
+ Directory.CreateDirectory(System.IO.Path.GetDirectoryName(path)!);
+ System.IO.File.WriteAllText(path, content);
+ return path;
+ }
+
+ public void Dispose() => Directory.Delete(Path, true);
+}