Skip to content

Commit

Permalink
DirectoryWatcherBase - SubscribeFileRelativeSubDir
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbymcr committed Feb 10, 2020
1 parent 8748d28 commit 21e02c6
Showing 1 changed file with 13 additions and 0 deletions.
Expand Up @@ -239,6 +239,19 @@ public void SubscribeDotFileName()
ae.ParamName.Should().Be("file");
}

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

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

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

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

0 comments on commit 21e02c6

Please sign in to comment.