public void PublishNewPackageVersion(string packagePath) { //string nugetSource = "nuget.org"; //packageServer.PushPackage("key", null, -1, 60 * 1000, false); PushCommand cmd = new PushCommand(); cmd.Arguments.Add(packagePath); cmd.Source = "nuget.org"; cmd.ApiKey = "4f3ad946-b109-44a7-849e-cc19d799f719"; cmd.Timeout = 10 * 1000; cmd.Execute(); throw new NotImplementedException(); }
public static Response Push(NuGetPushRequest request) { var console = new Console(); var command = new PushCommand { Source = request.NugetHost, ApiKey = request.ApiKey, Console = console, Verbosity = Verbosity.Detailed, }; command.Arguments.Add(request.Package); try { command.Execute(); } catch (Exception e) { console.WriteError(e); } return new Response(console.Messages); }
public void PushCommandThrowsAnExceptionWhenPackageFileDoesntExist() { // Arrange var packageFilename = "non.existant.file.nupkg"; var push = new PushCommand(); push.Arguments.Add(packageFilename); push.ApiKey = "apikey"; var expectedErrorMessage = String.Format("File does not exist ({0}).", packageFilename); // Act & Assert ExceptionAssert.Throws<CommandLineException>(() => push.Execute(), expectedErrorMessage); }