當前位置: 首頁>>代碼示例>>C#>>正文


C# PluginGraph.Seal方法代碼示例

本文整理匯總了C#中StructureMap.Graph.PluginGraph.Seal方法的典型用法代碼示例。如果您正苦於以下問題:C# PluginGraph.Seal方法的具體用法?C# PluginGraph.Seal怎麽用?C# PluginGraph.Seal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在StructureMap.Graph.PluginGraph的用法示例。


在下文中一共展示了PluginGraph.Seal方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: FindPluginFamilies

        public void FindPluginFamilies()
        {
            var graph = new PluginGraph();
            graph.Scan(x => { x.Assembly("StructureMap.Testing.Widget"); });

            graph.FindFamily(typeof (IWidget)).DefaultInstanceKey = "Blue";
            graph.CreateFamily(typeof (WidgetMaker));

            graph.Seal();

            foreach (PluginFamily family in graph.PluginFamilies)
            {
                Console.WriteLine(family.PluginType.AssemblyQualifiedName);
            }

            Assert.AreEqual(5, graph.FamilyCount);
        }
開發者ID:hp4711,項目名稱:structuremap,代碼行數:17,代碼來源:PluginGraphTester.cs

示例2: FindRegistriesWithinPluginGraphSeal

        public void FindRegistriesWithinPluginGraphSeal()
        {
            var graph = new PluginGraph();

            var scanner = new AssemblyScanner();
            scanner.AssemblyContainingType(typeof (RedGreenRegistry));
            scanner.LookForRegistries();
            scanner.ScanForAll(graph);

            graph.Seal();

            var colors = new List<string>();
            PluginFamily family = graph.FindFamily(typeof (IWidget));

            family.Instances.Each(instance => colors.Add(instance.Name));

            Assert.Contains("Red", colors);
            Assert.Contains("Green", colors);
            Assert.Contains("Yellow", colors);
            Assert.Contains("Blue", colors);
            Assert.Contains("Brown", colors);
            Assert.Contains("Black", colors);
        }
開發者ID:joshuaflanagan,項目名稱:structuremap,代碼行數:23,代碼來源:RegistryIntegratedTester.cs

示例3: FindPlugins

        public void FindPlugins()
        {
            var graph = new PluginGraph();
            graph.Scan(x =>
            {
                x.Assembly("StructureMap.Testing.Widget");
                x.Assembly("StructureMap.Testing.Widget2");
            });

            graph.FindFamily(typeof (Rule));

            graph.Seal();

            PluginFamily family = graph.FindFamily(typeof (Rule));
            Assert.IsNotNull(family);
            Assert.AreEqual(5, family.PluginCount, "There are 5 Rule classes in the two assemblies");
        }
開發者ID:hp4711,項目名稱:structuremap,代碼行數:17,代碼來源:PluginGraphTester.cs

示例4: Seal_does_not_throw_an_exception_if_there_are_no_errors

        public void Seal_does_not_throw_an_exception_if_there_are_no_errors()
        {
            var graph = new PluginGraph();
            Assert.AreEqual(0, graph.Log.ErrorCount);

            graph.Seal();
        }
開發者ID:hp4711,項目名稱:structuremap,代碼行數:7,代碼來源:PluginGraphTester.cs

示例5: PutsRightNumberOfPluginsIntoAFamily

        public void PutsRightNumberOfPluginsIntoAFamily()
        {
            var graph = new PluginGraph();

            graph.Scan(x => { x.Assembly("StructureMap.Testing.Widget"); });

            graph.FindFamily(typeof (IWidget)).DefaultInstanceKey = "Blue";
            graph.Seal();

            PluginFamily family = graph.FindFamily(typeof (IWidget));
            Assert.IsNotNull(family);

            Assert.AreEqual("Blue", family.DefaultInstanceKey);

            Assert.AreEqual(4, family.PluginCount, "3 different IWidget classes are marked as Pluggable");
        }
開發者ID:hp4711,項目名稱:structuremap,代碼行數:16,代碼來源:PluginGraphTester.cs

示例6: PicksUpManuallyAddedPlugin

        public void PicksUpManuallyAddedPlugin()
        {
            var graph = new PluginGraph();

            graph.Scan(x => { x.Assembly("StructureMap.Testing.Widget"); });

            graph.FindFamily(typeof (IWidget)).DefaultInstanceKey = "Blue";

            PluginFamily family = graph.FindFamily(typeof (IWidget));
            family.AddPlugin(typeof (NotPluggableWidget), "NotPluggable");

            graph.Seal();

            Assert.IsNotNull(family);

            Assert.AreEqual(
                5,
                family.PluginCount,
                "5 different IWidget classes are marked as Pluggable, + the manual add");
        }
開發者ID:hp4711,項目名稱:structuremap,代碼行數:20,代碼來源:PluginGraphTester.cs

示例7: CanCreateTheAutoFilledInstance

        public void CanCreateTheAutoFilledInstance()
        {
            // Builds a PluginGraph that includes all of the PluginFamily's and Plugin's
            // defined in this file
            var pluginGraph = new PluginGraph();
            pluginGraph.Scan(x => x.Assembly(Assembly.GetExecutingAssembly()));
            pluginGraph.Seal();

            var manager = new Container(pluginGraph);

            var mustang = (Mustang) manager.GetInstance(typeof (IAutomobile), "Mustang");

            Assert.IsNotNull(mustang);
            Assert.IsTrue(mustang.Engine is PushrodEngine);
        }
開發者ID:joshuaflanagan,項目名稱:structuremap,代碼行數:15,代碼來源:PluginTester.cs


注:本文中的StructureMap.Graph.PluginGraph.Seal方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。