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
At the core of the library is IFileSystem and FileSystem. Instead of calling methods like `File.ReadAllText` directly, use `IFileSystem.File.ReadAllText`. We have exactly the same API, except that ours is injectable and testable.
16
+
At the core of the library is `IFileSystem` and `FileSystem`. Instead of calling methods like `File.ReadAllText` directly, use `IFileSystem.File.ReadAllText`. We have exactly the same API, except that ours is injectable and testable.
17
17
18
18
```csharp
19
19
publicclassMyComponent
@@ -28,7 +28,7 @@ public class MyComponent
28
28
/// <summary>Create MyComponent</summary>
29
29
publicMyComponent() : this(
30
30
fileSystem: newFileSystem() //use default implementation which calls System.IO
31
-
)
31
+
)
32
32
{
33
33
}
34
34
@@ -74,81 +74,67 @@ public void MyComponent_Validate_ShouldThrowNotSupportedExceptionIfTestingIsNotA
74
74
Assert.Fail("The expected exception was not thrown.");
75
75
}
76
76
```
77
+
77
78
We even support casting from the .NET Framework's untestable types to our testable wrappers:
In version 4.0, the api introduces yet another layer of abstraction; instead of using abstract base classes (these still exist, though), things were changed to use interfaces instead.
94
-
95
-
Using these allows you to completely mock the file system using your mocking library of choice. Here's a small example (using Moq):
93
+
Since version 4.0 the top-level APIs expose interfaces instead of abstract base classes (these still exist, though), allowing you to completely mock the file system. Here's a small example, using [Moq](https://github.com/moq/moq4):
0 commit comments