Skip to content

Instantly share code, notes, and snippets.

@emiaj
Created June 7, 2011 22:59
Show Gist options
  • Select an option

  • Save emiaj/1013390 to your computer and use it in GitHub Desktop.

Select an option

Save emiaj/1013390 to your computer and use it in GitHub Desktop.
NestedContainer & ExplicitArguments
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