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));
        }
示例#2
0
        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));
        }
示例#4
0
 public SharePlatformBootstraper_Tester()
 {
     _bootstrapper = SharePlatformBootstrapper.Create <MyTestModule>(options =>
     {
         options.IocManager = LocalIocManager;
     });
 }
示例#5
0
        private static SharePlatformBootstrapper AddSharePlatformBootstrapper <TStartupModule>(IServiceCollection services, Action <SharePlatformBootstrapperOptions> optionsAction)
            where TStartupModule : SharePlatformModule
        {
            var sharePlatformBootstrapper = SharePlatformBootstrapper.Create <TStartupModule>(optionsAction);

            services.AddSingleton(sharePlatformBootstrapper);
            return(sharePlatformBootstrapper);
        }
示例#6
0
        protected void InitializeSharePlatform()
        {
            LocalIocManager.RegisterIfNot <ISharePlatformSession, TestSharePlatformSession>();

            PreInitialize();

            SharePlatformBootstrapper.Initialize();

            PostInitialize();

            SharePlatformSession = LocalIocManager.Resolve <TestSharePlatformSession>();
        }
示例#7
0
        protected SharePlatformIntegratedTestBase(bool initializeSharePlatform = true, IIocManager localIocManager = null)
        {
            LocalIocManager = localIocManager ?? new IocManager();

            SharePlatformBootstrapper = SharePlatformBootstrapper.Create <TStartupModule>(options =>
            {
                options.IocManager = LocalIocManager;
            });

            if (initializeSharePlatform)
            {
                InitializeSharePlatform();
            }
        }
示例#8
0
        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();
        }
示例#9
0
 public virtual void Dispose()
 {
     SharePlatformBootstrapper.Dispose();
     LocalIocManager.Dispose();
 }