Skip to content
Permalink
Browse files

DirectoryWatcherBase - SubscribeFileRelativeOutsideDir

  • Loading branch information
bobbymcr committed Feb 10, 2020
1 parent 21e02c6 commit 1946cd2f4500aa610e159679bf963a28bae4fe50
@@ -252,6 +252,19 @@ public void SubscribeFileRelativeSubDir()
ae.ParamName.Should().Be("file");
}

[TestMethod]
public void SubscribeFileRelativeOutsideDir()
{
DirectoryWatcherBase watcherBase = new FakeDirectoryWatcher(new DirectoryInfo(@"X:\root"));
Action<FileInfo> onUpdate = f => { };

Action act = () => watcherBase.Subscribe(@"..\file1.txt", onUpdate);

ArgumentException ae = act.Should().Throw<ArgumentException>().Which;
ae.Message.Should().Contain(@"Invalid file name '..\file1.txt'");
ae.ParamName.Should().Be("file");
}

private sealed class FakeDirectoryWatcher : DirectoryWatcherBase
{
public FakeDirectoryWatcher(DirectoryInfo path)

0 comments on commit 1946cd2

Please sign in to comment.
You can’t perform that action at this time.