Exemplo n.º 1
0
    public static void ShouldRecurseIntoEntryTest()
    {
        string currentDir   = Utility.GetRandomDirectory();
        string subDirectory = new DirectoryInfo(currentDir).CreateSubdirectory("sub").FullName;

        var watcher2 = new DerivedWatcher(currentDir, options: new EnumerationOptions {
            RecurseSubdirectories = true
        })
        {
            PollingInterval = 1
        };

        watcher2.Start();

        try
        {
            Assert.True(watcher2.ShouldIncludeEntryCalled);
            Assert.True(watcher2.ShouldRecurseIntoEntryCalled);
        }
        finally
        {
            Directory.Delete(currentDir, true);
            watcher2.Dispose();
        }
    }
Exemplo n.º 2
0
    public static void ShouldIncludeEntryTest()
    {
        string currentDir   = Utility.GetRandomDirectory();
        string subDirectory = new DirectoryInfo(currentDir).CreateSubdirectory("sub").FullName;

        DerivedWatcher watcher2 = new DerivedWatcher(currentDir);

        watcher2.LoadState();

        try
        {
            Assert.True(watcher2.ShouldIncludeEntryCalled);
            Assert.False(watcher2.ShouldRecurseIntoEntryCalled);
        }
        finally
        {
            Directory.Delete(currentDir, true);
        }
    }