-
Notifications
You must be signed in to change notification settings - Fork 266
Fix for #284: MockFile.Delete does not throw exception when file does not exist. #387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9f56ded
2721e03
d51c513
7847d70
7fae6fa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,8 +28,10 @@ public void MockFileStream_Flush_WritesByteToFile() | |
[Test] | ||
public void MockFileStream_Dispose_ShouldNotResurrectFile() | ||
{ | ||
// path in this test case is a subject to Directory.GetParent(path) Linux issue | ||
// https://github.com/System-IO-Abstractions/System.IO.Abstractions/issues/395 | ||
var fileSystem = new MockFileSystem(); | ||
var path = XFS.Path("C:\\test"); | ||
var path = XFS.Path("C:\\some_folder\\test"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this change necessary? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because of potential bug. Consider this code:
It works ok on Windows but throws NullReferenceException on Linux. And after my changes GetParent() method is called inside File.Delete(), so this test started to fail. Adding a new intermediate folder "some_folder" is the fastest way to make the test work again. I can create a new issue with this if you think it is a real defect. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah OK, thanks. Could you please create an issue for this problem and add a comment to the changed test case that refers to the issue? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! |
||
var directory = fileSystem.Path.GetDirectoryName(path); | ||
fileSystem.AddFile(path, new MockFileData("Bla")); | ||
var stream = fileSystem.File.Open(path, FileMode.Open, FileAccess.ReadWrite, FileShare.Delete); | ||
|
Uh oh!
There was an error while loading. Please reload this page.