public async Task UnlistPackage(string packageId, string version = "1.0.0", string apiKey = null, bool success = true)
{
if (string.IsNullOrEmpty(packageId))
{
throw new ArgumentException($"{nameof(packageId)} cannot be null or empty!");
}
WriteLine("Unlisting package '{0}', version '{1}'", packageId, version);
var commandlineHelper = new CommandlineHelper(TestOutputHelper);
var processResult = await commandlineHelper.DeletePackageAsync(packageId, version, UrlHelper.V2FeedPushSourceUrl, apiKey);
if (success)
{
Assert.True(processResult.ExitCode == 0,
"The package unlist via Nuget.exe did not succeed properly. Check the logs to see the process error and output stream. Exit Code: " +
processResult.ExitCode + ". Error message: \"" + processResult.StandardError + "\"");
}
else
{
Assert.False(processResult.ExitCode == 0,
"The package unlist via Nuget.exe succeeded but was expected to fail. Check the logs to see the process error and output stream. Exit Code: " +
processResult.ExitCode + ". Error message: \"" + processResult.StandardError + "\"");
}
}