mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Added the command to download latest release with a path.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using System.CommandLine;
|
||||
using Velopack.Vpk.Commands;
|
||||
|
||||
namespace Velopack.CommandLine.Tests.Commands;
|
||||
public class PathDownloadCommandTests : BaseCommandTests<PathDownloadCommand>
|
||||
{
|
||||
[Fact]
|
||||
public void Path_WithPath_ParsesValue()
|
||||
{
|
||||
var command = new PathDownloadCommand();
|
||||
|
||||
DirectoryInfo directory = Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "releases"));
|
||||
ParseResult parseResult = command.ParseAndApply($"--path {directory.FullName}");
|
||||
|
||||
Assert.Empty(parseResult.Errors);
|
||||
Assert.Equal(directory.FullName, command.Path.FullName);
|
||||
|
||||
Directory.Delete(directory.FullName);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Path_WithNonExistingDirectory_ShowsError()
|
||||
{
|
||||
var command = new PathDownloadCommand();
|
||||
|
||||
// Parse with a fake path
|
||||
ParseResult parseResult = command.ParseAndApply($"--path \"E:\releases\"");
|
||||
|
||||
Assert.Equal(1, parseResult.Errors.Count);
|
||||
Assert.StartsWith("--path directory is not found, but must exist", parseResult.Errors[0].Message);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user