-
Notifications
You must be signed in to change notification settings - Fork 267
Throw ArgumentException when path contains invalid characters #370
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
Conversation
fgreinacher
left a comment
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! A few minor nits.
| } | ||
|
|
||
| [Test] | ||
| public void MockFileSystem_GetFiles_ThrowsCorrectExceptionForInvalidCharacters() |
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.
I prefer to be specific in the naming, so what about that:
| public void MockFileSystem_GetFiles_ThrowsCorrectExceptionForInvalidCharacters() | |
| public void MockFileSystem_GetFiles_ThrowsArgumentExceptionForInvalidCharacters() |
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.
Makes sense
| fileSystem.AddDirectory(XFS.Path(path)); | ||
|
|
||
| // Act | ||
| TestDelegate wrapped = () => fileSystem.Directory.GetFiles($"{path}{'\0'}.txt"); |
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.
I don't like the name wrapped - maybe something like getFilesWithInvalidCharacterInPath?
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.
Changed
| if(path == null) | ||
| if (path == null) | ||
| { | ||
| throw new ArgumentNullException(); |
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.
Please add argument name
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
|
|
||
| if (path.Any(c => Path.GetInvalidPathChars().Contains(c))) | ||
| { | ||
| throw new ArgumentException(); |
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.
Please add argument name and message.
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
|
Thanks @fgreinacher for the review. I integrated your feedback and pushed a new commit so you should be able to review again. |
|
Thanks, looks great now! |
Fixes #367