48 lines
No EOL
1 KiB
C#
48 lines
No EOL
1 KiB
C#
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"));
|
|
});
|
|
}
|
|
} |