Skip to content

Commit f41df1f

Browse files
authored
docs: added maintainer documentation with FileSystemWatcherMock (#928)
* docs: added maintainer documentation with FileSystemWatcherMock * docs: fixed spelling in Docs/FileSystemWatcherMock.md * docs: added link to FileSystemWatcherMock remarks
1 parent ce6a239 commit f41df1f

File tree

5 files changed

+89
-0
lines changed

5 files changed

+89
-0
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,7 @@ These can be enabled by explicitely running the [`Testably.Abstractions.TestSett
3535
All tests against the real file system. Per default, they are disabled in DEBUG mode.
3636

3737
*Note: These settings are stored locally in `test.settings.json` which is excluded in [`.gitignore`](https://github.com/Testably/Testably.Abstractions/blob/main/.gitignore) so that it only affects the individual developer!*
38+
39+
## Documentation
40+
To get a better understanding of the different mock implementations, see [Maintainer.md](./Docs/Maintainer.md).
41+
The document outlines the different behaviors the mocks replicate.

Docs/FileSystemWatcherMock.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# FileSystemWatcherMock
2+
3+
This document explains the implementation of the `FileSystemWatcherMock` class.
4+
5+
## Events
6+
7+
Before we can go into the different events the operating systems fire, we first have to define the locations the entry
8+
can be moved from and to.
9+
10+
| Location | Description |
11+
|----------|--------------------------------------------------------|
12+
| _ | Entry was created or deleted |
13+
| Outside | The location is outside the watching path |
14+
| Inside | The location is immediately inside the watching path |
15+
| Nested | The location is nested under the watching path |
16+
| Deep | The location is deeply nested inside the watching path |
17+
18+
For `IncludeSubdirectories = false` we have the following event table:
19+
20+
| From -> To | Linux | Windows | Mac |
21+
|-------------------|-----------|-----------|-----------|
22+
| _ -> Inside | `Created` | `Created` | `Created` |
23+
| Inside -> _ | `Deleted` | `Deleted` | `Deleted` |
24+
| _ -> Nested | - | - | - |
25+
| Nested -> _ | - | - | - |
26+
| _ -> Deep | - | - | - |
27+
| Deep -> _ | - | - | - |
28+
| Outside -> Inside | `Created` | `Created` | `Created` |
29+
| Inside -> Inside | `Renamed` | `Renamed` | `Renamed` |
30+
| Inside -> Outside | `Deleted` | `Deleted` | `Deleted` |
31+
| Outside -> Nested | - | - | - |
32+
| Nested -> Nested | - | - | - |
33+
| Nested -> Outside | - | - | - |
34+
| Outside -> Deep | - | - | - |
35+
| Deep -> Deep | - | - | - |
36+
| Deep -> Outside | - | - | - |
37+
| Inside -> Nested | `Deleted` | `Deleted` | `Renamed` |
38+
| Inside -> Deep | `Deleted` | `Deleted` | `Renamed` |
39+
| Nested -> Inside | `Created` | `Created` | `Created` |
40+
| Deep -> Inside | `Created` | `Created` | `Created` |
41+
| Nested -> Deep | - | - | - |
42+
| Deep -> Nested | - | - | - |
43+
44+
For `IncludeSubdirectories = true` we have the following event table:
45+
46+
| From -> To | Linux | Windows | Mac |
47+
|-------------------|-----------|-----------------------|-----------|
48+
| _ -> Inside | `Created` | `Created` | `Created` |
49+
| Inside -> _ | `Deleted` | `Deleted` | `Deleted` |
50+
| _ -> Nested | `Created` | `Created` | `Created` |
51+
| Nested -> _ | `Deleted` | `Deleted` | `Deleted` |
52+
| _ -> Deep | `Created` | `Created` | `Created` |
53+
| Deep -> _ | `Deleted` | `Deleted` | `Deleted` |
54+
| Outside -> Inside | `Created` | `Created` | `Created` |
55+
| Inside -> Inside | `Renamed` | `Renamed` | `Renamed` |
56+
| Inside -> Outside | `Deleted` | `Deleted` | `Deleted` |
57+
| Outside -> Nested | `Created` | `Created` | `Created` |
58+
| Nested -> Nested | `Renamed` | `Renamed` | `Renamed` |
59+
| Nested -> Outside | `Deleted` | `Deleted` | `Deleted` |
60+
| Outside -> Deep | `Created` | `Created` | `Created` |
61+
| Deep -> Deep | `Renamed` | `Renamed` | `Renamed` |
62+
| Deep -> Outside | `Deleted` | `Deleted` | `Deleted` |
63+
| Inside -> Nested | `Renamed` | `Deleted` + `Created` | `Renamed` |
64+
| Inside -> Deep | `Renamed` | `Deleted` + `Created` | `Renamed` |
65+
| Nested -> Inside | `Renamed` | `Deleted` + `Created` | `Renamed` |
66+
| Deep -> Inside | `Renamed` | `Deleted` + `Created` | `Renamed` |
67+
| Nested -> Deep | `Renamed` | `Deleted` + `Created` | `Renamed` |
68+
| Deep -> Nested | `Renamed` | `Deleted` + `Created` | `Renamed` |
69+

Docs/Maintainer.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Maintainer Documentation
2+
3+
This document provides different information about the internal workings of the mocks.
4+
Outlining complexities and design decisions.
5+
6+
## Implementations
7+
8+
- [FileSystemWatcherMock](FileSystemWatcherMock.md)

Source/Testably.Abstractions.Testing/FileSystem/FileSystemWatcherMock.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ namespace Testably.Abstractions.Testing.FileSystem;
1818
/// <summary>
1919
/// Mocked instance of a <see cref="IFileSystemWatcher" />
2020
/// </summary>
21+
/// <remarks>
22+
/// For more information about the implementation,
23+
/// see <see href="https://github.com/Testably/Testably.Abstractions/blob/main/Docs/FileSystemWatcherMock.md">_/Docs/FileSystemWatcherMock.md</see>
24+
/// </remarks>
2125
internal sealed class FileSystemWatcherMock : Component, IFileSystemWatcher
2226
{
2327
/// <summary>

Testably.Abstractions.sln

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ EndProject
6868
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testably.Abstractions.Compression.Tests", "Tests\Testably.Abstractions.Compression.Tests\Testably.Abstractions.Compression.Tests.csproj", "{5330AEEE-A915-4FF6-A85D-E9CCA161B654}"
6969
EndProject
7070
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{4D70CF83-2EEE-439E-AA30-3FADAACAEB0C}"
71+
ProjectSection(SolutionItems) = preProject
72+
Docs\FileSystemWatcherMock.md = Docs\FileSystemWatcherMock.md
73+
Docs\Maintainer.md = Docs\Maintainer.md
74+
EndProjectSection
7175
EndProject
7276
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Helpers", "Helpers", "{B6C45D8A-A545-402E-A6B0-47BC7D9BBCF5}"
7377
EndProject

0 commit comments

Comments
 (0)