TNG / ArchUnitNET

A C# architecture test library to specify and assert architecture rules in C# for automated testing.
Apache License 2.0
826 stars 55 forks source link

How to check package references? #192

Open ChangeTheCode opened 1 year ago

ChangeTheCode commented 1 year ago

Hi I have a question about the package references. I want to check that my project has only two references nuget packages. How can I write a test to garantiere this?

Has someone a code snipped for such a test?

MSinstein commented 1 year ago

Hi @ChangeTheCode ,

if you refer to the .csproj file when you say "my project" then I would assume that you need a different approach, e.g. parsing the file (it's XML) and assert it's content correspondingly in a unit test. The architecture tests operate on a compiled assembly, not on individual project(s).

ghost commented 5 months ago

So with ArchUnitNET you can test if nuget Types are used in forbidden layer?