Skip to content

Commit 11369b1

Browse files
committed
update docs
1 parent 6d7cfe5 commit 11369b1

File tree

3 files changed

+70
-14
lines changed

3 files changed

+70
-14
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,9 @@ Assert.True(result.IsSuccessful);
297297
```
298298

299299
Available options:
300-
- [Comparer](documentation/api.md#optionscomparer) - allows to specify how strings will be compared (right now it only affects: Predicate.HaveName, Predicate.HaveNameStartingWith, Predicate.HaveNameEndingWith)
300+
- [Comparer](documentation/api.md#optionscomparer) - allows to specify how strings will be compared, default: InvariantCultureIgnoreCase (it only affects: Predicate.HaveName, Predicate.HaveNameStartingWith, Predicate.HaveNameEndingWith)
301301

302+
- [SerachForDependencyInFieldConstant](documentation/api.md#optionsserachfordependencyinfieldconstant) - determines if dependency analysis should look for dependency in string field constant, default: false
302303

303304
## Limitations
304305

documentation/api.md

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@
8888
* [HaveNameEndingWith](#PredicateHaveNameEndingWith)
8989
* [HaveNameMatching](#PredicateHaveNameMatching)
9090
* [HaveNameStartingWith](#PredicateHaveNameStartingWith)
91+
* [HaveNumberOfLinesOfCodeGreaterThan](#PredicateHaveNumberOfLinesOfCodeGreaterThan)
92+
* [HaveNumberOfLinesOfCodeLowerThan](#PredicateHaveNumberOfLinesOfCodeLowerThan)
9193
* [HaveParameterlessConstructor](#PredicateHaveParameterlessConstructor)
9294
* [HavePublicConstructor](#PredicateHavePublicConstructor)
9395
* [HaveSomeNonNullableMembers](#PredicateHaveSomeNonNullableMembers)
@@ -97,6 +99,8 @@
9799
* [Inherit<T>](#PredicateInherit)
98100
* [MeetCustomRule](#PredicateMeetCustomRule)
99101
* [MeetCustomRule](#PredicateMeetCustomRule)
102+
* [MeetCustomRule](#PredicateMeetCustomRule)
103+
* [MeetCustomRule](#PredicateMeetCustomRule)
100104
* [OnlyHaveDependencyOn](#PredicateOnlyHaveDependencyOn)
101105
* [OnlyHaveNonNullableMembers](#PredicateOnlyHaveNonNullableMembers)
102106
* [OnlyHaveNullableMembers](#PredicateOnlyHaveNullableMembers)
@@ -151,6 +155,8 @@
151155
* [HaveNameEndingWith](#ConditionHaveNameEndingWith)
152156
* [HaveNameMatching](#ConditionHaveNameMatching)
153157
* [HaveNameStartingWith](#ConditionHaveNameStartingWith)
158+
* [HaveNumberOfLinesOfCodeGreaterThan](#ConditionHaveNumberOfLinesOfCodeGreaterThan)
159+
* [HaveNumberOfLinesOfCodeLowerThan](#ConditionHaveNumberOfLinesOfCodeLowerThan)
154160
* [HaveParameterlessConstructor](#ConditionHaveParameterlessConstructor)
155161
* [HavePublicConstructor](#ConditionHavePublicConstructor)
156162
* [HaveSomeNonNullableMembers](#ConditionHaveSomeNonNullableMembers)
@@ -162,6 +168,8 @@
162168
* [Inherit<T>](#ConditionInherit)
163169
* [MeetCustomRule](#ConditionMeetCustomRule)
164170
* [MeetCustomRule](#ConditionMeetCustomRule)
171+
* [MeetCustomRule](#ConditionMeetCustomRule)
172+
* [MeetCustomRule](#ConditionMeetCustomRule)
165173
* [NotBeAbstract](#ConditionNotBeAbstract)
166174
* [NotBeClasses](#ConditionNotBeClasses)
167175
* [NotBeDelegates](#ConditionNotBeDelegates)
@@ -238,6 +246,7 @@
238246
## Options
239247

240248
* [Comparer](#OptionsComparer)
249+
* [SerachForDependencyInFieldConstant](#OptionsSerachForDependencyInFieldConstant)
241250

242251
## Types
243252
### Types.FromFile
@@ -662,6 +671,16 @@ Selects types according to a regular expression matching their name.
662671
PredicateList Predicate.HaveNameStartingWith(params string[] start)
663672
```
664673
Selects types whose names start with the specified text.
674+
### Predicate.HaveNumberOfLinesOfCodeGreaterThan
675+
```csharp
676+
PredicateList Predicate.HaveNumberOfLinesOfCodeGreaterThan(int number)
677+
```
678+
Selects types that have more logical lines of code than a given number
679+
### Predicate.HaveNumberOfLinesOfCodeLowerThan
680+
```csharp
681+
PredicateList Predicate.HaveNumberOfLinesOfCodeLowerThan(int number)
682+
```
683+
Selects types that have fewer logical lines of code than a given number
665684
### Predicate.HaveParameterlessConstructor
666685
```csharp
667686
PredicateList Predicate.HaveParameterlessConstructor()
@@ -707,6 +726,16 @@ Selects types that meet a custom rule.
707726
PredicateList Predicate.MeetCustomRule(Func<TypeDefinition, bool> rule)
708727
```
709728
Selects types that meet a custom rule.
729+
### Predicate.MeetCustomRule
730+
```csharp
731+
PredicateList Predicate.MeetCustomRule(ICustomRule2 rule)
732+
```
733+
Selects types that meet a custom rule.
734+
### Predicate.MeetCustomRule
735+
```csharp
736+
PredicateList Predicate.MeetCustomRule(Func<TypeDefinition, CustomRuleResult> rule)
737+
```
738+
Selects types that meet a custom rule.
710739
### Predicate.OnlyHaveDependencyOn
711740
```csharp
712741
PredicateList Predicate.OnlyHaveDependencyOn(params string[] dependencies)
@@ -951,6 +980,16 @@ Selects types according to a regular expression matching their name.
951980
ConditionList Condition.HaveNameStartingWith(string start)
952981
```
953982
Selects types whose names start with the specified text.
983+
### Condition.HaveNumberOfLinesOfCodeGreaterThan
984+
```csharp
985+
ConditionList Condition.HaveNumberOfLinesOfCodeGreaterThan(int number)
986+
```
987+
Selects types that have more logical lines of code than a given number
988+
### Condition.HaveNumberOfLinesOfCodeLowerThan
989+
```csharp
990+
ConditionList Condition.HaveNumberOfLinesOfCodeLowerThan(int number)
991+
```
992+
Selects types that have fewer logical lines of code than a given number
954993
### Condition.HaveParameterlessConstructor
955994
```csharp
956995
ConditionList Condition.HaveParameterlessConstructor()
@@ -1006,6 +1045,16 @@ Selects types that meet a custom rule.
10061045
ConditionList Condition.MeetCustomRule(Func<TypeDefinition, bool> rule)
10071046
```
10081047
Selects types that meet a custom rule.
1048+
### Condition.MeetCustomRule
1049+
```csharp
1050+
ConditionList Condition.MeetCustomRule(ICustomRule2 rule)
1051+
```
1052+
Selects types that meet a custom rule.
1053+
### Condition.MeetCustomRule
1054+
```csharp
1055+
ConditionList Condition.MeetCustomRule(Func<TypeDefinition, CustomRuleResult> rule)
1056+
```
1057+
Selects types that meet a custom rule.
10091058
### Condition.NotBeAbstract
10101059
```csharp
10111060
ConditionList Condition.NotBeAbstract()
@@ -1320,7 +1369,12 @@ FullName of the assembly
13201369
```csharp
13211370
Comparer
13221371
```
1323-
1372+
Allows to specify how strings will be compared, default: InvariantCultureIgnoreCase
1373+
### Options.SerachForDependencyInFieldConstant
1374+
```csharp
1375+
SerachForDependencyInFieldConstant
1376+
```
1377+
Determines if dependency analysis should look for dependency in string field constant, default: false
13241378

13251379

13261380

documentation/readme.nt

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ NetArchTest.eNhancedEdition is based on [NetArchTest v1.3.2](https://github.com/
1212

1313
### Rationale
1414

15-
NetArchTest is well established mature library, but in order to push things forward, a few breaking changes had to be made, and that is how **eNhancedEdition** was born. eNhancedEdition uses almost identical Fluent API as a base library, but it is not 100% backward compatible, and it will never be.
15+
NetArchTest is a well-established mature library, but to push things forward, a few breaking changes had to be made, and that is how **eNhancedEdition** was born. eNhancedEdition uses almost identical Fluent API as a base library, but it is not 100% backwards compatible, and it will never be.
1616

1717
What **eNhancedEdition** has to offer, that is not available in the NetArchTest v1.3.2:
18-
- fixed all know bugs present in v1.3.2 :
18+
- fixed all known bugs present in v1.3.2 :
1919
- BenMorris/NetArchTest#98,
2020
- BenMorris/NetArchTest#101,
2121
- BenMorris/NetArchTest#120,
@@ -33,11 +33,11 @@ What **eNhancedEdition** has to offer, that is not available in the NetArchTest
3333
- BenMorris/NetArchTest#126 - added rules for structs, enums and delegates
3434
- BenMorris/NetArchTest#131 - added rules for all access modifiers: public, internal, private, protected, private protected, protected internal
3535
- BenMorris/NetArchTest#133 - added rules: AreInheritedByAnyType, AreNotInheritedByAnyType
36-
- added rules : AreUsedByAny, AreNotUsedByAny
36+
- added rules: AreUsedByAny, AreNotUsedByAny
3737
- at the end, you get more information which should make reasoning about tests easier:
3838

3939

40-
![revit-database-scripting-update-query](documentation/result.printscreen.png)
40+
![revit-database-scripting-update-query](https://raw.githubusercontent.com/NeVeSpl/NetArchTest.eNhancedEdition/main/documentation/result.printscreen.png)
4141

4242

4343

@@ -94,14 +94,14 @@ Once you have loaded the types, you can filter them using one or more predicates
9494
```csharp
9595
types.That().ResideInNamespace("MyProject.Data");
9696
```
97-
Once the set of types have been filtered, you can apply a set of conditions using the `Should()` or `ShouldNot()` methods, e.g.
97+
Once the set of types has been filtered, you can apply a set of conditions using the `Should()` or `ShouldNot()` methods, e.g.
9898
```csharp
9999
types.That().ResideInNamespace("MyProject.Data").Should().BeSealed();
100100
```
101101
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.
102102

103103
Note that `GetResult()` returns [`TestResult`](documentation/api.md#testresult) which contains a few lists of types:
104-
- `LoadedTypes` - all types loded by [`Types`](documentation/api.md#types)
104+
- `LoadedTypes` - all types loaded by [`Types`](documentation/api.md#types)
105105
- `SelectedTypesForTesting` - types that passed [predicates](documentation/api.md#predicate)
106106
- `FailingTypes`- types that failed to meet the [conditions](documentation/api.md#condition)
107107

@@ -141,7 +141,7 @@ Dependency matrix:
141141
| 2N | [NotHaveDependencyOnAll(D1, D2)](documentation/api.md#conditionnothavedependencyonall) | not all | yes | a, b, c, d, e, f | g, h |
142142
| 3N | [HaveDependencyOtherThan(D1, D2)](documentation/api.md#conditionhavedependencyotherthan) | >=0 | yes | b, d, f, h, | a, c, e, g |
143143

144-
Explnation why a type fails dependecy search test is available on the failing type: [IType.Explanation](documentation/api.md#itypeexplanation)
144+
An explanation of why a type fails the dependency search test is available on the failing type: [IType.Explanation](documentation/api.md#itypeexplanation)
145145

146146

147147
#### Reverse dependency search
@@ -200,14 +200,14 @@ var result = Types.InAssembly(typeof(ExampleDependency).Assembly)
200200

201201
There is only one way, at least for now, to divide types into slices `ByNamespacePrefix(string prefix)` and it works as follows:
202202

203-
1) Selects types which namespace starts with a given prefix, rest of the types are ignored.
203+
1) Select types which namespace starts with a given prefix, rest of the types are ignored.
204204
2) Slices are defined by the first part of the namespace that comes right after the prefix:
205205
`namespacePrefix.(sliceName).restOfNamespace`
206-
3) Types with the same `sliceName` part will be placed in the same slice. If `sliceName` is empty for a given type, the type will be also ignored (`BaseFeature` class from folowing image)
206+
3) Types with the same `sliceName` part will be placed in the same slice. If `sliceName` is empty for a given type, the type will also be ignored (`BaseFeature` class from the following image)
207207

208208
![Slices](https://raw.githubusercontent.com/NeVeSpl/NetArchTest.eNhancedEdition/main/documentation/slices/slices.png)
209209

210-
When we already have our types divided into slices, we can apply condition: `NotHaveDependenciesBetweenSlices()`. As the name suggest it detects if any dependency exists between slices. Dependency from slice to type that is not part of any other slice is allowed.
210+
When our types are divided into slices, we can apply the condition: `NotHaveDependenciesBetweenSlices()`. As the name suggests it detects if any dependency exists between slices. Dependency from slice to type that is not part of any other slice is allowed.
211211

212212
passing | failing
213213
--|---
@@ -248,12 +248,13 @@ Assert.True(result.IsSuccessful);
248248
```
249249

