Consider the following assemblies, where each of them are having a marker interface:
Api (IApiMarker)
Infrastructure (IInfrastructureMarker)
Application (IApplicationMarker)
Domain (IDomainMarker)
SharedKernel (ISharedKernelMarker)
... and further the following references:
Api has a reference to Infrastructure
Infrastructure has a reference to Application
Application has a reference to Domain and SharedKernel
Domain has a reference to SharedKernel
SharedKernel doesn't have any references
Now, I'd like to make sure, that these references stay in place and that dependencies only flow inwards (clean architecture).
I therefore created a test, let's call it ArchTest which references Api.
Now I'd like to ensure, that domain holds a reference to sharedkernel... (not sure if this test makes much sense...) But, why is the following test failing even so Domain has a reference to SharedKernel?
[Fact]
public void Domain_should_have_reference_to_shared_kernel()
{
var domain = typeof(IDomainMarker).Assembly;
var sharedKernel = typeof(ISharedKernelMarker).Assembly;
var result = Types.InAssembly(domain)
.Should()
.HaveDependencyOn(sharedKernel.GetName().Name)
.GetResult();
result.IsSuccessful.ShouldBeTrue();
}
P.S: Using NetArchTest.Rules v1.3.2
Consider the following assemblies, where each of them are having a marker interface:
Api(IApiMarker)Infrastructure(IInfrastructureMarker)Application(IApplicationMarker)Domain(IDomainMarker)SharedKernel(ISharedKernelMarker)... and further the following references:
Apihas a reference toInfrastructureInfrastructurehas a reference toApplicationApplicationhas a reference toDomainandSharedKernelDomainhas a reference toSharedKernelSharedKerneldoesn't have any referencesNow, I'd like to make sure, that these references stay in place and that dependencies only flow inwards (clean architecture).
I therefore created a test, let's call it
ArchTestwhich referencesApi.Now I'd like to ensure, that
domainholds a reference tosharedkernel... (not sure if this test makes much sense...) But, why is the following test failing even soDomainhas a reference toSharedKernel?P.S: Using
NetArchTest.Rules v1.3.2