Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
DisposesInReverseOrderOfCreation Specification Test Expects Eager Enumerable #589
I'm updating the Rezolver IOC Container to implement the 2.0 DependencyInjection spec (1.1 implementation is currently stable) and the test
For completeness - this is the test from the tag rel/2.0.0 (the test is the same in the current version):
When I look at the stack trace of the failure - it's because my scope is failing to resolve an object because the scope has already been disposed:
On closer inspection I've realised it's because Rezolver creates lazy enumerables by default. This means that on line 681, the enumerable produced by the call
Rezolver supports both eager and lazy-loaded enumerables (and can be conffigured for either per-type) - so I can change the implementation to switch to eager enumerables for its implementation of the MS DI abstraction, but it seems to me that this test is assuming a behaviour that is not specifically being tested - and, in the strictest sense, is unrealistic: if an
Indeed, if that is indeed an expectation - say, in the way Asp.Net or other components use a DI Container via this abstraction, then there should be an explicit test which resolves an enumerable from the container and checks that all the expected instances are already created before enumeration takes place.
So I'm a bit lost at the minute - I see a couple of ways forward:
Thanks in advance.