From: <jer...@us...> - 2008-05-04 01:29:32
|
Revision: 90 http://structuremap.svn.sourceforge.net/structuremap/?rev=90&view=rev Author: jeremydmiller Date: 2008-05-03 18:29:30 -0700 (Sat, 03 May 2008) Log Message: ----------- Eliminated a superfluous ctor on PluginFamily and killed off a static method on PluginFamily. Modified Paths: -------------- trunk/Source/StructureMap/Graph/PluginFamily.cs trunk/Source/StructureMap/InstanceManager.cs trunk/Source/StructureMap.Testing/Container/FillDependenciesTester.cs trunk/Source/StructureMap.Testing/Graph/PluginFamilyTester.cs Modified: trunk/Source/StructureMap/Graph/PluginFamily.cs =================================================================== --- trunk/Source/StructureMap/Graph/PluginFamily.cs 2008-05-04 01:11:30 UTC (rev 89) +++ trunk/Source/StructureMap/Graph/PluginFamily.cs 2008-05-04 01:29:30 UTC (rev 90) @@ -15,23 +15,6 @@ /// </summary> public class PluginFamily { - #region statics - - [Obsolete] - public static PluginFamily CreateAutoFilledPluginFamily(Type pluginType) - { - Plugin plugin = Plugin.CreateAutofilledPlugin(pluginType); - - PluginFamily family = new PluginFamily(pluginType); - - family.Plugins.Add(plugin); - family.DefaultInstanceKey = plugin.ConcreteKey; - - return family; - } - - #endregion - public const string CONCRETE_KEY = "CONCRETE"; private readonly List<InstanceMemento> _mementoList = new List<InstanceMemento>(); private readonly PluginCollection _plugins; @@ -72,41 +55,12 @@ } - /// <summary> - /// Troubleshooting constructor to find potential problems with a PluginFamily's - /// configuration - /// </summary> - /// <param name="path"></param> - /// <param name="defaultKey"></param> - public PluginFamily(TypePath path, string defaultKey) - { - _plugins = new PluginCollection(this); - _pluginTypeName = path.AssemblyQualifiedName; - initializeExplicit(path, defaultKey); - } - - public PluginGraph Parent { get { return _parent; } set { _parent = value; } } - private void initializeExplicit(TypePath path, string defaultKey) - { - try - { - _pluginType = path.FindType(); - _pluginTypeName = TypePath.GetAssemblyQualifiedName(_pluginType); - } - catch (Exception ex) - { - throw new StructureMapException(103, ex, path.ClassName, path.AssemblyName); - } - - _defaultKey = defaultKey; - } - #endregion public InstanceInterceptor InstanceInterceptor Modified: trunk/Source/StructureMap/InstanceManager.cs =================================================================== --- trunk/Source/StructureMap/InstanceManager.cs 2008-05-04 01:11:30 UTC (rev 89) +++ trunk/Source/StructureMap/InstanceManager.cs 2008-05-04 01:29:30 UTC (rev 90) @@ -273,11 +273,13 @@ /// <returns></returns> public object FillDependencies(Type type) { + // TODO: Want all type knowledge into Plugin if (type.IsInterface || type.IsAbstract) { throw new StructureMapException(230, type.FullName); } + // TODO: Little bit of smelliness here Plugin plugin = Plugin.CreateImplicitPlugin(type); if (!plugin.CanBeAutoFilled) { Modified: trunk/Source/StructureMap.Testing/Container/FillDependenciesTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Container/FillDependenciesTester.cs 2008-05-04 01:11:30 UTC (rev 89) +++ trunk/Source/StructureMap.Testing/Container/FillDependenciesTester.cs 2008-05-04 01:29:30 UTC (rev 90) @@ -9,15 +9,6 @@ [TestFixture] public class FillDependenciesTester { - private PluginFamily _family; - - [TestFixtureSetUp] - public void TestFixtureSetUp() - { - _family = PluginFamily.CreateAutoFilledPluginFamily(typeof (FilledConcreteClass)); - Assert.IsNotNull(_family); - } - [Test] public void CanFillDependenciesSuccessfully() { @@ -38,24 +29,6 @@ Assert.IsNotNull(concreteClass.Strategy); } - [Test] - public void CreateAutoFilledPluginFamily() - { - Assert.IsNotNull(_family); - Assert.AreEqual(typeof (FilledConcreteClass), _family.PluginType); - } - - - [Test] - public void CreatesPlugin() - { - Assert.AreEqual(1, _family.Plugins.Count); - Plugin plugin = _family.Plugins.All[0]; - Assert.IsNotNull(plugin); - - Assert.AreEqual(typeof (FilledConcreteClass), plugin.PluggedType); - } - [Test, ExpectedException(typeof (StructureMapException))] public void TryToFillDependenciesOnAbstractClassThrowsException() { Modified: trunk/Source/StructureMap.Testing/Graph/PluginFamilyTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Graph/PluginFamilyTester.cs 2008-05-04 01:11:30 UTC (rev 89) +++ trunk/Source/StructureMap.Testing/Graph/PluginFamilyTester.cs 2008-05-04 01:29:30 UTC (rev 90) @@ -29,23 +29,7 @@ family.Plugins.Add(typeof (Rule), "Rule"); } - [Test, ExpectedException(typeof (StructureMapException))] - public void CreateExplicitWithNonexistentAssembly() - { - TypePath path = new TypePath("NonexistentAssembly", "NonexistentAssembly.Class1"); - PluginFamily family = new PluginFamily(path, ""); - } - - [Test, ExpectedException(typeof (StructureMapException))] - public void CreateExplicitWithNonexistentClass() - { - TypePath path = - new TypePath("StructureMap.Testing.Widget", "StructureMap.Testing.Widget.NonExistentInterface"); - - PluginFamily family = new PluginFamily(path, ""); - } - [Test] public void GetPlugins() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |