Skip to content

Commit 55ceaf4

Browse files
committed
update docs
1 parent 0d7ae3b commit 55ceaf4

2 files changed

Lines changed: 64 additions & 16 deletions

File tree

README.md

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ What **eNhancedEdition** has to offer, that is not available in the NetArchTest
3838
* [Getting started](#getting-started)
3939
* [Examples](#examples)
4040
* [Writing rules](#writing-rules)
41-
* [Dependency search](#dependency-search)
41+
* [Rules for dependency analysis](#rules-for-dependency-analysis)
42+
* [Rules for assessing design and architectural principles](#rules-for-assessing-design-and-architectural-principles)
4243
* [Slices](#slices)
4344
* [Custom rules](#custom-rules)
4445
* [Options](#options)
@@ -128,7 +129,7 @@ public class SampleApp_ModuleOmega_Tests
128129

129130
The fluent API should direct you in building up a rule, based on a combination of [predicates](documentation/api.md#predicate), [conditions](documentation/api.md#condition) and conjunctions.
130131

131-
The starting point for any rule is the static [`Types`](documentation/api.md#types) class, where you load a set of types from a assembly, domain or patth.
132+
The starting point for any rule is the static [`Types`](documentation/api.md#types) class, where you load a set of types from an assembly, domain or path.
132133

133134
```csharp
134135
var types = Types.InAssembly(typeof(MyClass).Assembly);
@@ -144,9 +145,9 @@ types.That().ResideInNamespace("MyProject.Data").Should().BeSealed();
144145
Finally, you obtain a result from the rule by using an executor, i.e. use `GetTypes()` to return the types that match the rule or `GetResult()` to determine whether the rule has been met.
145146

146147
Note that `GetResult()` returns [`TestResult`](documentation/api.md#testresult) which contains a few lists of types:
147-
- `LoadedTypes` - all types loded by `Types`
148-
- `SelectedTypesForTesting` - types that passed predicates
149-
- `FailingTypes`- types that failed to meet the conditions
148+
- `LoadedTypes` - all types loded by [`Types`](documentation/api.md#types)
149+
- `SelectedTypesForTesting` - types that passed [predicates](documentation/api.md#predicate)
150+
- `FailingTypes`- types that failed to meet the [conditions](documentation/api.md#condition)
150151

151152
```csharp
152153
var result = types.That().ResideInNamespace("MyProject.Data").Should().BeSealed().GetResult();
@@ -155,7 +156,7 @@ var types = result.FailingTypes;
155156
```
156157

157158

158-
## Dependency search
159+
## Rules for dependency analysis
159160

160161
Dependency matrix:
161162

@@ -171,7 +172,7 @@ Dependency matrix:
171172
| h | x | x | x |
172173

173174

174-
Available rules:
175+
#### Dependency search:
175176

176177
| | Rule | number<br> of required<br> dependencies <br>from the list | type can have<br>a dependency<br>that is not<br>on the list | passing types | failing types |
177178
|---|---|---|---|---|---|
@@ -185,13 +186,36 @@ Available rules:
185186
Explnation why a type fails dependecy search test is available on the failing type: [IType.Explanation](documentation/api.md#itypeexplanation)
186187

187188

188-
### Reverse dependency search
189+
#### Reverse dependency search
189190

190191
| | Predicate | number<br> of required<br> dependencies <br>from the list | type can use<br>a type<br>that is not<br>on the list | passing types | failing types |
191192
|---|---|---|---|---|---|
192193
| R1 | [AreUsedByAny(c, d)](documentation/api.md#predicateareusedbyany) | at least 1 | yes | D2, D3 | D1 |
193194
| R1N | [AreNotUsedByAny(c, d)](documentation/api.md#predicatearenotusedbyany) | none | yes | D1 | D2, D3 |
194195

196+
197+
## Rules for assessing design and architectural principles
198+
199+
#### BeImmutable
200+
201+
A Type is considered as immutable when all its state (instance and static, fields, properties and events) cannot be changed after creation. Shallow immutability.
202+
203+
#### BeImmutableExternally
204+
205+
A Type is considered as externally immutable when its state (instance and static, fields, properties and events) with a public access modifier cannot be changed from the outside of the type. Shallow immutability.
206+
207+
#### BeStateless
208+
209+
A Type is considered as stateless when it does not have an instance state (fields, properties and events).
210+
211+
#### HaveSourceFileNameMatchingName
212+
213+
#### HaveSourceFilePathMatchingNamespace
214+
215+
#### HaveMatchingTypeWithName
216+
217+
218+
195219
## Slices
196220

197221
```csharp

documentation/readme.nt

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ What **eNhancedEdition** has to offer, that is not available in the NetArchTest
4141
* [Getting started](#getting-started)
4242
* [Examples](#examples)
4343
* [Writing rules](#writing-rules)
44-
* [Dependency search](#dependency-search)
44+
* [Rules for dependency analysis](#rules-for-dependency-analysis)
45+
* [Rules for assessing design and architectural principles](#rules-for-assessing-design-and-architectural-principles)
4546
* [Slices](#slices)
4647
* [Custom rules](#custom-rules)
4748
* [Options](#options)
@@ -79,7 +80,7 @@ The library is available as a package on NuGet: [NetArchTest.eNhancedEdition](ht
7980

8081
The fluent API should direct you in building up a rule, based on a combination of [predicates](documentation/api.md#predicate), [conditions](documentation/api.md#condition) and conjunctions.
8182

82-
The starting point for any rule is the static [`Types`](documentation/api.md#types) class, where you load a set of types from a assembly, domain or patth.
83+
The starting point for any rule is the static [`Types`](documentation/api.md#types) class, where you load a set of types from an assembly, domain or path.
8384

8485
```csharp
8586
var types = Types.InAssembly(typeof(MyClass).Assembly);
@@ -95,9 +96,9 @@ types.That().ResideInNamespace("MyProject.Data").Should().BeSealed();
9596
Finally, you obtain a result from the rule by using an executor, i.e. use `GetTypes()` to return the types that match the rule or `GetResult()` to determine whether the rule has been met.
9697

9798
Note that `GetResult()` returns [`TestResult`](documentation/api.md#testresult) which contains a few lists of types:
98-
- `LoadedTypes` - all types loded by `Types`
99-
- `SelectedTypesForTesting` - types that passed predicates
100-
- `FailingTypes`- types that failed to meet the conditions
99+
- `LoadedTypes` - all types loded by [`Types`](documentation/api.md#types)
100+
- `SelectedTypesForTesting` - types that passed [predicates](documentation/api.md#predicate)
101+
- `FailingTypes`- types that failed to meet the [conditions](documentation/api.md#condition)
101102

102103
```csharp
103104
var result = types.That().ResideInNamespace("MyProject.Data").Should().BeSealed().GetResult();
@@ -106,7 +107,7 @@ var types = result.FailingTypes;
106107
```
107108

108109

109-
## Dependency search
110+
## Rules for dependency analysis
110111

111112
Dependency matrix:
112113

@@ -122,7 +123,7 @@ Dependency matrix:
122123
| h | x | x | x |
123124

124125

125-
Available rules:
126+
#### Dependency search:
126127

127128
| | Rule | number<br> of required<br> dependencies <br>from the list | type can have<br>a dependency<br>that is not<br>on the list | passing types | failing types |
128129
|---|---|---|---|---|---|
@@ -136,13 +137,36 @@ Available rules:
136137
Explnation why a type fails dependecy search test is available on the failing type: [IType.Explanation](documentation/api.md#itypeexplanation)
137138

138139

139-
### Reverse dependency search
140+
#### Reverse dependency search
140141

141142
| | Predicate | number<br> of required<br> dependencies <br>from the list | type can use<br>a type<br>that is not<br>on the list | passing types | failing types |
142143
|---|---|---|---|---|---|
143144
| R1 | [AreUsedByAny(c, d)](documentation/api.md#predicateareusedbyany) | at least 1 | yes | D2, D3 | D1 |
144145
| R1N | [AreNotUsedByAny(c, d)](documentation/api.md#predicatearenotusedbyany) | none | yes | D1 | D2, D3 |
145146

147+
148+
## Rules for assessing design and architectural principles
149+
150+
#### BeImmutable
151+
152+
A Type is considered as immutable when all its state (instance and static, fields, properties and events) cannot be changed after creation. Shallow immutability.
153+
154+
#### BeImmutableExternally
155+
156+
A Type is considered as externally immutable when its state (instance and static, fields, properties and events) with a public access modifier cannot be changed from the outside of the type. Shallow immutability.
157+
158+
#### BeStateless
159+
160+
A Type is considered as stateless when it does not have an instance state (fields, properties and events).
161+
162+
#### HaveSourceFileNameMatchingName
163+
164+
#### HaveSourceFilePathMatchingNamespace
165+
166+
#### HaveMatchingTypeWithName
167+
168+
169+
146170
## Slices
147171

148172
```csharp

0 commit comments

Comments
 (0)