示例#1
0
        public static PluginGraph Build(this Registry registry)
        {
            var builder = new PluginGraphBuilder();
            builder.Add(registry);

            return builder.Build();
        }
示例#2
0
        internal DependencyContainer(List <Registry> modules)
        {
            var builder = new PluginGraphBuilder();

            modules.ForEach(e => builder.Add(e));
            container = new Container(builder.Build());
        }
示例#3
0
        public static PluginGraph BuildPluginGraphFromXml(string xml)
        {
            XmlDocument document = BuildDocument(xml);

            var builder = new PluginGraphBuilder();
            builder.Add(new ConfigurationParser(document.DocumentElement));
            return builder.Build();
        }
        public static PluginGraph Build(this Registry registry)
        {
            var builder = new PluginGraphBuilder();

            builder.Add(registry);

            return(builder.Build());
        }
示例#5
0
        public static PluginGraph GetPluginGraph(string fileName)
        {
            XmlDocument document = GetXmlDocument(fileName);
            var parser = new ConfigurationParser(document.DocumentElement);
            var builder = new PluginGraphBuilder();
            builder.Add(parser);

            return builder.Build();
        }
示例#6
0
        public static PluginGraph BuildPluginGraphFromXml(string xml)
        {
            XmlDocument document = BuildDocument(xml);

            var builder = new PluginGraphBuilder();

            builder.Add(new ConfigurationParser(document.DocumentElement));
            return(builder.Build());
        }
示例#7
0
        public static PluginGraph GetPluginGraph(string fileName)
        {
            XmlDocument document = GetXmlDocument(fileName);
            var         parser   = new ConfigurationParser(document.DocumentElement);
            var         builder  = new PluginGraphBuilder();

            builder.Add(parser);

            return(builder.Build());
        }
        private StructureMapException assertErrorIsThrown(string xml, Action<Container> action)
        {
            var document = new XmlDocument();
            document.LoadXml(xml.Replace("\"", "'"));

            var builder = new PluginGraphBuilder();
            builder.Add(new ConfigurationParser(document.DocumentElement));
            var container = new Container(builder.Build());

            return Exception<StructureMapException>.ShouldBeThrownBy(() => {
                action(container);
            });
            
        }
示例#9
0
        private StructureMapException assertErrorIsThrown(string xml, Action <Container> action)
        {
            var document = new XmlDocument();

            document.LoadXml(xml.Replace("\"", "'"));

            var builder = new PluginGraphBuilder();

            builder.Add(new ConfigurationParser(document.DocumentElement));
            var container = new Container(builder.Build());

            return(Exception <StructureMapException> .ShouldBeThrownBy(() => {
                action(container);
            }));
        }
示例#10
0
        private void Scan(Action <IAssemblyScanner> action)
        {
            var registry = new Registry();

            registry.Scan(scan =>
            {
                action(scan);

                scan.ExcludeNamespaceContainingType <ScanningRegistry>();
                scan.Convention <FakeConvention>();
            });

            var builder = new PluginGraphBuilder();

            builder.Add(registry);
            theGraph = builder.Build();
        }
        private void assertErrorIsThrown(int errorCode, string xml, Action<Container> action)
        {
            var document = new XmlDocument();
            document.LoadXml(xml.Replace("\"", "'"));

            var builder = new PluginGraphBuilder();
            builder.Add(new ConfigurationParser(document.DocumentElement));
            var manager = new Container(builder.Build());

            try
            {
                action(manager);
                Assert.Fail("Should have thrown exception");
            }
            catch (StructureMapException ex)
            {
                Assert.AreEqual(errorCode, ex.ErrorCode, "Expected error code");
            }
        }
        private void assertErrorIsThrown(int errorCode, string xml, Action <Container> action)
        {
            var document = new XmlDocument();

            document.LoadXml(xml.Replace("\"", "'"));

            var builder = new PluginGraphBuilder();

            builder.Add(new ConfigurationParser(document.DocumentElement));
            var manager = new Container(builder.Build());

            try
            {
                action(manager);
                Assert.Fail("Should have thrown exception");
            }
            catch (StructureMapException ex)
            {
                Assert.AreEqual(errorCode, ex.ErrorCode, "Expected error code");
            }
        }