public static async Task Main(string[] args) { try { var context = ConsoleArgsContext.Parse(args); if (context.HasError) { Console.Error.WriteLine(context.Errors.FirstOrDefault().Message); Environment.Exit(-1); } else if (context.IsHelp) { Console.WriteLine("NuGet Updater is a tool allowing the automatic update of the NuGet packages found in a solution"); Console.WriteLine(); context.WriteOptionDescriptions(Console.Out); } else { context.Parameters.SolutionRoot ??= Environment.CurrentDirectory; var updater = new NuGetUpdater(context.Parameters, context.IsSilent ? null : Console.Out, GetSummaryWriter(context.SummaryFile)); var result = await updater.UpdatePackages(CancellationToken.None); Save(result, context.ResultFile); } } catch (Exception ex) { Console.WriteLine($"Error: {ex.Message}"); } }
public async Task GivenUnspecifiedTarget_NoUpdateIsMade() { var parameters = new UpdaterParameters { SolutionRoot = "MySolution.sln", UpdateTarget = FileType.Unspecified, TargetVersions = { "stable" }, Feeds = { TestFeed }, }; var logger = new UpdaterLogger(Console.Out); var updater = new NuGetUpdater(parameters, logger); await updater.UpdatePackages(CancellationToken.None); Assert.IsTrue(logger.GetUpdates().None()); }