ArchUnitNET icon indicating copy to clipboard operation
ArchUnitNET copied to clipboard

Assemblies as a Syntax element

Open LilBulb1337 opened this issue 4 years ago • 3 comments

It would be nice to be able to write Rules like Assemblies().That().Rererence(...)

You can do that with types but then you can have the assembly reference and the test will not fail if no type is used.

private static bool IsInTestAssembly(IType type) => type.Assembly.Attributes.Any(a => a.Name == nameof(TestAssemblyAttribute));

private static IObjectProvider<IType> TypesResidingingInTestAssemblies = Types().That().FollowCustomPredicate(IsInTestAssembly, "Are in test assembly.");

LilBulb1337 avatar Oct 18 '21 12:10 LilBulb1337

Hi @DialLuesebrink , sounds like a good idea. Would you like to create a PR?

fgather avatar Jan 14 '22 14:01 fgather

@DialLuesebrink, check out an alternative option to verify dependencies.

https://gaevoy.com/2022/05/19/review-dependencies-on-every-commit.html

gaevoy avatar May 20 '22 12:05 gaevoy

@gaevoy this looks promising, how about integrating it into the ArchUnitNET project?

JobaDiniz avatar Oct 26 '23 18:10 JobaDiniz