public JsonAndXmlSourceMixingTests() { LocalIocManager.Register <ILanguageManager, LanguageManager>(); LocalIocManager.Register <ILanguageProvider, DefaultLanguageProvider>(); bootstrapper = StudioXBootstrapper.Create <MyLangModule>(LocalIocManager); bootstrapper.Initialize(); }
private static StudioXBootstrapper AddStudioXBootstrapper <TStartupModule>(IServiceCollection services, IIocManager iocManager) where TStartupModule : StudioXModule { var bootstrapper = StudioXBootstrapper.Create <TStartupModule>(iocManager); services.AddSingleton(bootstrapper); return(bootstrapper); }
protected StudioXIntegratedTestBase(bool initializeStudioX = true) { LocalIocManager = new IocManager(); StudioXBootstrapper = StudioXBootstrapper.Create <TStartupModule>(LocalIocManager); if (initializeStudioX) { InitializeStudioX(); } }
/// <summary> /// Use this extension method if you don't initialize StudioX in other way. /// Otherwise, use <see cref="UseStudioX(IAppBuilder)"/>. /// </summary> /// <typeparam name="TStartupModule">The type of the startup module.</typeparam> public static void UseStudioX <TStartupModule>(this IAppBuilder app, [CanBeNull] Action <StudioXBootstrapper> configureAction, [CanBeNull] Action <StudioXOwinOptions> optionsAction = null) where TStartupModule : StudioXModule { app.UseStudioX(optionsAction); if (!app.Properties.ContainsKey("_StudioXBootstrapper.Instance")) { var bootstrapper = StudioXBootstrapper.Create <TStartupModule>(); app.Properties["_StudioXBootstrapper.Instance"] = bootstrapper; configureAction?.Invoke(bootstrapper); bootstrapper.Initialize(); } }
public static void Main(string[] args) { using (var bootstrapper = StudioXBootstrapper.Create <EfCoreTestConsoleAppModule>()) { bootstrapper.IocManager.IocContainer.AddFacility <LoggingFacility>( f => f.UseStudioXLog4Net().WithConfig("log4net.config") ); bootstrapper.Initialize(); bootstrapper.IocManager.Using <MigratorRunner>(migrateTester => migrateTester.Run()); } Console.WriteLine("Press Enter to EXIT!"); Console.ReadLine(); }
public void ShouldGetModuleAndAdditionalAssemblies() { //Arrange var bootstrapper = StudioXBootstrapper.Create <MyStartupModule>(LocalIocManager); bootstrapper.Initialize(); //Act var assemblies = bootstrapper.IocManager.Resolve <StudioXAssemblyFinder>().GetAllAssemblies(); //Assert assemblies.Count.ShouldBe(3); assemblies.Any(a => a == typeof(MyStartupModule).GetAssembly()).ShouldBeTrue(); assemblies.Any(a => a == typeof(StudioXKernelModule).GetAssembly()).ShouldBeTrue(); assemblies.Any(a => a == typeof(FactAttribute).GetAssembly()).ShouldBeTrue(); }
public static void Main(string[] args) { ParseArgs(args); using (var bootstrapper = StudioXBootstrapper.Create <BoilerplateMigratorModule>()) { bootstrapper.IocManager.IocContainer .AddFacility <LoggingFacility>(f => f.UseStudioXLog4Net() .WithConfig("log4net.config") ); bootstrapper.Initialize(); using (var migrateExecuter = bootstrapper.IocManager.ResolveAsDisposable <MultiTenantMigrateExecuter>()) { migrateExecuter.Object.Run(_skipConnVerification); } Console.WriteLine("Press ENTER to exit..."); Console.ReadLine(); } }
public void PluginModuleShouldNotBeLast() { var bootstrapper = StudioXBootstrapper.Create <MyStartupModule>(LocalIocManager); bootstrapper.PlugInSources.AddTypeList(typeof(MyPlugInModule)); bootstrapper.Initialize(); var modules = bootstrapper.IocManager.Resolve <IStudioXModuleManager>().Modules; //Assert modules.Count.ShouldBe(6); modules.Any(m => m.Type == typeof(StudioXKernelModule)).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(); modules.Any(m => m.Type == typeof(MyPlugInModule)).ShouldBeTrue(); modules.Any(m => m.Type == typeof(MyPlugInDependedModule)).ShouldBeTrue(); modules.Last().Type.ShouldBe(typeof(MyStartupModule)); }
public void StartupModuleShouldBeLastModule() { //Arrange var bootstrapper = StudioXBootstrapper.Create <MyStartupModule>(LocalIocManager); bootstrapper.Initialize(); //Act var modules = bootstrapper.IocManager.Resolve <IStudioXModuleManager>().Modules; //Assert modules.Count.ShouldBe(4); modules.Any(m => m.Type == typeof(StudioXKernelModule)).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)); }
public void ShouldLoadAllModules() { //Arrange var bootstrapper = StudioXBootstrapper.Create <MyStartupModule>(LocalIocManager); bootstrapper.PlugInSources.AddTypeList(typeof(MyPlugInModule)); bootstrapper.Initialize(); //Act var modules = bootstrapper.IocManager.Resolve <IStudioXModuleManager>().Modules; //Assert modules.Count.ShouldBe(6); modules.Any(m => m.Type == typeof(StudioXKernelModule)).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(); modules.Any(m => m.Type == typeof(MyPlugInModule)).ShouldBeTrue(); modules.Any(m => m.Type == typeof(MyPlugInDependedModule)).ShouldBeTrue(); modules.Any(m => m.Type == typeof(MyNotDependedModule)).ShouldBeFalse(); }
public StudioXBootstraperTester() { bootstrapper = StudioXBootstrapper.Create <MyTestModule>(LocalIocManager); }