コード例 #1
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.");
        }
コード例 #2
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);
        }
コード例 #3
0
 public Startup(IConfiguration configuration)
 {
     Configuration   = configuration;
     _emailConfig    = Configuration.GetSection("Email").Get <EmailConfiguration>();
     _appConfig      = Configuration.GetSection("Application").Get <ApplicationConfiguration>();
     _identityConfig = Configuration.GetSection("IdentityProvider").Get <ExampleIdentityConfiguration>();
     _bootstrapper   = new ConfigurationBootstrapper(_container);
 }
コード例 #4
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 _);
        }
コード例 #5
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
        }
コード例 #6
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
        }
コード例 #7
0
 public static void Register(IMutableDependencyResolver services, IReadonlyDependencyResolver resolver,
                             DataAccessConfiguration dataAccessConfig)
 {
     EnvironmentServicesBootstrapper.RegisterEnvironmentServices(services, resolver);
     ConfigurationBootstrapper.RegisterConfiguration(services, resolver, dataAccessConfig);
     LoggingBootstrapper.RegisterLogging(services, resolver);
     AvaloniaServicesBootstrapper.RegisterAvaloniaServices(services);
     FileSystemWatcherServicesBootstrapper.RegisterFileSystemWatcherServices(services, resolver);
     DataAccessBootstrapper.RegisterDataAccess(services, resolver);
     ServicesBootstrapper.RegisterServices(services, resolver);
     ViewModelsBootstrapper.RegisterViewModels(services, resolver);
 }
コード例 #8
0
        /// <summary>
        /// Bootstrapping entry
        /// </summary>
        /// <param name="backgroundBootstrapConfiguration"></param>
        /// <param name="scanAssemblies"></param>
        /// <returns></returns>
        public static IServiceContainer BootstrapHelper(this IBackgroundApplicationBootstrapConfiguration backgroundBootstrapConfiguration, params Assembly[] scanAssemblies)
        {
            if (scanAssemblies == null)
            {
                StackTrace stackTrace = new StackTrace();
                // TODO: workaround for tests
                var assembly = stackTrace.GetFrame(1).GetMethod().DeclaringType.Assembly;

                scanAssemblies = new Assembly[] { assembly };
            }

            ConfigurationBootstrapper configurationBootstrapper = new ConfigurationBootstrapper();

            configurationBootstrapper.RecurringTaskLogProvider = () => backgroundBootstrapConfiguration.RecurringTaskLogProvider;

            var result = backgroundBootstrapConfiguration.Resolve(configurationBootstrapper, scanAssemblies);

            // Proc config validation
            BackgroundApplicationConfiguration config = null;

            try
            {
                config = BackgroundApplicationConfiguration.Instance;
            }
            catch { }
            finally
            {
                if (config.IsNull())
                {
                    throw new Exception("Signals.Core.Background.Configuration.BackgroundApplicationConfiguration is not provided. Please use a configuration provider to provide configuration values!");
                }
            }

            RegisterBackground();
            ScheduleRecurring();
            NotifyOnStartup();

            return(result);
        }
コード例 #9
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);
        }
コード例 #10
0
 public Startup(IConfiguration configuration)
 {
     Configuration = configuration;
     _appConfig    = Configuration.GetSection("Application").Get <CctApplicationConfiguration>();
     _bootstrapper = new ConfigurationBootstrapper(_container);
 }
コード例 #11
0
 public Startup(IConfiguration configuration)
 {
     Configuration    = configuration;
     _bootstrapper    = new ConfigurationBootstrapper(_container);
     AppConfiguration = Configuration.GetSection("App").Get <AppConfiguration>();
 }
コード例 #12
0
ファイル: Startup.cs プロジェクト: tmassey/playing
 public Startup(IWebHostEnvironment env)
 {
     ConfigurationBootstrapper.LoadConfiguration(env, null);
 }