Skip to content
Permalink
Browse files

DirectoryWatcherBase - UpdateIrrelevantFileOneSubscription

  • Loading branch information
bobbymcr committed Feb 10, 2020
1 parent afed17d commit 862304bd5ab42e11f3ac16f9163a4a5ce4eff761
@@ -17,6 +17,10 @@ protected DirectoryWatcherBase(DirectoryInfo path)
}
}

public void Subscribe(string file, Action<FileInfo> onUpdate)
{
}

public void Dispose()
{
this.Dispose(true);
@@ -5,6 +5,7 @@
namespace DirectoryWatcherSample.Test
{
using System;
using System.Collections.Generic;
using System.IO;
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
@@ -42,6 +43,19 @@ public void UpdateZeroSubscriptions()
act.Should().NotThrow();
}

[TestMethod]
public void UpdateIrrelevantFileOneSubscription()
{
List<string> updates = new List<string>();
FakeDirectoryWatcher watcher = new FakeDirectoryWatcher(new DirectoryInfo(@"X:\root"));
DirectoryWatcherBase watcherBase = watcher;
watcherBase.Subscribe("file1.txt", f => updates.Add(f.FullName));

watcher.Update(@"X:\root\not-relevant.txt");

updates.Should().BeEmpty();
}

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

0 comments on commit 862304b

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