コード例 #1
0
        public void LoadRegistersServicesInRootContainer()
        {
            MockRootCompositionContainer rootContainer = new MockRootCompositionContainer();
            CompositionContainer moduleContainer = rootContainer.Containers.AddNew<CompositionContainer>();
            ShellModuleInitializer moduleInitializer = new ShellModuleInitializer();

            moduleInitializer.Load(moduleContainer);

            IAuthorizationService authorizationService = rootContainer.Services.Get<IAuthorizationService>(true);
            Assert.IsTrue(authorizationService is EnterpriseLibraryAuthorizationService);

            IPermissionsCatalog permissionsCatalog = rootContainer.Services.Get<IPermissionsCatalog>(true);
            Assert.IsTrue(permissionsCatalog is PermissionsCatalog);

            IRolesCatalog rolesCatalog = rootContainer.Services.Get<IRolesCatalog>();
            Assert.IsTrue(rolesCatalog is RolesCatalog);

            ISiteMapBuilderService siteMapBuilderService = rootContainer.Services.Get<ISiteMapBuilderService>();
            Assert.IsTrue(siteMapBuilderService is SiteMapBuilderService);
        }
コード例 #2
0
        public void LoadRegistersServicesInRootContainer()
        {
            MockRootCompositionContainer rootContainer     = new MockRootCompositionContainer();
            CompositionContainer         moduleContainer   = rootContainer.Containers.AddNew <CompositionContainer>();
            ShellModuleInitializer       moduleInitializer = new ShellModuleInitializer();

            moduleInitializer.Load(moduleContainer);

            IAuthorizationService authorizationService = rootContainer.Services.Get <IAuthorizationService>(true);

            Assert.IsTrue(authorizationService is EnterpriseLibraryAuthorizationService);

            IPermissionsCatalog permissionsCatalog = rootContainer.Services.Get <IPermissionsCatalog>(true);

            Assert.IsTrue(permissionsCatalog is PermissionsCatalog);

            IRolesCatalog rolesCatalog = rootContainer.Services.Get <IRolesCatalog>();

            Assert.IsTrue(rolesCatalog is RolesCatalog);

            ISiteMapBuilderService siteMapBuilderService = rootContainer.Services.Get <ISiteMapBuilderService>();

            Assert.IsTrue(siteMapBuilderService is SiteMapBuilderService);
        }