You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+40-4
Original file line number
Diff line number
Diff line change
@@ -65,7 +65,7 @@ public void StoreData_ShouldWriteValidFile()
65
65
66
66
## Getting Started
67
67
68
-
- Install `Testably.Abstractions` as nuget package in your productive projects and `Testably.Abstractions.Testing` as nuget package in your test projects.
68
+
- Install `Testably.Abstractions` as nuget package in your production projects and `Testably.Abstractions.Testing` as nuget package in your test projects.
69
69
```ps
70
70
dotnet add package Testably.Abstractions
71
71
dotnet add package Testably.Abstractions.Testing
@@ -82,11 +82,38 @@ public void StoreData_ShouldWriteValidFile()
82
82
**You can now use the interfaces in your services!**
83
83
84
84
## Testing
85
-
In order to simplify testing, the `Testably.Abstractions.Testing` project provides mocked instances for the abstraction interfaces:
85
+
In order to simplify testing, the `Testably.Abstractions.Testing` project provides mocked instances for the abstraction interfaces, which are configured using fluent syntax:
86
86
87
-
These mocks are configured using fluent syntax:
87
+
### Initialization
88
+
89
+
The following two code snippets initialize the mocked `fileSystem` with a structure like the following:
90
+
- Directory "foo"
91
+
- Directory "bar"
92
+
- Empty file "bar.txt"
93
+
- File "foo.txt" with "some file content" as content
Initializes the mocked file system with a second drive `D:` with 1MB total available space and creates on it an empty text file `foo.txt` and a directory `sub-dir` which contains randomly named json file with `{"count":1}` as file content.
126
+
127
+
On non-Windows systems, the main drive can still be configured, e.g.
128
+
```csharp
129
+
varfileSystem=newMockFileSystem();
130
+
fileSystem.WithDrive(d=>d.SetTotalSize(20));
131
+
132
+
// this will throw an IOException that there is not enough space on the disk.
133
+
fileSystem.File.WriteAllText("foo", "some text longer than 20 bytes");
0 commit comments