We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 455afb3 commit 6517f9eCopy full SHA for 6517f9e
1 file changed
TestHelpers.Tests/MockFileInfoTests.cs
@@ -188,5 +188,23 @@ public void MockFileInfo_GetDirectory_ShouldReturnDirectoryInfoWithCorrectPath()
188
189
Assert.AreEqual(@"c:\temp\level1\level2\", result.FullName);
190
}
191
+
192
+ [Test]
193
+ public void MockFileInfo_OpenRead_ShouldReturnByteContentOfFile()
194
+ {
195
+ // Arrange
196
+ var fileSystem = new MockFileSystem();
197
+ fileSystem.AddFile(@"c:\temp\file.txt", new MockFileData(new byte[] { 1, 2 }));
198
+ var fileInfo = fileSystem.FileInfo.FromFileName(@"c:\temp\file.txt");
199
200
+ // Act
201
+ byte[] result = new byte[2];
202
+ using (var stream = fileInfo.OpenRead())
203
204
+ stream.Read(result, 0, 2);
205
+ }
206
207
+ Assert.AreEqual(new byte[] { 1, 2 }, result);
208
209
210
0 commit comments