예제 #1
0
        /// <summary>
        /// Adds the DefaultConventionScanner to the scanning operations.  I.e., a concrete
        /// class named "Something" that implements "ISomething" will be automatically
        /// added to PluginType "ISomething"
        /// </summary>
        public ConfigureConventionExpression WithDefaultConventions()
        {
            var convention = new DefaultConventionScanner();

            With(convention);
            return(new ConfigureConventionExpression(convention));
        }
        public void Process_to_PluginGraph()
        {
            var graph = new PluginGraph();
            var scanner = new DefaultConventionScanner();

            var registry = new Registry();

            scanner.Process(typeof (Convention), registry);

            registry.ShouldBeOfType<IPluginGraphConfiguration>().Configure(graph);

            Assert.IsFalse(graph.Families.Has(typeof (IServer)));
            Assert.IsTrue(graph.Families.Has(typeof (IConvention)));

            var family = graph.Families[typeof (IConvention)];
            Assert.AreEqual(1, family.Instances.Count());
        }
        public void Process_to_PluginGraph()
        {
            var graph = new PluginGraph();
            var scanner = new DefaultConventionScanner();

            var registry = new Registry();

            scanner.Process(typeof (Convention), registry);

            registry.ConfigureWithoutScanning(graph);

            Assert.IsFalse(graph.ContainsFamily(typeof (IServer)));
            Assert.IsTrue(graph.ContainsFamily(typeof(IConvention)));

            PluginFamily family = graph.FindFamily(typeof (IConvention));
            family.Seal();
            Assert.AreEqual(1, family.InstanceCount);
        }
        public void Process_to_PluginGraph()
        {
            var graph = new PluginGraph();
            var scanner = new DefaultConventionScanner();

            var registry = new Registry();

            scanner.Process(typeof (Convention), registry);

            registry.As<IPluginGraphConfiguration>().Configure(graph);

            graph.Families.Has(typeof (IServer)).ShouldBeFalse();
            graph.Families.Has(typeof (IConvention)).ShouldBeTrue();

            var family = graph.Families[typeof (IConvention)];
            family.Instances.Count().ShouldBe(1);
        }