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); }
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."); }
static void Main(string[] args) { var(appSettings, configuration) = ConfigurationBootstrapper.Bootstrap <AppSettings>(args); var runner = new OctoVersionRunner(appSettings, configuration); runner.Run(out _); }
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 }
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 }
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); }