From: <fli...@us...> - 2009-11-13 17:50:20
|
Revision: 274 http://structuremap.svn.sourceforge.net/structuremap/?rev=274&view=rev Author: flimflan Date: 2009-11-13 17:33:27 +0000 (Fri, 13 Nov 2009) Log Message: ----------- Fix crash when calling WhatDoIHave() on a nested container. Modified Paths: -------------- trunk/Source/StructureMap/PipelineGraph.cs trunk/Source/StructureMap.Testing/Pipeline/NestedContainerSupportTester.cs trunk/Source/StructureMap.Testing/SpecificationExtensions.cs Modified: trunk/Source/StructureMap/PipelineGraph.cs =================================================================== --- trunk/Source/StructureMap/PipelineGraph.cs 2009-11-02 15:07:59 UTC (rev 273) +++ trunk/Source/StructureMap/PipelineGraph.cs 2009-11-13 17:33:27 UTC (rev 274) @@ -41,15 +41,16 @@ } } - private PipelineGraph(ProfileManager profileManager, GenericsPluginGraph genericsGraph) + private PipelineGraph(ProfileManager profileManager, GenericsPluginGraph genericsGraph, GraphLog log) { _profileManager = profileManager; _genericsGraph = genericsGraph; + _log = log; } public PipelineGraph Clone() { - var clone = new PipelineGraph(_profileManager.Clone(), _genericsGraph.Clone()) + var clone = new PipelineGraph(_profileManager.Clone(), _genericsGraph.Clone(), _log) { _missingFactory = _missingFactory }; Modified: trunk/Source/StructureMap.Testing/Pipeline/NestedContainerSupportTester.cs =================================================================== --- trunk/Source/StructureMap.Testing/Pipeline/NestedContainerSupportTester.cs 2009-11-02 15:07:59 UTC (rev 273) +++ trunk/Source/StructureMap.Testing/Pipeline/NestedContainerSupportTester.cs 2009-11-13 17:33:27 UTC (rev 274) @@ -1,7 +1,7 @@ using NUnit.Framework; using StructureMap.Attributes; -using StructureMap.Configuration.DSL; using StructureMap.Testing.GenericWidgets; +using StructureMap.Testing.Graph; using StructureMap.Testing.Widget; namespace StructureMap.Testing.Pipeline @@ -190,5 +190,17 @@ parentWidget.ShouldBeOfType<ColorWidget>().Color.ShouldEqual("red"); childWidget1.ShouldBeOfType<ColorWidget>().Color.ShouldEqual("green"); } + + [Test] + public void allow_nested_container_to_report_what_it_has() + { + var container = new Container(x => x.For<IAutomobile>().Use<Mustang>()); + + var nestedContainer = container.GetNestedContainer(); + nestedContainer.Inject<IEngine>(new PushrodEngine()); + + container.WhatDoIHave().ShouldNotBeEmpty().ShouldNotContain(typeof(IEngine).Name); + nestedContainer.WhatDoIHave().ShouldNotBeEmpty().ShouldContain(typeof(IEngine).Name); + } } } \ No newline at end of file Modified: trunk/Source/StructureMap.Testing/SpecificationExtensions.cs =================================================================== --- trunk/Source/StructureMap.Testing/SpecificationExtensions.cs 2009-11-02 15:07:59 UTC (rev 273) +++ trunk/Source/StructureMap.Testing/SpecificationExtensions.cs 2009-11-13 17:33:27 UTC (rev 274) @@ -106,9 +106,10 @@ Assert.IsNotEmpty(collection); } - public static void ShouldNotBeEmpty(this string aString) + public static string ShouldNotBeEmpty(this string aString) { Assert.IsNotEmpty(aString); + return aString; } public static void ShouldContain(this string actual, string expected) @@ -116,6 +117,12 @@ StringAssert.Contains(expected, actual); } + public static string ShouldNotContain(this string actual, string expected) + { + Assert.IsTrue(!actual.Contains(expected)); + return actual; + } + public static string ShouldBeEqualIgnoringCase(this string actual, string expected) { StringAssert.AreEqualIgnoringCase(expected, actual); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |