build: initial project release
This commit is contained in:
commit
0de3af3033
59 changed files with 4903 additions and 0 deletions
32
src/process.tests/_fixture/TestEnvironment.cs
Normal file
32
src/process.tests/_fixture/TestEnvironment.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
namespace Geekeey.Process.Tests;
|
||||
|
||||
internal sealed class TestEnvironment : IDisposable
|
||||
{
|
||||
private readonly Action _action;
|
||||
|
||||
private TestEnvironment(Action action)
|
||||
{
|
||||
_action = action;
|
||||
}
|
||||
|
||||
public static TestEnvironment Create(string name, string? value)
|
||||
{
|
||||
var lastValue = Environment.GetEnvironmentVariable(name);
|
||||
Environment.SetEnvironmentVariable(name, value);
|
||||
|
||||
return new TestEnvironment(() => Environment.SetEnvironmentVariable(name, lastValue));
|
||||
}
|
||||
|
||||
public static TestEnvironment ExtendPath(string path)
|
||||
{
|
||||
return Create("PATH", Environment.GetEnvironmentVariable("PATH") + Path.PathSeparator + path);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_action();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue