Using StructureMap, how do you explicitly trigger the reinstantiation of a object with InstanceScope
- by Mark Rogers
I have an integration test harness where I want to teardown and then re-instantiate some of the singleton-scoped objects I've registered with StructureMap, after and before each test.
This way I can simulate the actual run time environment, but not have the singleton's state being passed from one test to another. Maybe this isn't a great way to do an integration test, but I'm running out of alternative solutions (read open to any advice).
So can an object with InstanceScope.Singleton, be re-instantiated?
What's the best way to do re-instantiate a singleton-scoped object with StructureMap?