コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void notifyListenersOnDeletion() throws InterruptedException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void NotifyListenersOnDeletion()
        {
            TestFileSystemWatcher       watcher   = CreateWatcher();
            AssertableFileEventListener listener1 = new AssertableFileEventListener();
            AssertableFileEventListener listener2 = new AssertableFileEventListener();

            watcher.AddFileWatchEventListener(listener1);
            watcher.AddFileWatchEventListener(listener2);

            TestWatchEvent <Path> watchEvent  = new TestWatchEvent <Path>(ENTRY_DELETE, Paths.get("file1"));
            TestWatchEvent <Path> watchEvent2 = new TestWatchEvent <Path>(ENTRY_DELETE, Paths.get("file2"));
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: TestWatchKey watchKey = new TestWatchKey(asList(watchEvent, watchEvent2));
            TestWatchKey watchKey = new TestWatchKey(new IList <WatchEvent <object> > {
                watchEvent, watchEvent2
            });

            PrepareWatcher(watchKey);

            Watch(watcher);

            listener1.AssertDeleted("file1");
            listener1.AssertDeleted("file2");
            listener2.AssertDeleted("file1");
            listener2.AssertDeleted("file2");
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void skipEmptyEvent() throws InterruptedException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void SkipEmptyEvent()
        {
            TestFileSystemWatcher watcher = CreateWatcher();

            AssertableFileEventListener listener = new AssertableFileEventListener();

            watcher.AddFileWatchEventListener(listener);

            TestWatchEvent <string> @event = new TestWatchEvent(ENTRY_MODIFY, null);
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: TestWatchKey watchKey = new TestWatchKey(asList(event));
            TestWatchKey watchKey = new TestWatchKey(new IList <WatchEvent <object> > {
                @event
            });

            PrepareWatcher(watchKey);

            Watch(watcher);

            listener.AssertNoEvents();
        }
コード例 #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void prepareWatcher(TestWatchKey watchKey) throws InterruptedException
        private void PrepareWatcher(TestWatchKey watchKey)
        {
            when(_watchServiceMock.take()).thenReturn(watchKey).thenThrow(typeof(InterruptedException));
        }