public static Task <int> Main(string[] args) { var command = new RootCommand() { Description = "Developer tool to update the Visual Studio project versions." }; command.AddCommand(ListCommand.Create()); command.AddCommand(MajorCommand.Create()); command.AddCommand(MinorCommand.Create()); command.AddCommand(PatchCommand.Create()); command.AddCommand(BuildCommand.Create()); command.AddCommand(PreCommand.Create()); command.AddCommand(SetCommand.Create()); var builder = new CommandLineBuilder(command) .UseHelp() .UseDefaults() .UseVersionOption() .CancelOnProcessTermination() .UseExceptionHandler(); var parser = builder.Build(); return(parser.InvokeAsync(args)); }
public async Task ChangePreWithBadFormatTest() { using (var fs = new DisposableFileSystem()) { fs.CreateFile("MySolution.sln"); fs.CreateFolder("src/Services"); fs.CreateFile("src/Services/project1.csproj", ProjectHelper.SetVersion("5.0.8-beta")); var store = new ProjectStore(); var command = new PreCommand(GitHelper.CreateDefaultGitMock().Object); var context = new CommandContext(_console, Verbosity.Info); context.Directory = fs.RootPath; await Assert.ThrowsAsync <FormatException>(() => command.ExecuteAsync(context)); } }
public async Task ChangePreWithComplexPreTest() { using (var fs = new DisposableFileSystem()) { fs.CreateFile("MySolution.sln"); fs.CreateFolder("src/Services"); fs.CreateFile("src/Services/project1.csproj", ProjectHelper.SetVersion("1.15.0-beta.119")); var store = new ProjectStore(); var command = new PreCommand(GitHelper.CreateDefaultGitMock().Object); var context = new CommandContext(_console, Verbosity.Info); context.Directory = fs.RootPath; await command.ExecuteAsync(context); var project = store.Read(PathHelper.GetFile(fs, "src/Services/project1.csproj")); Assert.Equal("1.15.0-beta.120", project.Version); } }