public static PluginGraph BuildPluginGraphFromXml(string xml) { XmlDocument document = BuildDocument(xml); var builder = new PluginGraphBuilder(); builder.FindSource<XmlConfiguration>().IncludeNode(document.DocumentElement, "testing data"); return builder.Build(); }
public void SwitchToAttributeNormalizedMode() { XmlDocument document = DataMother.GetXmlDocument("AttributeNormalized.xml"); var builder = new PluginGraphBuilder(); builder.FindSource<XmlConfiguration>().IncludeNode(document.DocumentElement, null); PluginGraph graph = builder.Build(); var manager = new Container(graph); var tommy = (GrandChild) manager.GetInstance(typeof (GrandChild), "Tommy"); Assert.AreEqual(false, tommy.RightHanded); Assert.AreEqual(1972, tommy.BirthYear); var blue = (ColorWidget) manager.GetInstance(typeof (IWidget), "Blue"); Assert.AreEqual("Blue", blue.Color); }
public static PluginGraph GetPluginGraph(string fileName) { XmlDocument document = GetXmlDocument(fileName); var builder = new PluginGraphBuilder(); builder.FindSource<XmlConfiguration>().IncludeNode(document.DocumentElement, "testing data"); return builder.Build(); }
public void SetUp() { DataMother.WriteDocument("FullTesting.XML"); var doc = new XmlDocument(); doc.Load("StructureMap.config"); XmlNode node = doc.DocumentElement.SelectSingleNode("//StructureMap"); var builder = new PluginGraphBuilder(); builder.FindSource<XmlConfiguration>().IncludeNode(node, "testing data"); graph = builder.Build(); }