diff --git a/Source/Testably.Abstractions.Testing/FileSystem/FileStreamMock.cs b/Source/Testably.Abstractions.Testing/FileSystem/FileStreamMock.cs
index a21f2095b..face9b6ee 100644
--- a/Source/Testably.Abstractions.Testing/FileSystem/FileStreamMock.cs
+++ b/Source/Testably.Abstractions.Testing/FileSystem/FileStreamMock.cs
@@ -189,6 +189,10 @@ public override void Flush()
InternalFlush();
}
+ ///
+ public override void Flush(bool flushToDisk)
+ => Flush();
+
///
public override Task FlushAsync(CancellationToken cancellationToken)
{
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/FileStream/Tests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/FileStream/Tests.cs
index 0fd5f4b69..b38a47bb1 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/FileStream/Tests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/FileStream/Tests.cs
@@ -162,6 +162,22 @@ public void Flush_ShouldNotChangePosition(
stream.Position.Should().Be(2);
}
+ [SkippableTheory]
+ [InlineAutoData(false)]
+ [InlineAutoData(true)]
+ public void Flush_WriteToDisk_ShouldNotChangePosition(
+ bool flushToDisk, string path, byte[] bytes)
+ {
+ using FileSystemStream stream = FileSystem.File.Create(path);
+ stream.Write(bytes, 0, bytes.Length);
+ stream.Seek(2, SeekOrigin.Begin);
+ stream.Position.Should().Be(2);
+
+ stream.Flush(flushToDisk);
+
+ stream.Position.Should().Be(2);
+ }
+
[SkippableTheory]
[AutoData]
public void Flush_ShouldNotUpdateFileContentWhenAlreadyFlushed(