diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 66fa8bcb..3e9af8f4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -35,3 +35,7 @@ These can be enabled by explicitely running the [`Testably.Abstractions.TestSett All tests against the real file system. Per default, they are disabled in DEBUG mode. *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!* + +## Documentation +To get a better understanding of the different mock implementations, see [Maintainer.md](./Docs/Maintainer.md). +The document outlines the different behaviors the mocks replicate. diff --git a/Docs/FileSystemWatcherMock.md b/Docs/FileSystemWatcherMock.md new file mode 100644 index 00000000..4dacb032 --- /dev/null +++ b/Docs/FileSystemWatcherMock.md @@ -0,0 +1,69 @@ +# FileSystemWatcherMock + +This document explains the implementation of the `FileSystemWatcherMock` class. + +## Events + +Before we can go into the different events the operating systems fire, we first have to define the locations the entry +can be moved from and to. + +| Location | Description | +|----------|--------------------------------------------------------| +| _ | Entry was created or deleted | +| Outside | The location is outside the watching path | +| Inside | The location is immediately inside the watching path | +| Nested | The location is nested under the watching path | +| Deep | The location is deeply nested inside the watching path | + +For `IncludeSubdirectories = false` we have the following event table: + +| From -> To | Linux | Windows | Mac | +|-------------------|-----------|-----------|-----------| +| _ -> Inside | `Created` | `Created` | `Created` | +| Inside -> _ | `Deleted` | `Deleted` | `Deleted` | +| _ -> Nested | - | - | - | +| Nested -> _ | - | - | - | +| _ -> Deep | - | - | - | +| Deep -> _ | - | - | - | +| Outside -> Inside | `Created` | `Created` | `Created` | +| Inside -> Inside | `Renamed` | `Renamed` | `Renamed` | +| Inside -> Outside | `Deleted` | `Deleted` | `Deleted` | +| Outside -> Nested | - | - | - | +| Nested -> Nested | - | - | - | +| Nested -> Outside | - | - | - | +| Outside -> Deep | - | - | - | +| Deep -> Deep | - | - | - | +| Deep -> Outside | - | - | - | +| Inside -> Nested | `Deleted` | `Deleted` | `Renamed` | +| Inside -> Deep | `Deleted` | `Deleted` | `Renamed` | +| Nested -> Inside | `Created` | `Created` | `Created` | +| Deep -> Inside | `Created` | `Created` | `Created` | +| Nested -> Deep | - | - | - | +| Deep -> Nested | - | - | - | + +For `IncludeSubdirectories = true` we have the following event table: + +| From -> To | Linux | Windows | Mac | +|-------------------|-----------|-----------------------|-----------| +| _ -> Inside | `Created` | `Created` | `Created` | +| Inside -> _ | `Deleted` | `Deleted` | `Deleted` | +| _ -> Nested | `Created` | `Created` | `Created` | +| Nested -> _ | `Deleted` | `Deleted` | `Deleted` | +| _ -> Deep | `Created` | `Created` | `Created` | +| Deep -> _ | `Deleted` | `Deleted` | `Deleted` | +| Outside -> Inside | `Created` | `Created` | `Created` | +| Inside -> Inside | `Renamed` | `Renamed` | `Renamed` | +| Inside -> Outside | `Deleted` | `Deleted` | `Deleted` | +| Outside -> Nested | `Created` | `Created` | `Created` | +| Nested -> Nested | `Renamed` | `Renamed` | `Renamed` | +| Nested -> Outside | `Deleted` | `Deleted` | `Deleted` | +| Outside -> Deep | `Created` | `Created` | `Created` | +| Deep -> Deep | `Renamed` | `Renamed` | `Renamed` | +| Deep -> Outside | `Deleted` | `Deleted` | `Deleted` | +| Inside -> Nested | `Renamed` | `Deleted` + `Created` | `Renamed` | +| Inside -> Deep | `Renamed` | `Deleted` + `Created` | `Renamed` | +| Nested -> Inside | `Renamed` | `Deleted` + `Created` | `Renamed` | +| Deep -> Inside | `Renamed` | `Deleted` + `Created` | `Renamed` | +| Nested -> Deep | `Renamed` | `Deleted` + `Created` | `Renamed` | +| Deep -> Nested | `Renamed` | `Deleted` + `Created` | `Renamed` | + diff --git a/Docs/Maintainer.md b/Docs/Maintainer.md new file mode 100644 index 00000000..2e5eec07 --- /dev/null +++ b/Docs/Maintainer.md @@ -0,0 +1,8 @@ +# Maintainer Documentation + +This document provides different information about the internal workings of the mocks. +Outlining complexities and design decisions. + +## Implementations + +- [FileSystemWatcherMock](FileSystemWatcherMock.md) diff --git a/Source/Testably.Abstractions.Testing/FileSystem/FileSystemWatcherMock.cs b/Source/Testably.Abstractions.Testing/FileSystem/FileSystemWatcherMock.cs index cd59c194..c1b8ed50 100644 --- a/Source/Testably.Abstractions.Testing/FileSystem/FileSystemWatcherMock.cs +++ b/Source/Testably.Abstractions.Testing/FileSystem/FileSystemWatcherMock.cs @@ -18,6 +18,10 @@ namespace Testably.Abstractions.Testing.FileSystem; /// /// Mocked instance of a /// +/// +/// For more information about the implementation, +/// see _/Docs/FileSystemWatcherMock.md +/// internal sealed class FileSystemWatcherMock : Component, IFileSystemWatcher { /// diff --git a/Testably.Abstractions.sln b/Testably.Abstractions.sln index 946691a2..f9f03a95 100644 --- a/Testably.Abstractions.sln +++ b/Testably.Abstractions.sln @@ -68,6 +68,10 @@ EndProject 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}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{4D70CF83-2EEE-439E-AA30-3FADAACAEB0C}" + ProjectSection(SolutionItems) = preProject + Docs\FileSystemWatcherMock.md = Docs\FileSystemWatcherMock.md + Docs\Maintainer.md = Docs\Maintainer.md + EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Helpers", "Helpers", "{B6C45D8A-A545-402E-A6B0-47BC7D9BBCF5}" EndProject