TNG / ArchUnitNET

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

Assemblies as a Syntax element #130

Open MrLuxyfer opened 3 years ago

MrLuxyfer commented 3 years ago

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.");
fgather commented 2 years ago

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

gaevoy commented 2 years ago

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

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

JobaDiniz commented 1 year ago

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