Skip to content
Permalink
Browse files

DirectoryWatcherBase - SubscribeFileRootedPath

  • Loading branch information
bobbymcr committed Feb 10, 2020
1 parent 1946cd2 commit ecf95b6de38dfce89b60890141fd029c1cf391dd
@@ -265,6 +265,19 @@ public void SubscribeFileRelativeOutsideDir()
ae.ParamName.Should().Be("file");
}

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

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

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

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

0 comments on commit ecf95b6

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