-
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
Fix for #284: MockFile.Delete does not throw exception when file does not exist. #387
Conversation
{ | ||
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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Because of potential bug. Consider this code:
var fileSystem = new MockFileSystem();
var path = XFS.Path("C:\\test.txt");
DirectoryInfoBase dir = fileSystem.Directory.GetParent(path);
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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
New issue is #395
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments inline, otherwise this looks good!
Thanks again! |
Welcome! |
Attempt to fix the subject bug.