Created
June 7, 2011 22:59
-
-
Save emiaj/1013390 to your computer and use it in GitHub Desktop.
NestedContainer & ExplicitArguments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using NUnit.Framework; | |
| using StructureMap; | |
| using StructureMap.Pipeline; | |
| [TestFixture] | |
| public class ProofOfConcept | |
| { | |
| [Test] | |
| public void smoke() | |
| { | |
| var container = new Container(); | |
| var args = new ExplicitArguments(); | |
| using(var nested = container.GetNestedContainer()) | |
| { | |
| var p1 = nested.GetInstance<Product>(); | |
| var p2 = nested.GetInstance<Product>(); | |
| p1.ShouldBeTheSameAs(p2); // Pass | |
| var p3 = nested.GetInstance<Product>(args); | |
| var p4 = nested.GetInstance<Product>(args); | |
| p3.ShouldBeTheSameAs(p4); // Fails | |
| } | |
| } | |
| public class Product | |
| {} | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment