-
Notifications
You must be signed in to change notification settings - Fork 90
Expand file tree
/
Copy pathTestBase.cs
More file actions
24 lines (20 loc) · 744 Bytes
/
TestBase.cs
File metadata and controls
24 lines (20 loc) · 744 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
using System;
using System.IO;
namespace LightningDB.Tests;
public class TestBase
{
private static string _tempPath = Path.Combine(Path.GetTempPath(), $"lightningtests-{Environment.Version.ToString()}");
protected string TempPath(string seed = "")
{
var path = Path.Combine(_tempPath, $"t{seed}", Guid.NewGuid().ToString());
Directory.CreateDirectory(path);
return path;
}
protected LightningEnvironment CreateEnvironment(string? path = null, EnvironmentConfiguration? config = null) =>
config is null ? new(path ?? TempPath()) : new(path ?? TempPath(), config);
public static void CleanupSession()
{
if(Directory.Exists(_tempPath))
Directory.Delete(_tempPath, true);
}
}