@@ -5,7 +5,8 @@ namespace Testably.Abstractions.Compression.Tests.Internal;
55public sealed class ExecuteTests
66{
77 [ Fact ]
8- public async Task WhenRealFileSystem_MockFileSystem_WithActionCallback_ShouldExecuteOnMockFileSystem ( )
8+ public async Task
9+ WhenRealFileSystem_MockFileSystem_WithActionCallback_ShouldExecuteOnMockFileSystem ( )
910 {
1011 bool onRealFileSystemExecuted = false ;
1112 bool onMockFileSystemExecuted = false ;
@@ -25,7 +26,8 @@ public async Task WhenRealFileSystem_MockFileSystem_WithActionCallback_ShouldExe
2526 }
2627
2728 [ Fact ]
28- public async Task WhenRealFileSystem_MockFileSystem_WithFuncCallback_ShouldExecuteOnMockFileSystem ( )
29+ public async Task
30+ WhenRealFileSystem_MockFileSystem_WithFuncCallback_ShouldExecuteOnMockFileSystem ( )
2931 {
3032 bool onRealFileSystemExecuted = false ;
3133 bool onMockFileSystemExecuted = false ;
@@ -45,7 +47,8 @@ public async Task WhenRealFileSystem_MockFileSystem_WithFuncCallback_ShouldExecu
4547 }
4648
4749 [ Fact ]
48- public async Task WhenRealFileSystem_RealFileSystem_WithActionCallback_ShouldExecuteOnRealFileSystem ( )
50+ public async Task
51+ WhenRealFileSystem_RealFileSystem_WithActionCallback_ShouldExecuteOnRealFileSystem ( )
4952 {
5053 bool onRealFileSystemExecuted = false ;
5154 bool onMockFileSystemExecuted = false ;
@@ -65,7 +68,8 @@ public async Task WhenRealFileSystem_RealFileSystem_WithActionCallback_ShouldExe
6568 }
6669
6770 [ Fact ]
68- public async Task WhenRealFileSystem_RealFileSystem_WithFuncCallback_ShouldExecuteOnRealFileSystem ( )
71+ public async Task
72+ WhenRealFileSystem_RealFileSystem_WithFuncCallback_ShouldExecuteOnRealFileSystem ( )
6973 {
7074 bool onRealFileSystemExecuted = false ;
7175 bool onMockFileSystemExecuted = false ;
@@ -83,4 +87,92 @@ public async Task WhenRealFileSystem_RealFileSystem_WithFuncCallback_ShouldExecu
8387 await That ( onRealFileSystemExecuted ) . IsTrue ( ) ;
8488 await That ( onMockFileSystemExecuted ) . IsFalse ( ) ;
8589 }
90+
91+ [ Fact ]
92+ public async Task
93+ WhenRealFileSystemAsync_MockFileSystem_WithActionCallback_ShouldExecuteOnMockFileSystem ( )
94+ {
95+ bool onRealFileSystemExecuted = false ;
96+ bool onMockFileSystemExecuted = false ;
97+ MockFileSystem fileSystem = new ( ) ;
98+ await Execute . WhenRealFileSystemAsync ( fileSystem ,
99+ ( ) =>
100+ {
101+ onRealFileSystemExecuted = true ;
102+ return Task . CompletedTask ;
103+ } ,
104+ ( ) =>
105+ {
106+ onMockFileSystemExecuted = true ;
107+ } ) ;
108+
109+ await That ( onRealFileSystemExecuted ) . IsFalse ( ) ;
110+ await That ( onMockFileSystemExecuted ) . IsTrue ( ) ;
111+ }
112+
113+ [ Fact ]
114+ public async Task
115+ WhenRealFileSystemAsync_MockFileSystem_WithFuncCallback_ShouldExecuteOnMockFileSystem ( )
116+ {
117+ bool onRealFileSystemExecuted = false ;
118+ bool onMockFileSystemExecuted = false ;
119+ MockFileSystem fileSystem = new ( ) ;
120+ await Execute . WhenRealFileSystemAsync ( fileSystem ,
121+ async ( ) =>
122+ {
123+ await Task . Yield ( ) ;
124+ return onRealFileSystemExecuted = true ;
125+ } ,
126+ ( ) =>
127+ {
128+ return onMockFileSystemExecuted = true ;
129+ } ) ;
130+
131+ await That ( onRealFileSystemExecuted ) . IsFalse ( ) ;
132+ await That ( onMockFileSystemExecuted ) . IsTrue ( ) ;
133+ }
134+
135+ [ Fact ]
136+ public async Task
137+ WhenRealFileSystemAsync_RealFileSystem_WithActionCallback_ShouldExecuteOnRealFileSystem ( )
138+ {
139+ bool onRealFileSystemExecuted = false ;
140+ bool onMockFileSystemExecuted = false ;
141+ RealFileSystem fileSystem = new ( ) ;
142+ await Execute . WhenRealFileSystemAsync ( fileSystem ,
143+ ( ) =>
144+ {
145+ onRealFileSystemExecuted = true ;
146+ return Task . CompletedTask ;
147+ } ,
148+ ( ) =>
149+ {
150+ onMockFileSystemExecuted = true ;
151+ } ) ;
152+
153+ await That ( onRealFileSystemExecuted ) . IsTrue ( ) ;
154+ await That ( onMockFileSystemExecuted ) . IsFalse ( ) ;
155+ }
156+
157+ [ Fact ]
158+ public async Task
159+ WhenRealFileSystemAsync_RealFileSystem_WithFuncCallback_ShouldExecuteOnRealFileSystem ( )
160+ {
161+ bool onRealFileSystemExecuted = false ;
162+ bool onMockFileSystemExecuted = false ;
163+ RealFileSystem fileSystem = new ( ) ;
164+ await Execute . WhenRealFileSystemAsync ( fileSystem ,
165+ async ( ) =>
166+ {
167+ await Task . Yield ( ) ;
168+ return onRealFileSystemExecuted = true ;
169+ } ,
170+ ( ) =>
171+ {
172+ return onMockFileSystemExecuted = true ;
173+ } ) ;
174+
175+ await That ( onRealFileSystemExecuted ) . IsTrue ( ) ;
176+ await That ( onMockFileSystemExecuted ) . IsFalse ( ) ;
177+ }
86178}
0 commit comments