Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        public async Task ChangeMinorVersionTest()
        {
            using (var fs = new DisposableFileSystem())
            {
                fs.CreateFile("MySolution.sln");
                fs.CreateFolder("src/Services");
                fs.CreateFile("src/Services/project1.csproj", ProjectHelper.SetVersion("1.5.1"));
                var store   = new ProjectStore();
                var gitMock = new Mock <IGitService>();
                var command = new MinorCommand(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.6.0", project.Version);
            }
        }