public void PluginModule_ShouldNotBeLast() { var bootstrapper = SharePlatformBootstrapper.Create <MyStartupModule>(options => { options.IocManager = LocalIocManager; }); bootstrapper.PlugInSources.AddTypeList(typeof(MyPlugInModule)); bootstrapper.Initialize(); var modules = bootstrapper.IocManager.Resolve <ISharePlatformModuleManager>().Modules; //Assert modules.Count.ShouldBe(6); modules.Any(m => m.Type == typeof(SharePlatformKernelModule)).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 Should_Load_All_Modules() { //Arrange var bootstrapper = SharePlatformBootstrapper.Create <MyStartupModule>(options => { options.IocManager = LocalIocManager; }); bootstrapper.PlugInSources.AddTypeList(typeof(MyPlugInModule)); bootstrapper.Initialize(); //Act var modules = bootstrapper.IocManager.Resolve <ISharePlatformModuleManager>().Modules; //Assert modules.Count.ShouldBe(6); modules.Any(m => m.Type == typeof(SharePlatformKernelModule)).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 void StartupModule_ShouldBe_LastModule() { //Arrange var bootstrapper = SharePlatformBootstrapper.Create <MyStartupModule>(options => { options.IocManager = LocalIocManager; }); bootstrapper.Initialize(); //Act var modules = bootstrapper.IocManager.Resolve <ISharePlatformModuleManager>().Modules; //Assert modules.Count.ShouldBe(4); modules.Any(m => m.Type == typeof(SharePlatformKernelModule)).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 SharePlatformBootstraper_Tester() { _bootstrapper = SharePlatformBootstrapper.Create <MyTestModule>(options => { options.IocManager = LocalIocManager; }); }
private static SharePlatformBootstrapper AddSharePlatformBootstrapper <TStartupModule>(IServiceCollection services, Action <SharePlatformBootstrapperOptions> optionsAction) where TStartupModule : SharePlatformModule { var sharePlatformBootstrapper = SharePlatformBootstrapper.Create <TStartupModule>(optionsAction); services.AddSingleton(sharePlatformBootstrapper); return(sharePlatformBootstrapper); }
protected void InitializeSharePlatform() { LocalIocManager.RegisterIfNot <ISharePlatformSession, TestSharePlatformSession>(); PreInitialize(); SharePlatformBootstrapper.Initialize(); PostInitialize(); SharePlatformSession = LocalIocManager.Resolve <TestSharePlatformSession>(); }
protected SharePlatformIntegratedTestBase(bool initializeSharePlatform = true, IIocManager localIocManager = null) { LocalIocManager = localIocManager ?? new IocManager(); SharePlatformBootstrapper = SharePlatformBootstrapper.Create <TStartupModule>(options => { options.IocManager = LocalIocManager; }); if (initializeSharePlatform) { InitializeSharePlatform(); } }
public void Should_Get_Module_And_Additional_Assemblies() { //Arrange var bootstrapper = SharePlatformBootstrapper.Create <MyStartupModule>(options => { options.IocManager = LocalIocManager; }); bootstrapper.Initialize(); //Act var assemblies = bootstrapper.IocManager.Resolve <SharePlatformAssemblyFinder>().GetAllAssemblies(); //Assert assemblies.Count.ShouldBe(2); assemblies.Any(a => a == typeof(SharePlatformKernelModule).GetAssembly()).ShouldBeTrue(); }
public virtual void Dispose() { SharePlatformBootstrapper.Dispose(); LocalIocManager.Dispose(); }