250250
Available options:
251-
- [Comparer](documentation/api.md#optionscomparer) - allows to specify how strings will be compared (right now it only affects: Predicate.HaveName, Predicate.HaveNameStartingWith, Predicate.HaveNameEndingWith)
251+
- [Comparer](documentation/api.md#optionscomparer) - allows to specify how strings will be compared, default: InvariantCultureIgnoreCase (it only affects: Predicate.HaveName, Predicate.HaveNameStartingWith, Predicate.HaveNameEndingWith)
252252

253+
- [SerachForDependencyInFieldConstant](documentation/api.md#optionsserachfordependencyinfieldconstant) - determines if dependency analysis should look for dependency in string field constant, default: false
253254

254255
## Limitations
255256

256-
NetArchTest is build on top of [jbevain/cecil](https://github.com/jbevain/cecil) thus it works on CLI level. Unfortunately not every feature of C# language is represented in CLI, thus some things will never be available in NetArchTest, e.g.:
257+
NetArchTest is built on top of [jbevain/cecil](https://github.com/jbevain/cecil) thus it works on CIL level. Unfortunately, not every feature of C# language is represented in CIL, thus some things will never be available in NetArchTest, e.g.:
257258
- BenMorris/NetArchTest#81 - NetArchTest ignores a nameof expression
258259

259260
{{

0 commit comments

Comments
 (0)