-
Notifications
You must be signed in to change notification settings - Fork 90
Expand file tree
/
Copy pathTestArea.cs
More file actions
35 lines (24 loc) · 797 Bytes
/
TestArea.cs
File metadata and controls
35 lines (24 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System.Diagnostics;
namespace Obj2Tiles.Common;
public class TestArea : IDisposable
{
public string Name { get; }
public string TestFolder { get; }
public TestArea(string name)
{
Name = name;
TestFolder = Path.Combine(Path.GetTempPath(), nameof(TestArea), $"{name}-{CommonUtils.RandomString(8)}");
Directory.CreateDirectory(TestFolder);
Debug.WriteLine($"Created test area '{name}' in folder '{TestFolder}'");
}
public TestArea() : this(new StackFrame(1).GetMethod()?.Name ?? "Unknown")
{
//
}
public void Dispose()
{
if (Directory.Exists(TestFolder))
Directory.Delete(TestFolder, true);
Debug.WriteLine($"Disposed test area '{Name}' in folder '{TestFolder}'");
}
}