当前位置: 首页>>代码示例>>C#>>正文


C# StubLoaders类代码示例

本文整理汇总了C#中StubLoaders的典型用法代码示例。如果您正苦于以下问题:C# StubLoaders类的具体用法?C# StubLoaders怎么用?C# StubLoaders使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


StubLoaders类属于命名空间,在下文中一共展示了StubLoaders类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FeatureDescriptorsAreInDependencyOrder

        public void FeatureDescriptorsAreInDependencyOrder()
        {
            var extensionLoader = new StubLoaders();
            var extensionFolder = new StubFolders();

            extensionFolder.Manifests.Add("Alpha", @"
            Name: Alpha
            Version: 1.0.3
            CoeveryVersion: 1
            Features:
            Alpha:
            Dependencies: Gamma
            ");

            extensionFolder.Manifests.Add("Beta", @"
            Name: Beta
            Version: 1.0.3
            CoeveryVersion: 1
            ");
            extensionFolder.Manifests.Add("Gamma", @"
            Name: Gamma
            Version: 1.0.3
            CoeveryVersion: 1
            Features:
            Gamma:
            Dependencies: Beta
            ");

            IExtensionManager extensionManager = CreateExtensionManager(extensionFolder, extensionLoader);
            var features = extensionManager.AvailableFeatures();
            Assert.That(features.Aggregate("<", (a, b) => a + b.Id + "<"), Is.EqualTo("<Beta<Gamma<Alpha<"));
        }
开发者ID:gokhandisikara,项目名称:Coevery-Framework,代码行数:32,代码来源:ExtensionManagerTests.cs

示例2: ExtensionManagerTestFeatureAttribute

        public void ExtensionManagerTestFeatureAttribute()
        {
            var extensionLoader = new StubLoaders();
            var extensionFolder = new StubFolders();

            extensionFolder.Manifests.Add("TestModule", @"
            Name: TestModule
            Version: 1.0.3
            CoeveryVersion: 1
            Features:
            TestModule:
            Description: My test module for Coevery.
            TestFeature:
            Description: Contains the Phi type.
            ");

            IExtensionManager extensionManager = CreateExtensionManager(extensionFolder, extensionLoader);
            var testFeature = extensionManager.AvailableExtensions()
                .SelectMany(x => x.Features)
                .Single(x => x.Id == "TestFeature");

            foreach (var feature in extensionManager.LoadFeatures(new[] { testFeature })) {
                foreach (var type in feature.ExportedTypes) {
                    foreach (CoeveryFeatureAttribute featureAttribute in type.GetCustomAttributes(typeof(CoeveryFeatureAttribute), false)) {
                        Assert.That(featureAttribute.FeatureName, Is.EqualTo("TestFeature"));
                    }
                }
            }
        }
开发者ID:gokhandisikara,项目名称:Coevery-Framework,代码行数:29,代码来源:ExtensionManagerTests.cs

示例3: FeatureDescriptorsAreInDependencyAndPriorityOrder

        public void FeatureDescriptorsAreInDependencyAndPriorityOrder()
        {
            var extensionLoader = new StubLoaders();
            var extensionFolder = new StubFolders();

            // Check that priorities apply correctly on items on the same level of dependencies and are overwritten by dependencies
            extensionFolder.Manifests.Add("Alpha", CreateManifest("Alpha", "2", "Gamma")); // More important than Gamma but will get overwritten by the dependency
            extensionFolder.Manifests.Add("Beta", CreateManifest("Beta", "2"));
            extensionFolder.Manifests.Add("Foo", CreateManifest("Foo", "1"));
            extensionFolder.Manifests.Add("Gamma", CreateManifest("Gamma", "3", "Beta, Foo"));
            AssertFeaturesAreInOrder(extensionFolder, extensionLoader, "<Foo<Beta<Gamma<Alpha<");

            // Change priorities and see that it reflects properly
            // Gamma comes after Foo (same priority) because their order in the Manifests is preserved
            extensionFolder.Manifests["Foo"] = CreateManifest("Foo", "3");
            AssertFeaturesAreInOrder(extensionFolder, extensionLoader, "<Beta<Foo<Gamma<Alpha<");

            // Remove dependency on Foo and see that it moves down the list since no one depends on it anymore
            extensionFolder.Manifests["Gamma"] = CreateManifest("Gamma", "3", "Beta");
            AssertFeaturesAreInOrder(extensionFolder, extensionLoader, "<Beta<Gamma<Alpha<Foo<");

            // Change Foo to depend on Gamma and see that it says in its position (same dependencies as alpha but lower priority)
            extensionFolder.Manifests["Foo"] = CreateManifest("Foo", "3", "Gamma");
            AssertFeaturesAreInOrder(extensionFolder, extensionLoader, "<Beta<Gamma<Alpha<Foo<");

            // Update Foo to a higher priority than alpha and see that it moves before alpha
            extensionFolder.Manifests["Foo"] = CreateManifest("Foo", "1", "Gamma");
            AssertFeaturesAreInOrder(extensionFolder, extensionLoader, "<Beta<Gamma<Foo<Alpha<");
        }
开发者ID:gokhandisikara,项目名称:Coevery-Framework,代码行数:29,代码来源:ExtensionManagerTests.cs

示例4: AssertFeaturesAreInOrder

 private static void AssertFeaturesAreInOrder(IEnumerable<StubFolders> folders, StubLoaders loader, string expectedOrder)
 {
     var extensionManager = CreateExtensionManager(folders, new[] { loader });
     var features = extensionManager.AvailableFeatures();
     Assert.That(features.Aggregate("<", (a, b) => a + b.Id + "<"), Is.EqualTo(expectedOrder));
 }
开发者ID:gokhandisikara,项目名称:Coevery-Framework,代码行数:6,代码来源:ExtensionManagerTests.cs

示例5: ModuleNameIsIntroducedAsFeatureImplicitly

        public void ModuleNameIsIntroducedAsFeatureImplicitly() {
            var extensionLoader = new StubLoaders();
            var extensionFolder = new StubFolders();

            extensionFolder.Manifests.Add("Minimalistic", @"
name: Minimalistic
version: 1.0.3
orchardversion: 1
");

            IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader });
            var minimalisticModule = extensionManager.AvailableExtensions().Single(x => x.Name == "Minimalistic");

            Assert.That(minimalisticModule.Features.Count(), Is.EqualTo(1));
            Assert.That(minimalisticModule.Features.Single().Name, Is.EqualTo("Minimalistic"));
        }
开发者ID:mofashi2011,项目名称:orchardcms,代码行数:16,代码来源:ExtensionManagerTests.cs

示例6: FeatureDescriptorsShouldBeLoadedInThemes

        public void FeatureDescriptorsShouldBeLoadedInThemes()
        {
            var extensionLoader = new StubLoaders();
            var moduleExtensionFolder = new StubFolders();
            var themeExtensionFolder = new StubFolders(DefaultExtensionTypes.Theme);

            moduleExtensionFolder.Manifests.Add("Alpha", @"
            Name: Alpha
            Version: 1.0.3
            CoeveryVersion: 1
            Features:
            Alpha:
            Dependencies: Gamma
            ");

            moduleExtensionFolder.Manifests.Add("Beta", @"
            Name: Beta
            Version: 1.0.3
            CoeveryVersion: 1
            ");
            moduleExtensionFolder.Manifests.Add("Gamma", @"
            Name: Gamma
            Version: 1.0.3
            CoeveryVersion: 1
            Features:
            Gamma:
            Dependencies: Beta
            ");

            moduleExtensionFolder.Manifests.Add("Classic", @"
            Name: Classic
            Version: 1.0.3
            CoeveryVersion: 1
            ");

            IExtensionManager extensionManager = CreateExtensionManager(new[] { moduleExtensionFolder, themeExtensionFolder }, new[] { extensionLoader });
            var features = extensionManager.AvailableFeatures();
            Assert.That(features.Count(), Is.EqualTo(4));
        }
开发者ID:gokhandisikara,项目名称:Coevery-Framework,代码行数:39,代码来源:ExtensionManagerTests.cs

示例7: ThemeFeatureDescriptorsShouldBeAbleToDependOnModules

        public void ThemeFeatureDescriptorsShouldBeAbleToDependOnModules()
        {
            var extensionLoader = new StubLoaders();
            var moduleExtensionFolder = new StubFolders();
            var themeExtensionFolder = new StubFolders(DefaultExtensionTypes.Theme);

            moduleExtensionFolder.Manifests.Add("Alpha", CreateManifest("Alpha", null, "Gamma"));
            moduleExtensionFolder.Manifests.Add("Beta", CreateManifest("Beta"));
            moduleExtensionFolder.Manifests.Add("Gamma", CreateManifest("Gamma", null, "Beta"));
            moduleExtensionFolder.Manifests.Add("Classic", CreateManifest("Classic", null, "Alpha"));

            AssertFeaturesAreInOrder(new[] { moduleExtensionFolder, themeExtensionFolder }, extensionLoader, "<Beta<Gamma<Alpha<Classic<");
        }
开发者ID:gokhandisikara,项目名称:Coevery-Framework,代码行数:13,代码来源:ExtensionManagerTests.cs

示例8: FeatureDescriptorsShouldBeLoadedInThemes

        public void FeatureDescriptorsShouldBeLoadedInThemes()
        {
            var extensionLoader = new StubLoaders();
            var moduleExtensionFolder = new StubExtensionLocator(new[] { DefaultExtensionTypes.Module, DefaultExtensionTypes.Theme });

            moduleExtensionFolder.Manifests.Add("Alpha", @"
Name: Alpha
Version: 1.0.3
OrchardVersion: 1
Features:
    Alpha:
        Dependencies: Gamma
");

            moduleExtensionFolder.Manifests.Add("Beta", @"
Name: Beta
Version: 1.0.3
OrchardVersion: 1
");
            moduleExtensionFolder.Manifests.Add("Gamma", @"
Name: Gamma
Version: 1.0.3
OrchardVersion: 1
Features:
    Gamma:
        Dependencies: Beta
");

            moduleExtensionFolder.ThemeManifests.Add("Classic", @"
Name: Classic
Version: 1.0.3
OrchardVersion: 1
");

            IExtensionManager extensionManager = CreateExtensionManager(moduleExtensionFolder, new[] { extensionLoader });
            var features = extensionManager.AvailableFeatures();
            Assert.Equal(4, features.Count());
        }
开发者ID:jchenga,项目名称:Orchard2,代码行数:38,代码来源:ExtensionManagerTests.cs

示例9: AssertFeaturesAreInOrder

 private static void AssertFeaturesAreInOrder(StubExtensionLocator folder, StubLoaders loader, string expectedOrder)
 {
     var extensionManager = CreateExtensionManager(folder, new[] { loader });
     var features = extensionManager.AvailableFeatures();
     Assert.Equal(expectedOrder, features.Aggregate("<", (a, b) => a + b.Id + "<"));
 }
开发者ID:jchenga,项目名称:Orchard2,代码行数:6,代码来源:ExtensionManagerTests.cs

示例10: ExtensionManagerLoadFeatureDoesNotReturnTypesFromNonMatchingFeatures

        public void ExtensionManagerLoadFeatureDoesNotReturnTypesFromNonMatchingFeatures()
        {
            var extensionLoader = new StubLoaders();
            var extensionFolder = new StubExtensionLocator();

            extensionFolder.Manifests.Add("TestModule", @"
Name: TestModule
Version: 1.0.3
OrchardVersion: 1
Features:
    TestModule:
        Description: My test module for Orchard.
    TestFeature:
        Description: Contains the Phi type.
");

            IExtensionManager extensionManager = CreateExtensionManager(extensionFolder, extensionLoader);
            var testModule = extensionManager.AvailableExtensions()
                .SelectMany(x => x.Features)
                .Single(x => x.Id == "TestModule");

            foreach (var feature in extensionManager.LoadFeatures(new[] { testModule }))
            {
                foreach (var type in feature.ExportedTypes)
                {
                    Assert.IsNotType(typeof(Phi), type);
                    Assert.True((type == typeof(Alpha) || (type == typeof(Beta))));
                }
            }
        }
开发者ID:jchenga,项目名称:Orchard2,代码行数:30,代码来源:ExtensionManagerTests.cs

示例11: ModuleNameIsIntroducedAsFeatureImplicitly

        public void ModuleNameIsIntroducedAsFeatureImplicitly()
        {
            var extensionLoader = new StubLoaders();
            var extensionFolder = new StubExtensionLocator();

            extensionFolder.Manifests.Add("Minimalistic", @"
Name: Minimalistic
Version: 1.0.3
OrchardVersion: 1
");

            IExtensionManager extensionManager = CreateExtensionManager(extensionFolder, extensionLoader);
            var minimalisticModule = extensionManager.AvailableExtensions().Single(x => x.Id == "Minimalistic");

            Assert.Equal(1, minimalisticModule.Features.Count());
            Assert.Equal("Minimalistic", minimalisticModule.Features.Single().Id);
        }
开发者ID:jchenga,项目名称:Orchard2,代码行数:17,代码来源:ExtensionManagerTests.cs

示例12: ExtensionManagerFeaturesContainNonAbstractClasses

        public void ExtensionManagerFeaturesContainNonAbstractClasses()
        {
            var extensionLoader = new StubLoaders();
            var folders = new StubExtensionLocator();

            folders.Manifests.Add("TestModule", @"
Name: TestModule
Version: 1.0.3
OrchardVersion: 1
Features:
    TestModule:
        Description: My test module for Orchard.
    TestFeature:
        Description: Contains the Phi type.
");

            IExtensionManager extensionManager = CreateExtensionManager(folders, extensionLoader);
            var testFeature = extensionManager.AvailableExtensions()
                .SelectMany(x => x.Features);

            var features = extensionManager.LoadFeatures(testFeature);
            var types = features.SelectMany(x => x.ExportedTypes);

            foreach (var type in types)
            {
                Assert.True(type.GetTypeInfo().IsClass);
                Assert.True(!type.GetTypeInfo().IsAbstract);
            }
        }
开发者ID:jchenga,项目名称:Orchard2,代码行数:29,代码来源:ExtensionManagerTests.cs

示例13: ExtensionManagerShouldLoadFeatures

        public void ExtensionManagerShouldLoadFeatures()
        {
            var extensionLoader = new StubLoaders();
            var folders = new StubExtensionLocator();

            folders.Manifests.Add("TestModule", @"
Name: TestModule
Version: 1.0.3
OrchardVersion: 1
Features:
    TestModule:
        Description: My test module for Orchard.
    TestFeature:
        Description: Contains the Phi type.
");

            IExtensionManager extensionManager = CreateExtensionManager(folders, extensionLoader);
            var testFeature = extensionManager.AvailableExtensions()
                .SelectMany(x => x.Features);

            var features = extensionManager.LoadFeatures(testFeature);
            var types = features.SelectMany(x => x.ExportedTypes);

            Assert.NotEqual(0, types.Count());
        }
开发者ID:jchenga,项目名称:Orchard2,代码行数:25,代码来源:ExtensionManagerTests.cs

示例14: CreateExtensionManager

 private ExtensionManager CreateExtensionManager(StubFolders extensionFolder, StubLoaders extensionLoader) {
     return new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader }, new StubCacheManager(), new StubParallelCacheContext(), new StubAsyncTokenProvider());
 }
开发者ID:Higea,项目名称:Orchard,代码行数:3,代码来源:ExtensionLoaderCoordinatorTests.cs

示例15: FeatureDescriptorsAreInManifestOrderWhenTheyHaveEqualPriority

        public void FeatureDescriptorsAreInManifestOrderWhenTheyHaveEqualPriority()
        {
            var extensionLoader = new StubLoaders();
            var extensionFolder = new StubFolders();

            extensionFolder.Manifests.Add("Alpha", CreateManifest("Alpha", "4"));
            extensionFolder.Manifests.Add("Beta", CreateManifest("Beta", "4"));
            extensionFolder.Manifests.Add("Gamma", CreateManifest("Gamma", "4"));
            extensionFolder.Manifests.Add("Foo", CreateManifest("Foo", "3"));
            extensionFolder.Manifests.Add("Bar", CreateManifest("Bar", "3"));
            extensionFolder.Manifests.Add("Baz", CreateManifest("Baz", "3"));

            AssertFeaturesAreInOrder(extensionFolder, extensionLoader, "<Foo<Bar<Baz<Alpha<Beta<Gamma<");
        }
开发者ID:gokhandisikara,项目名称:Coevery-Framework,代码行数:14,代码来源:ExtensionManagerTests.cs


注:本文中的StubLoaders类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。