Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [TestMethod]
- public void AllRepositoriesShouldBeCreatableViaDependencyInjection()
- {
- // By doing this in parallel, we simultaneously test whether our
- // DI stuff can handle lots of multi-threaded requests.
- var repositoryTypes = from a in CoreAssemblies.AsParallel()
- from t in a.GetTypes()
- where t.Name.EndsWith("Repository")
- // Don't bother if they've been flagged as factory-built
- where !t.GetCustomAttributes(typeof (FactoryBuiltAttribute), false).Any()
- select t;
- repositoryTypes.ForAll(repositoryType =>
- {
- var repository = _kernel.Get(repositoryType);
- });
- }
Add Comment
Please, Sign In to add comment