Esempio n. 1
0
 public MSBootstraper_Tester()
 {
     _bootstrapper = MSBootStrapper.Create <MyTestModule>(options =>
     {
         options.IocManager = LocalIocManager;
     });
 }
Esempio n. 2
0
        public void StartupModule_ShouldBe_LastModule()
        {
            //Arrange
            var bootstrapper = MSBootStrapper.Create <MyStartupModule>(options =>
            {
                options.IocManager = LocalIocManager;
            });

            bootstrapper.Initialize();

            //Act
            var modules = bootstrapper.IocManager.Resolve <IMSModuleManager>().Modules;

            //Assert
            modules.Count.ShouldBe(4);

            modules.Any(m => m.Type == typeof(MSKernelModule)).ShouldBeTrue();
            modules.Any(m => m.Type == typeof(MyStartupModule)).ShouldBeTrue();
            modules.Any(m => m.Type == typeof(MyModule1)).ShouldBeTrue();
            modules.Any(m => m.Type == typeof(MyModule2)).ShouldBeTrue();

            var startupModule = modules.Last();

            startupModule.Type.ShouldBe(typeof(MyStartupModule));
        }
        private static MSBootStrapper AddMSBootstrapper <TStartupModule>(IServiceCollection services,
                                                                         Action <MSBootstrapperOptions> optionsAction)
            where TStartupModule : MSModule
        {
            var bootStrapper = MSBootStrapper.Create <TStartupModule>(optionsAction);

            services.AddSingleton(bootStrapper);

            return(bootStrapper);
        }