BenMorris / NetArchTest

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

Only check for sub namespace of a certain namespace and ignore the rest #106

Closed Velociraptor45 closed 2 years ago

Velociraptor45 commented 2 years ago

Hey there,

let's say I have a solution with dependencies like

How do I check if an assembly in that solution references the namespace MyNamespace.SubNamespace50 but not any of the others from MyNamespace? Now, I could use OnlyHaveDependenciesOn but then I'd have to list all the other dependencies apart from MyNamespace in there also (like System or Microsoft) - but I don't care about them. I only want to check for MyNamespace. NotHaveDependencyOn is also not an option because then I'd have to list all the gazillion sub namespaces. I couldn't find any Except method or something like that. Any idea on that?

NeVeSpl commented 2 years ago

You can only filter input types, that will be tested, there is no way to filter out dependencies (Except) in any way.

Velociraptor45 commented 2 years ago

Ah, damn. What a pity. Thanks for the answer.