public static void GetAssemblyFileNamesToScanForExtensions_should_return_empty_list()
        {
            // Arrange
            var bootstrapper = new DefaultBootstrapper();

            // Act
            var assemblyFileNames = bootstrapper.GetAssemblyFileNamesToScanForExtensions();

            // Assert
            assemblyFileNames.Should().BeEmpty();
        }
Exemple #2
0
        public static void Main()
        {
            Console.WriteLine("================== Running simple ==================");
            Console.WriteLine();

            //// Actually it is not necessary to have the strategy and disposable extensions in a using scope.
            //// The bootstrapper takes care of that. I use it here to calm FxCop ;)

            using (var simpleBootstrapper = new DefaultBootstrapper <ISimpleExtension>())
                using (var simpleStrategy = new SimpleStrategy())
                    using (var thirdSimpleExtension = new ThirdSimpleExtension())
                    {
                        simpleBootstrapper.Initialize(simpleStrategy);

                        simpleBootstrapper.AddExtension(new FirstSimpleExtension());
                        simpleBootstrapper.AddExtension(new SecondSimpleExtension());
                        simpleBootstrapper.AddExtension(thirdSimpleExtension);

                        simpleBootstrapper.Run();
                        simpleBootstrapper.Shutdown();
                    }

            Console.WriteLine("================== End simple ==================");
            Console.WriteLine("Press any key to continue");
            Console.ReadLine();

            Console.WriteLine("================== Running complex ==================");
            Console.WriteLine();

            //// Actually it is not necessary to have the strategy and disposable extensions in a using scope.
            //// The bootstrapper takes care of that. I use it here to calm FxCop ;)

            using (var complexBootstrapper = new DefaultBootstrapper <IComplexExtension>())
                using (var complexStrategy = new ComplexStrategy())
                {
                    complexBootstrapper.Initialize(complexStrategy);

                    complexBootstrapper.AddExtension(new Log4NetExtension());
                    complexBootstrapper.AddExtension(new ExtensionWhichRegistersSomething());
                    complexBootstrapper.AddExtension(new ExtensionWhichNeedsDependency());
                    complexBootstrapper.AddExtension(new ExtensionWhichIsFunqlet());
                    complexBootstrapper.AddExtension(new ExtensionWithExtensionConfigurationSection());
                    complexBootstrapper.AddExtension(
                        new ExtensionWithExtensionConfigurationSectionWithConversionAndCustomizedLoading());
                    complexBootstrapper.AddExtension(new ExtensionWithExtensionConfigurationSectionWithDictionary());

                    complexBootstrapper.Run();
                    complexBootstrapper.Shutdown();
                }

            Console.WriteLine("================== End complex ==================");
            Console.WriteLine("Press any key to continue");
            Console.ReadLine();
        }
        public static void GetAssemblyFileNamesToScanForExtensions_should_return_empty_list()
        {
            // Arrange
            var bootstrapper = new DefaultBootstrapper();

            // Act
            var assemblyFileNames = bootstrapper.GetAssemblyFileNamesToScanForExtensions();

            // Assert
            assemblyFileNames.Should().BeEmpty();
        }
