Skip to content

Commit

Permalink
Mention the simulation functionality in README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
vbreuss committed Apr 29, 2024
1 parent 669b1ca commit 1b2d8f8
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The testing helper also supports advanced scenarios like

The companion projects [Testably.Abstractions.Compression](https://www.nuget.org/packages/Testably.Abstractions.Compression) and [Testably.Abstractions.AccessControl](https://www.nuget.org/packages/Testably.Abstractions.AccessControl) allow working with [Zip-Files](Examples/ZipFile/README.md) and [Access Control Lists](Examples/AccessControlLists/README.md) respectively.

As the test suite runs both against the mocked and the real file system, the behaviour between the two is identical.
As the test suite runs both against the mocked and the real file system, the behaviour between the two is identical and it also allows [simulating the file system on other operating systems](#simulating-other-operating-systems) (Linux, MacOS and Windows).

In addition, the following interfaces are defined:
- The `ITimeSystem` interface abstracts away time-related functionality:
Expand Down Expand Up @@ -111,6 +111,25 @@ fileSystem.Initialize()
.WithFile("foo.txt").Which(f => f.HasStringContent("some file content"));
```

### Simulating other operating systems

The `MockFileSystem` can also simulate other operating systems than the one it is currently running on. This can be achieved, by providing the corresponding `SimulationMode` in the constructor:

```csharp
var linuxFileSystem = new MockFileSystem(o => o.SimulatingOperatingSystem(SimulationMode.Linux));
// The `linuxFileSystem` now behaves like a Linux file system even under Windows:
// - case-sensitive
// - slash as directory separator
var windowsFileSystem = new MockFileSystem(o => o.SimulatingOperatingSystem(SimulationMode.Windows));
// The `windowsFileSystem` now behaves like a Windows file system even under Linux or MacOS:
// - multiple drives
// - case-insensitive
// - backslash as directory separator
```

By running all tests against the real file system and the simulated under Linux, MacOS and Windows, the behaviour is consistent between the native and simulated mock file systems.

### Drive management
```csharp
var fileSystem = new MockFileSystem();
Expand Down

0 comments on commit 1b2d8f8

Please sign in to comment.