|
From: <jer...@us...> - 2009-01-21 00:53:15
|
Revision: 226
http://structuremap.svn.sourceforge.net/structuremap/?rev=226&view=rev
Author: jeremydmiller
Date: 2009-01-21 00:53:11 +0000 (Wed, 21 Jan 2009)
Log Message:
-----------
marked some methods on PluginGraph virtual for testability concerns
Modified Paths:
--------------
trunk/Source/StructureMap/Graph/PluginGraph.cs
trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj
Added Paths:
-----------
trunk/Source/StructureMap.Testing/Bugs/BuildUpBug.cs
Modified: trunk/Source/StructureMap/Graph/PluginGraph.cs
===================================================================
--- trunk/Source/StructureMap/Graph/PluginGraph.cs 2009-01-19 18:57:33 UTC (rev 225)
+++ trunk/Source/StructureMap/Graph/PluginGraph.cs 2009-01-21 00:53:11 UTC (rev 226)
@@ -178,7 +178,7 @@
/// </summary>
/// <param name="pluginType"></param>
/// <param name="concreteType"></param>
- public void AddType(Type pluginType, Type concreteType)
+ public virtual void AddType(Type pluginType, Type concreteType)
{
FindFamily(pluginType).AddType(concreteType);
}
@@ -189,7 +189,7 @@
/// <param name="pluginType"></param>
/// <param name="concreteType"></param>
/// <param name="name"></param>
- public void AddType(Type pluginType, Type concreteType, string name)
+ public virtual void AddType(Type pluginType, Type concreteType, string name)
{
FindFamily(pluginType).AddType(concreteType, name);
}
@@ -199,7 +199,7 @@
/// could be assigned to the pluginType
/// </summary>
/// <param name="pluggedType"></param>
- public void AddType(Type pluggedType)
+ public virtual void AddType(Type pluggedType)
{
_pluggedTypes.Add(pluggedType);
}
Added: trunk/Source/StructureMap.Testing/Bugs/BuildUpBug.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Bugs/BuildUpBug.cs (rev 0)
+++ trunk/Source/StructureMap.Testing/Bugs/BuildUpBug.cs 2009-01-21 00:53:11 UTC (rev 226)
@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using NUnit.Framework;
+
+namespace StructureMap.Testing.Bugs
+{
+ [TestFixture]
+ public class StructureMapTests
+ {
+ [Test]
+ public void Test()
+ {
+ ObjectFactory.Initialize(x =>
+ {
+ x.UseDefaultStructureMapConfigFile = false;
+
+ x.ForConcreteType<SomeDbRepository>().Configure.
+ WithCtorArg("connectionString").EqualTo("some connection string");
+
+ //x.ForConcreteType<SomeWebPage>().Configure.
+ // SetterDependency<SomeDbRepository>().Is<SomeDbRepository>();
+
+ x.SetAllProperties(o => o.OfType<SomeDbRepository>());
+ });
+
+ SomeDbRepository dbRepository =
+ ObjectFactory.GetInstance<SomeDbRepository>();
+
+ SomeWebPage webPage = new SomeWebPage();
+
+ ObjectFactory.BuildUp(webPage);
+
+ webPage.DbRepository.ConnectionString.ShouldEqual("some connection string");
+ }
+ }
+
+ public class SomeDbRepository
+ {
+ public SomeDbRepository(string connectionString)
+ {
+ this.ConnectionString = connectionString;
+ }
+
+ public string ConnectionString { get; set; }
+
+ // ...
+ }
+
+ public class SomeWebPage
+ {
+ public SomeDbRepository DbRepository { get; set; }
+
+ // ...
+ }
+}
Modified: trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj
===================================================================
--- trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj 2009-01-19 18:57:33 UTC (rev 225)
+++ trunk/Source/StructureMap.Testing/StructureMap.Testing.csproj 2009-01-21 00:53:11 UTC (rev 226)
@@ -179,6 +179,7 @@
<Compile Include="AutoMocking\RhinoAutoMockerTester.cs" />
<Compile Include="AutoMocking\RhinoMockRepositoryProxyTester.cs" />
<Compile Include="AutoWiringExamples.cs" />
+ <Compile Include="Bugs\BuildUpBug.cs" />
<Compile Include="Bugs\IDictionaryAndXmlBugTester.cs" />
<Compile Include="Bugs\ScanIndexerBugTester.cs" />
<Compile Include="Bugs\SingletonShouldBeLazy.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|