Exemple #4
0
        public static void Main()
        {
            Console.WriteLine("================== Running simple ==================");
            Console.WriteLine();

            //// Actually it is not necessary to have the strategy and disposable extensions in a using scope. 
            //// The bootstrapper takes care of that. I use it here to calm FxCop ;)

            using (var simpleBootstrapper = new DefaultBootstrapper<ISimpleExtension>())
            using (var simpleStrategy = new SimpleStrategy())
            using (var thirdSimpleExtension = new ThirdSimpleExtension())
            {
                simpleBootstrapper.Initialize(simpleStrategy);

                simpleBootstrapper.AddExtension(new FirstSimpleExtension());
                simpleBootstrapper.AddExtension(new SecondSimpleExtension());
                simpleBootstrapper.AddExtension(thirdSimpleExtension);

                simpleBootstrapper.Run();
                simpleBootstrapper.Shutdown();
            }

            Console.WriteLine("================== End simple ==================");
            Console.WriteLine("Press any key to continue");
            Console.ReadLine();

            Console.WriteLine("================== Running complex ==================");
            Console.WriteLine();

            //// Actually it is not necessary to have the strategy and disposable extensions in a using scope. 
            //// The bootstrapper takes care of that. I use it here to calm FxCop ;)

            using (var complexBootstrapper = new DefaultBootstrapper<IComplexExtension>())
            using (var complexStrategy = new ComplexStrategy())
            {
                complexBootstrapper.Initialize(complexStrategy);

                complexBootstrapper.AddExtension(new Log4NetExtension());
                complexBootstrapper.AddExtension(new ExtensionWhichRegistersSomething());
                complexBootstrapper.AddExtension(new ExtensionWhichNeedsDependency());
                complexBootstrapper.AddExtension(new ExtensionWhichIsFunqlet());
                complexBootstrapper.AddExtension(new ExtensionWithExtensionConfigurationSection());
                complexBootstrapper.AddExtension(
                    new ExtensionWithExtensionConfigurationSectionWithConversionAndCustomizedLoading());
                complexBootstrapper.AddExtension(new ExtensionWithExtensionConfigurationSectionWithDictionary());

                complexBootstrapper.Run();
                complexBootstrapper.Shutdown();
            }

            Console.WriteLine("================== End complex ==================");
            Console.WriteLine("Press any key to continue");
            Console.ReadLine();
        }
        public DefaultBootstrapperTest()
        {
            this.extensionHost = new Mock<IExtensionHost<IExtension>>();
            this.reporter = new Mock<IReporter>();
            this.strategy = new Mock<IStrategy<IExtension>>();
            this.runExecutor = new Mock<IExecutor<IExtension>>();
            this.shutdownExecutor = new Mock<IExecutor<IExtension>>();
            this.reportingContext = new Mock<IReportingContext> { DefaultValue = DefaultValue.Mock };
            this.extensionResolver = new Mock<IExtensionResolver<IExtension>>();

            this.testee = new DefaultBootstrapper<IExtension>(this.extensionHost.Object, this.reporter.Object);
        }
        public static void Main(string[] args)
        {
            using (var bootstrapper = new DefaultBootstrapper<ISensor>())
            {
                bootstrapper.Initialize(new SensorLifetimeStrategy());

                PrintHeader();

                bootstrapper.Run();

                PrintBody();

                bootstrapper.Shutdown();

                PrintFooter();
            }
        }
        public static void Main(string[] args)
        {
            using (var bootstrapper = new DefaultBootstrapper <ISensor>())
            {
                bootstrapper.Initialize(new SensorLifetimeStrategy());

                PrintHeader();

                bootstrapper.Run();

                PrintBody();

                bootstrapper.Shutdown();

                PrintFooter();
            }
        }
        public static void AddYOYOFx(this IServiceCollection services)
        {
            services.AddSingleton <IControllerFacotry, DefaultControllerFactory>();
            services.AddSingleton <IRouteBuilder>(RouteBuilder.Builder);

            IYOYOBootstrapper bootStrapper = new DefaultBootstrapper();

            bootStrapper.Initialise();

            services.AddSingleton <IYOYOBootstrapper>(bootStrapper);

            services.Scan(scan => scan.FromAssemblies(ApplicationAssemblyLoader.GetLoadedAssemblies())
                          .AddClasses()
                          .UsingAttributes());

            services.AddSingleton <ISessionProvider, DefaultSessionProvider>();

            Application.CurrentApplication.ServiceProvider = services.BuildServiceProvider();
        }
Exemple #9
0
        protected override void ConfigureServices(IServiceCollection services)
        {
            var cultureInfo = new CultureInfo("en-US");

            _defaultBootstrapper = new DefaultBootstrapper(
                tenantCode: TENANT_CODE,
                localization: LOCALIZATIONS,
                uiLanguage: UI_LANGUAGE,
                uiCultureInfo: cultureInfo,
                cultureInfo: cultureInfo,
                serviceCollection: services
            );
            _defaultBootstrapper.Initialize(false);

            _customBootstrapper = new CustomBootstrapper(
                tenantCode: TENANT_CODE,
                localization: LOCALIZATIONS,
                uiLanguage: UI_LANGUAGE,
                uiCultureInfo: cultureInfo,
                cultureInfo: cultureInfo,
                serviceCollection: services
            );
            _customBootstrapper.Initialize(true);
        }