//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void startStopFileWatchingCycle() throws java.io.IOException, InterruptedException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void StartStopFileWatchingCycle() { File file1 = mock(typeof(File)); File file2 = mock(typeof(File)); WatchedResource resource1 = mock(typeof(WatchedResource)); WatchedResource resource2 = mock(typeof(WatchedResource)); _watcher.watch(file1); _watcher.watch(file2); when(@delegate.Watch(file1)).thenReturn(resource1); when(@delegate.Watch(file2)).thenReturn(resource2); int invocations = 100; for (int i = 0; i < invocations; i++) { StartStopWatching(); } verify(@delegate, times(invocations)).watch(file1); verify(@delegate, times(invocations)).watch(file2); verify(@delegate, times(invocations)).startWatching(); verify(@delegate, times(invocations)).stopWatching(); verify(resource1, times(invocations)).close(); verify(resource2, times(invocations)).close(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void provideSelectiveWatcher() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ProvideSelectiveWatcher() { File specialFile = new File("special"); File otherFile = new File("other"); FileSystemAbstraction normal = mock(typeof(FileSystemAbstraction)); FileSystemAbstraction special = mock(typeof(FileSystemAbstraction)); FileWatcher specialWatcher = mock(typeof(FileWatcher)); FileWatcher normalWatcher = mock(typeof(FileWatcher)); WatchedResource specialResource = mock(typeof(WatchedResource)); WatchedResource normalResource = mock(typeof(WatchedResource)); when(special.FileWatcher()).thenReturn(specialWatcher); when(normal.FileWatcher()).thenReturn(normalWatcher); when(specialWatcher.Watch(specialFile)).thenReturn(specialResource); when(normalWatcher.Watch(otherFile)).thenReturn(normalResource); using (SelectiveFileSystemAbstraction fs = new SelectiveFileSystemAbstraction(specialFile, special, normal)) { FileWatcher fileWatcher = fs.FileWatcher(); assertSame(specialResource, fileWatcher.Watch(specialFile)); assertSame(normalResource, fileWatcher.Watch(otherFile)); } }