TNG / ArchUnitNET

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

`ResideInAssembly` should not match the fully qualified name #290

Open alexanderlinne opened 3 months ago

alexanderlinne commented 3 months ago

When using

Types()
    .That()
    …
    .Should()
    .OnlyDependOn(Types().That().ResideInAssembly("System.Console"))
    .Check(Architecture);

This does currently not work, because ResideInAssembly matches the fully qualified name like System.Console, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. This is unexpected, the condition should instead only match the name of the assembly.

fgather commented 2 months ago

You are correct, for most use-cases this would be the expected way. However in those set-ups: https://github.com/TNG/ArchUnitNET/issues/292 🤔

alexanderlinne commented 2 months ago

Ideally this would build upon #130 with a syntax like Types().That().ResideInAssembliesThat().HaveName(…) or Types().That().ResideInAssembliesThat().HaveFullName(…). That would also make it more clear what part of the name we are matching when reading the code of a test.