File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,23 +15,38 @@ The library is available as a package on NuGet: [NetArchTest.eNhancedEdition](ht
1515## Examples
1616
1717``` csharp
18- // Classes in the presentation should not directly reference repositories
19- var result = Types .InCurrentDomain ()
20- .That ()
21- .ResideInNamespace (" NetArchTest.SampleLibrary.Presentation" )
22- .ShouldNot ()
23- .HaveDependencyOnAny (" NetArchTest.SampleLibrary.Data" )
24- .GetResult ()
25- .IsSuccessful ;
26-
27- // All the service classes should be sealed
28- var result = Types .InCurrentDomain ()
29- .That ()
30- .ImplementInterface (typeof (IWidgetService ))
31- .Should ()
32- .BeSealed ()
33- .GetResult ()
34- .IsSuccessful ;
18+ static readonly Assembly TestCreationAssembly = typeof (Foo ).Assembly ;
19+
20+ [TestMethod ]
21+ public void DomainIsNotAccessibleFromOutsideOfModule ()
22+ {
23+ var result = Types .InAssembly (AssemblyUnderTest )
24+ .That ()
25+ .ResideInNamespace (" MyApp.Domain" )
26+ .And ()
27+ .DoNotHaveNameEndingWith (" Const" )
28+ .Should ()
29+ .NotBePublic ()
30+ .GetResult ();
31+ Assert .IsTrue (result .IsSuccessful );
32+ }
33+
34+ [TestMethod ]
35+ public void DomainIsIndependent ()
36+ {
37+ var result = Types .InAssembly (AssemblyUnderTest )
38+ .That ()
39+ .ResideInNamespace (" MyApp.Domain" )
40+ .ShouldNot ()
41+ .HaveDependenciesOtherThan (
42+ " System" ,
43+ " MyApp.SharedKernel.Domain" ,
44+ " MyApp.BuildingBlocks.Domain"
45+ )
46+ .GetResult ();
47+
48+ Assert .IsTrue (result .IsSuccessful , " Domain has lost its independence!" );
49+ }
3550```
3651
3752
You can’t perform that action at this time.
0 commit comments