Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void fileWatchRegistrationIsIllegal()
        internal virtual void FileWatchRegistrationIsIllegal()
        {
            DefaultFileSystemWatcher watcher = CreateWatcher();

            System.ArgumentException exception = assertThrows(typeof(System.ArgumentException), () => watcher.Watch(new File("notADirectory")));
            assertThat(exception.Message, containsString("Only directories can be registered to be monitored."));
        }
Example #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void registerMultipleDirectoriesForMonitoring() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void RegisterMultipleDirectoriesForMonitoring()
        {
            using (DefaultFileSystemWatcher watcher = new DefaultFileSystemWatcher(FileSystems.Default.newWatchService()))
            {
                File            directory1       = TestDirectory.directory("test1");
                File            directory2       = TestDirectory.directory("test2");
                WatchedResource watchedResource1 = watcher.Watch(directory1);
                WatchedResource watchedResource2 = watcher.Watch(directory2);
                assertNotSame(watchedResource1, watchedResource2);
            }
        }