コード例 #1
0
        public void WhenPassingOutputFormats(string[] args, string[] expectedOutputFormats)
        {
            var fullArgs = new [] { "--CurrentBranch", "main" }.Concat(args).ToArray();

            var(appSettings, _) = ConfigurationBootstrapper.Bootstrap <AppSettings>(fullArgs);
            appSettings.OutputFormats.ShouldBeEquivalentTo(expectedOutputFormats);
        }
コード例 #2
0
        public void ThrowsExceptionWhenNoArgsArePassed()
        {
            var args = new string[0];
            var ex   = Assert.Throws <ValidationException>(() => ConfigurationBootstrapper.Bootstrap <AppSettings>(args));

            ex.Message.ShouldBe("At least one of CurrentBranch or FullSemVer must be provided.");
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: johnperez416/OctoVersion
        static void Main(string[] args)
        {
            var(appSettings, configuration) = ConfigurationBootstrapper.Bootstrap <AppSettings>(args);

            var runner = new OctoVersionRunner(appSettings, configuration);

            runner.Run(out _);
        }
コード例 #4
0
        public void WhenPassingFullSemVer()
        {
            var args = new[] { "--FullSemVer", "1.0.0" };

            var(appSettings, _) = ConfigurationBootstrapper.Bootstrap <AppSettings>(args);
            appSettings.FullSemVer.ShouldBe("1.0.0");
            appSettings.NonPreReleaseTags.ShouldBeEquivalentTo(new [] { "main", "master" }); //defaults should be applied
            appSettings.OutputFormats.ShouldBeEquivalentTo(new [] { "Console" });            //defaults should be applied
        }
コード例 #5
0
        public void WhenPassingCurrentBranch()
        {
            var args = new[] { "--CurrentBranch", "main" };

            var(appSettings, _) = ConfigurationBootstrapper.Bootstrap <AppSettings>(args);
            appSettings.CurrentBranch.ShouldBe("main");
            appSettings.NonPreReleaseTags.ShouldBeEquivalentTo(new [] { "main", "master" }); //defaults should be applied
            appSettings.OutputFormats.ShouldBeEquivalentTo(new [] { "Console" });            //defaults should be applied
        }
コード例 #6
0
        public static int Main(string[] args)
        {
            try
            {
                Console.WriteLine("Bootstrapping...");
                ConfigurationBootstrapper.Bootstrap(args, out var configuration, out var appSettingsRoot);
                LogBootstrapper.Bootstrap(appSettingsRoot.Application, appSettingsRoot.Logging);
                WebHostBootstrapper.Bootstrap <Startup>(configuration, out var webHost);

                Log.Debug("Starting web host");
                webHost.Run();
            }
            catch (Exception ex)
            {
                Log.Fatal(ex, "A fatal exception occurred.");
                return(1);
            }
            finally
            {
                Log.CloseAndFlush();
            }

            return(0);
        }