1 // FileSystemWatcherTest.cs - NUnit Test Cases for the System.IO.FileSystemWatcher class
4 // Gonzalo Paniagua Javier (gonzalo@ximian.com)
6 // (C) 2004 Novell, Inc. http://www.novell.com
13 namespace MonoTests.System.IO
16 public class FileSystemWatcherTest : Assertion
19 public void CheckDefaults ()
21 FileSystemWatcher fw = new FileSystemWatcher ();
22 AssertEquals ("#01", fw.EnableRaisingEvents, false);
23 AssertEquals ("#02", fw.Filter, "*.*");
24 AssertEquals ("#03", fw.IncludeSubdirectories, false);
25 AssertEquals ("#04", fw.InternalBufferSize, 8192);
26 AssertEquals ("#05", fw.NotifyFilter, NotifyFilters.FileName | NotifyFilters.DirectoryName | NotifyFilters.LastWrite);
27 AssertEquals ("#06", fw.Path, "");
31 [ExpectedException (typeof (ArgumentNullException))]
32 public void CheckCtor1 ()
34 FileSystemWatcher fw = new FileSystemWatcher (null);
38 [ExpectedException (typeof (ArgumentException))]
39 public void CheckCtor2 ()
41 FileSystemWatcher fw = new FileSystemWatcher ("");
45 [ExpectedException (typeof (ArgumentException))]
46 public void CheckCtor3 ()
48 FileSystemWatcher fw = new FileSystemWatcher ("notexistsblahblah");
52 [ExpectedException (typeof (ArgumentNullException))]
53 public void CheckCtor4 ()
55 FileSystemWatcher fw = new FileSystemWatcher (Path.GetTempPath (), null);
59 // Doesn't throw here :-?
60 // [ExpectedException (typeof (ArgumentException))]
61 public void CheckCtor5 ()
63 FileSystemWatcher fw = new FileSystemWatcher (Path.GetTempPath (), "invalidpath|");
64 fw = new FileSystemWatcher (Path.GetTempPath (), "*");
68 // ...But here it does...
69 [ExpectedException (typeof (ArgumentException))]
70 public void CheckInvalidPath ()
72 FileSystemWatcher fw = new FileSystemWatcher (Path.GetTempPath (), "invalidpath|");
73 fw.Path = "invalidpath|";
78 [ExpectedException (typeof (ArgumentException))]
79 public void CheckPathWildcard ()
81 FileSystemWatcher fw = new FileSystemWatcher (Path.GetTempPath (), "*");