BenMorris / NetArchTest

A fluent API for .Net that can enforce architectural rules in unit tests.
MIT License
1.41k stars 83 forks source link

Get types for whole solution? #132

Closed kristofferjalen closed 1 year ago

kristofferjalen commented 1 year ago

Let's say I have three projects in the same solution:

If I understand this correctly, invoking the Types.InCurrentDomain() method (with MSTest) in ArchitecturalTests will return only types in ArchitecturalTests. Thus, I have to use:

Can I get types from all projects at once?

NeVeSpl commented 1 year ago

It depends what are references between projects.

If ArchitecturalTests references ProjectA, and ProjectA references ProjectB, then all types should be available in the current domain. By reference I mean that exists at least one reference from one project to another in the compiled code (Assembly), not only on a project level.

NetArchTest does not have access to solution or even projects, it is why it operates on assemblies. NetAchTest can follow references between assemblies, but if there is not any reference between assemblies, there is no other way than explicitly providing assemblies in tests.

kristofferjalen commented 1 year ago

Thank you.