Guest User

Untitled

a guest
Jun 19th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. [TestMethod]
  2. public void AllRepositoriesShouldBeCreatableViaDependencyInjection()
  3. {
  4. // By doing this in parallel, we simultaneously test whether our
  5. // DI stuff can handle lots of multi-threaded requests.
  6. var repositoryTypes = from a in CoreAssemblies.AsParallel()
  7. from t in a.GetTypes()
  8. where t.Name.EndsWith("Repository")
  9. // Don't bother if they've been flagged as factory-built
  10. where !t.GetCustomAttributes(typeof (FactoryBuiltAttribute), false).Any()
  11. select t;
  12. repositoryTypes.ForAll(repositoryType =>
  13. {
  14. var repository = _kernel.Get(repositoryType);
  15. });
  16. }
Add Comment
Please, Sign In to add comment