File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
Source/Testably.Abstractions.Testing/FileSystem
Tests/Testably.Abstractions.Tests/FileSystem/FileStream Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -189,6 +189,10 @@ public override void Flush()
189189 InternalFlush ( ) ;
190190 }
191191
192+ /// <inheritdoc cref="FileSystemStream.Flush(bool)" />
193+ public override void Flush ( bool flushToDisk )
194+ => Flush ( ) ;
195+
192196 /// <inheritdoc cref="FileSystemStream.FlushAsync(CancellationToken)" />
193197 public override Task FlushAsync ( CancellationToken cancellationToken )
194198 {
Original file line number Diff line number Diff line change @@ -162,6 +162,22 @@ public void Flush_ShouldNotChangePosition(
162162 stream . Position . Should ( ) . Be ( 2 ) ;
163163 }
164164
165+ [ SkippableTheory ]
166+ [ InlineAutoData ( false ) ]
167+ [ InlineAutoData ( true ) ]
168+ public void Flush_WriteToDisk_ShouldNotChangePosition (
169+ bool flushToDisk , string path , byte [ ] bytes )
170+ {
171+ using FileSystemStream stream = FileSystem . File . Create ( path ) ;
172+ stream . Write ( bytes , 0 , bytes . Length ) ;
173+ stream . Seek ( 2 , SeekOrigin . Begin ) ;
174+ stream . Position . Should ( ) . Be ( 2 ) ;
175+
176+ stream . Flush ( flushToDisk ) ;
177+
178+ stream . Position . Should ( ) . Be ( 2 ) ;
179+ }
180+
165181 [ SkippableTheory ]
166182 [ AutoData ]
167183 public void Flush_ShouldNotUpdateFileContentWhenAlreadyFlushed (
You can’t perform that action at this time.
0 commit comments