Skip to content

Commit e24f466

Browse files
committed
update readme
1 parent 7ea3b4a commit e24f466

1 file changed

Lines changed: 32 additions & 17 deletions

File tree

README.md

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)