This commit is contained in:
commit
4aa6c48530
52 changed files with 3781 additions and 0 deletions
48
src/Process.Tests/PathResolutionTests.cs
Normal file
48
src/Process.Tests/PathResolutionTests.cs
Normal file
|
@ -0,0 +1,48 @@
|
|||
using Geekeey.Extensions.Process.Buffered;
|
||||
|
||||
namespace Geekeey.Extensions.Process.Tests;
|
||||
|
||||
[TestFixture]
|
||||
internal sealed class PathResolutionTests
|
||||
{
|
||||
[Test]
|
||||
public async Task Execute_CommandUsingShortName()
|
||||
{
|
||||
// Arrange
|
||||
var cmd = new Command("dotnet")
|
||||
.WithArguments("--version");
|
||||
|
||||
// Act
|
||||
var result = await cmd.ExecuteBufferedAsync();
|
||||
|
||||
// Assert
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(result.IsSuccess, Is.True);
|
||||
Assert.That(result.StandardOutput.Trim(), Does.Match(@"^\d+\.\d+\.\d+$"));
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Platform("win")]
|
||||
public async Task Execute_ScriptUsingShortName()
|
||||
{
|
||||
// Arrange
|
||||
using var dir = TestTempDirectory.Create();
|
||||
await File.WriteAllTextAsync(Path.Combine(dir.Path, "script.cmd"), "@echo hi");
|
||||
|
||||
using var _1 = TestEnvironment.ExtendPath(dir.Path);
|
||||
var cmd = new Command("script");
|
||||
|
||||
// Act
|
||||
var result = await cmd.ExecuteBufferedAsync();
|
||||
|
||||
// Assert
|
||||
// Assert
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(result.IsSuccess, Is.True);
|
||||
Assert.That(result.StandardOutput.Trim(), Is.EqualTo("hi"));
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue