|
From: <jer...@us...> - 2009-10-06 13:51:43
|
Revision: 264
http://structuremap.svn.sourceforge.net/structuremap/?rev=264&view=rev
Author: jeremydmiller
Date: 2009-10-06 13:51:35 +0000 (Tue, 06 Oct 2009)
Log Message:
-----------
Fixing the validation session problem
Modified Paths:
--------------
trunk/Source/StructureMap/BuildSession.cs
trunk/Source/StructureMap/Diagnostics/ValidationBuildSession.cs
trunk/Source/StructureMap.Testing/Diagnostics/ValidationBuildSessionTester.cs
Modified: trunk/Source/StructureMap/BuildSession.cs
===================================================================
--- trunk/Source/StructureMap/BuildSession.cs 2009-09-28 02:01:41 UTC (rev 263)
+++ trunk/Source/StructureMap/BuildSession.cs 2009-10-06 13:51:35 UTC (rev 264)
@@ -9,7 +9,7 @@
{
public class BuildSession : IContext
{
- private BuildStack _buildStack = new BuildStack();
+ protected BuildStack _buildStack = new BuildStack();
private readonly InstanceCache _cache = new InstanceCache();
private readonly Cache<Type, Func<object>> _defaults;
private readonly PipelineGraph _pipelineGraph;
Modified: trunk/Source/StructureMap/Diagnostics/ValidationBuildSession.cs
===================================================================
--- trunk/Source/StructureMap/Diagnostics/ValidationBuildSession.cs 2009-09-28 02:01:41 UTC (rev 263)
+++ trunk/Source/StructureMap/Diagnostics/ValidationBuildSession.cs 2009-10-06 13:51:35 UTC (rev 264)
@@ -115,6 +115,7 @@
{
foreach (Instance instance in pluginType.Instances)
{
+ _buildStack = new BuildStack();
validateInstance(pluginType.PluginType, instance);
}
}
Modified: trunk/Source/StructureMap.Testing/Diagnostics/ValidationBuildSessionTester.cs
===================================================================
--- trunk/Source/StructureMap.Testing/Diagnostics/ValidationBuildSessionTester.cs 2009-09-28 02:01:41 UTC (rev 263)
+++ trunk/Source/StructureMap.Testing/Diagnostics/ValidationBuildSessionTester.cs 2009-10-06 13:51:35 UTC (rev 264)
@@ -4,6 +4,7 @@
using StructureMap.Diagnostics;
using StructureMap.Graph;
using StructureMap.Pipeline;
+using StructureMap.Testing.Configuration.DSL;
using StructureMap.Testing.Widget;
namespace StructureMap.Testing.Diagnostics
@@ -57,6 +58,28 @@
}
[Test]
+ public void do_not_fail_with_the_bidirectional_checks()
+ {
+ var container = new Container(r =>
+ {
+ r.For<IWidget>().Use<ColorWidget>().WithCtorArg("color").EqualTo("red");
+ r.For<Rule>().Use<WidgetRule>();
+
+ r.ForConcreteType<ClassThatNeedsWidgetAndRule1>();
+ r.ForConcreteType<ClassThatNeedsWidgetAndRule2>();
+ r.InstanceOf<ClassThatNeedsWidgetAndRule2>().Is.OfConcreteType<ClassThatNeedsWidgetAndRule2>();
+ r.InstanceOf<ClassThatNeedsWidgetAndRule2>().Is.OfConcreteType<ClassThatNeedsWidgetAndRule2>();
+ r.InstanceOf<ClassThatNeedsWidgetAndRule2>().Is.OfConcreteType<ClassThatNeedsWidgetAndRule2>();
+ r.InstanceOf<ClassThatNeedsWidgetAndRule2>().Is.OfConcreteType<ClassThatNeedsWidgetAndRule2>().CtorDependency<Rule>().Is<ARule>();
+
+
+ });
+
+ container.AssertConfigurationIsValid();
+ }
+
+
+ [Test]
public void Create_an_instance_for_the_first_time_happy_path()
{
ValidationBuildSession session =
@@ -170,6 +193,20 @@
}
}
+ public class ClassThatNeedsWidgetAndRule1
+ {
+ public ClassThatNeedsWidgetAndRule1(IWidget widget, Rule rule)
+ {
+ }
+ }
+
+ public class ClassThatNeedsWidgetAndRule2
+ {
+ public ClassThatNeedsWidgetAndRule2(IWidget widget, Rule rule, ClassThatNeedsWidgetAndRule1 class1)
+ {
+ }
+ }
+
public class WidgetWithOneValidationFailure : IWidget
{
#region IWidget Members
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|