mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Remove obsolete tests
This commit is contained in:
@@ -5,7 +5,7 @@ using Velopack.Vpk.Commands;
|
||||
namespace Velopack.CommandLine.Tests.Commands;
|
||||
|
||||
public abstract class ReleaseCommandTests<T> : BaseCommandTests<T>
|
||||
where T : WindowsReleasifyCommand, new()
|
||||
where T : WindowsPackCommand, new()
|
||||
{
|
||||
//[Fact]
|
||||
//public void BaseUrl_WithNonHttpValue_ShowsError()
|
||||
@@ -119,165 +119,6 @@ public abstract class ReleaseCommandTests<T> : BaseCommandTests<T>
|
||||
//Assert.Equal(command.Icon, parseResult.Errors[0].SymbolResult?.Symbol.Parents.Single());
|
||||
Assert.Contains("file is not found", parseResult.Errors[0].Message);
|
||||
}
|
||||
|
||||
//[Fact]
|
||||
//public void SquirrelAwareExecutable_WithMultipleValues_ParsesValue()
|
||||
//{
|
||||
// var command = new T();
|
||||
|
||||
// string cli = GetRequiredDefaultOptions() + $"--mainExe \"MyApp1.exe\"";
|
||||
// ParseResult parseResult = command.ParseAndApply(cli);
|
||||
|
||||
// string searchPaths = command.EntryExecutableName;
|
||||
// Assert.Equal("MyApp1.exe", searchPaths);
|
||||
//}
|
||||
}
|
||||
|
||||
public class ReleasifyWindowsCommandTests : ReleaseCommandTests<WindowsReleasifyCommand>
|
||||
{
|
||||
[Fact]
|
||||
public void Command_WithValidRequiredArguments_Parses()
|
||||
{
|
||||
FileInfo package = CreateTempFile(name: Path.ChangeExtension(Path.GetRandomFileName(), ".nupkg"));
|
||||
var command = new WindowsReleasifyCommand();
|
||||
|
||||
ParseResult parseResult = command.ParseAndApply($"--package \"{package.FullName}\" -e main.exe");
|
||||
|
||||
Assert.Empty(parseResult.Errors);
|
||||
Assert.Equal(package.FullName, command.Package);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Package_WithoutNupkgExtension_ShowsError()
|
||||
{
|
||||
FileInfo package = CreateTempFile(name: Path.ChangeExtension(Path.GetRandomFileName(), ".notpkg"));
|
||||
var command = new WindowsReleasifyCommand();
|
||||
|
||||
ParseResult parseResult = command.ParseAndApply($"--package \"{package.FullName}\" -e main.exe");
|
||||
|
||||
//Assert.Equal(1, parseResult.Errors.Count);
|
||||
//Assert.Equal(command.Package, parseResult.Errors[0].SymbolResult?.Symbol);
|
||||
Assert.StartsWith("--package does not have an .nupkg extension", parseResult.Errors[0].Message);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Package_WithoutExistingFile_ShowsError()
|
||||
{
|
||||
string package = Path.ChangeExtension(Path.GetRandomFileName(), ".nupkg");
|
||||
var command = new WindowsReleasifyCommand();
|
||||
|
||||
ParseResult parseResult = command.ParseAndApply($"--package \"{package}\" -e main.exe");
|
||||
|
||||
//Assert.Equal(1, parseResult.Errors.Count);
|
||||
//Assert.Equal(command.Package, parseResult.Errors[0].SymbolResult?.Symbol.Parents.Single());
|
||||
Assert.Contains("file is not found", parseResult.Errors[0].Message);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SignTemplate_WithTemplate_ParsesValue()
|
||||
{
|
||||
var command = new WindowsReleasifyCommand();
|
||||
|
||||
string cli = GetRequiredDefaultOptions() + "--signTemplate \"signtool {{file}}\"";
|
||||
ParseResult parseResult = command.ParseAndApply(cli);
|
||||
|
||||
Assert.Equal("signtool {{file}}", command.SignTemplate);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SignTemplate_WithoutFileParameter_ShowsError()
|
||||
{
|
||||
var command = new WindowsReleasifyCommand();
|
||||
|
||||
string cli = GetRequiredDefaultOptions() + "--signTemplate \"signtool file\"";
|
||||
ParseResult parseResult = command.ParseAndApply(cli);
|
||||
|
||||
//Assert.Equal(1, parseResult.Errors.Count);
|
||||
//Assert.Equal(command.SignTemplate, parseResult.Errors[0].SymbolResult?.Symbol);
|
||||
Assert.StartsWith("--signTemplate must contain '{{file}}'", parseResult.Errors[0].Message);
|
||||
}
|
||||
|
||||
[WindowsOnlyFact]
|
||||
public void SignParameters_WithParameters_ParsesValue()
|
||||
{
|
||||
var command = new WindowsReleasifyCommand();
|
||||
|
||||
string cli = GetRequiredDefaultOptions() + "--signParams \"param1 param2\"";
|
||||
ParseResult parseResult = command.ParseAndApply(cli);
|
||||
|
||||
Assert.Equal("param1 param2", command.SignParameters);
|
||||
}
|
||||
|
||||
[WindowsOnlyFact]
|
||||
public void SignParameters_WithSignTemplate_ShowsError()
|
||||
{
|
||||
var command = new WindowsReleasifyCommand();
|
||||
|
||||
string cli = GetRequiredDefaultOptions() + "--signTemplate \"signtool {{file}}\" --signParams \"param1 param2\"";
|
||||
ParseResult parseResult = command.ParseAndApply(cli);
|
||||
|
||||
Assert.Equal(1, parseResult.Errors.Count);
|
||||
Assert.Contains("Cannot use", parseResult.Errors[0].Message);
|
||||
Assert.Contains("options together", parseResult.Errors[0].Message);
|
||||
}
|
||||
|
||||
[WindowsOnlyFact]
|
||||
public void SignSkipDll_BareOption_SetsFlag()
|
||||
{
|
||||
var command = new WindowsReleasifyCommand();
|
||||
|
||||
string cli = GetRequiredDefaultOptions() + "--signSkipDll";
|
||||
ParseResult parseResult = command.ParseAndApply(cli);
|
||||
|
||||
Assert.True(command.SignSkipDll);
|
||||
}
|
||||
|
||||
[WindowsOnlyFact]
|
||||
public void SignParallel_WithValue_SetsFlag()
|
||||
{
|
||||
var command = new WindowsReleasifyCommand();
|
||||
|
||||
string cli = GetRequiredDefaultOptions() + "--signParallel 42";
|
||||
ParseResult parseResult = command.ParseAndApply(cli);
|
||||
|
||||
Assert.Equal(42, command.SignParallel);
|
||||
}
|
||||
|
||||
//[WindowsOnlyTheory]
|
||||
//[InlineData(-1)]
|
||||
//[InlineData(0)]
|
||||
//[InlineData(1001)]
|
||||
//public void SignParallel_WithBadNumericValue_ShowsError(int value)
|
||||
//{
|
||||
// var command = new WindowsReleasifyCommand();
|
||||
|
||||
// string cli = GetRequiredDefaultOptions() + $"--signParallel {value}";
|
||||
// ParseResult parseResult = command.ParseAndApply(cli);
|
||||
|
||||
// Assert.Equal(1, parseResult.Errors.Count);
|
||||
// //Assert.Equal(command.SignParallel, parseResult.Errors[0].SymbolResult?.Symbol);
|
||||
// Assert.Equal($"The value for --signParallel must be greater than 1 and less than 1000", parseResult.Errors[0].Message);
|
||||
//}
|
||||
|
||||
//[WindowsOnlyFact]
|
||||
//public void SignParallel_WithNonNumericValue_ShowsError()
|
||||
//{
|
||||
// var command = new WindowsReleasifyCommand();
|
||||
|
||||
// string cli = GetRequiredDefaultOptions() + $"--signParallel abc";
|
||||
// ParseResult parseResult = command.ParseAndApply(cli);
|
||||
|
||||
// Assert.Equal(1, parseResult.Errors.Count);
|
||||
// //Assert.Equal(command.SignParallel, parseResult.Errors[0].SymbolResult?.Symbol);
|
||||
// Assert.Equal($"abc is not a valid integer for --signParallel", parseResult.Errors[0].Message);
|
||||
//}
|
||||
|
||||
protected override string GetRequiredDefaultOptions()
|
||||
{
|
||||
FileInfo package = CreateTempFile(name: Path.ChangeExtension(Path.GetRandomFileName(), ".nupkg"));
|
||||
|
||||
return $"-p \"{package.FullName}\" -e main.exe ";
|
||||
}
|
||||
}
|
||||
|
||||
public class PackWindowsCommandTests : ReleaseCommandTests<WindowsPackCommand>
|
||||
|
||||
Reference in New Issue
Block a user