Esempio n. 1
0
//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));
            }
        }
Esempio n. 2
0
 public AdversarialFileWatcher(FileWatcher fileWatcher, Adversary adversary)
 {
     this._fileWatcher = fileWatcher;
     this._adversary   = adversary;
 }
Esempio n. 3
0
 internal SelectiveFileWatcher(File specialFile, FileWatcher defaultFileWatcher, FileWatcher specificFileWatcher)
 {
     this._specialFile         = specialFile;
     this._defaultFileWatcher  = defaultFileWatcher;
     this._specificFileWatcher = specificFileWatcher;
 }