public void If_a_Memento_does_not_know_its_PluggedType_or_concreteKey_select_the_DEFAULT_Plugin() { var family = new PluginFamily(typeof (IGateway)); Plugin plugin = family.AddPlugin(typeof (TheGateway), Plugin.DEFAULT); var memento = new MemoryInstanceMemento(); Assert.AreSame(plugin, memento.FindPlugin(family)); }
private void attachPlugin(XmlElement pluginElement, PluginFamily family) { TypePath pluginPath = TypePath.CreateFromXmlNode(pluginElement); string concreteKey = pluginElement.GetAttribute(CONCRETE_KEY_ATTRIBUTE); string context = "creating a Plugin for " + family.PluginType.AssemblyQualifiedName; _builder.WithType(pluginPath, context, pluggedType => { if (concreteKey == string.Empty) { throw new StructureMapException(112, pluggedType.FullName); } Plugin plugin = family.AddPlugin(pluggedType, concreteKey); pluginElement.ForTextInChild("Setter/@Name").Do(prop => plugin.Setters.MarkSetterAsMandatory(prop)); }); }