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
11 using NUnit.Framework;
15 namespace MonoTests.System.IO
18 public class FileSystemWatcherTest
21 public void CheckDefaults ()
23 FileSystemWatcher fw = new FileSystemWatcher ();
24 Assert.AreEqual (fw.EnableRaisingEvents, false, "#01");
25 Assert.AreEqual (fw.Filter, "*.*", "#02");
26 Assert.AreEqual (fw.IncludeSubdirectories, false, "#03");
27 Assert.AreEqual (fw.InternalBufferSize, 8192, "#04");
28 Assert.AreEqual (fw.NotifyFilter, NotifyFilters.FileName | NotifyFilters.DirectoryName | NotifyFilters.LastWrite, "#05");
29 Assert.AreEqual (fw.Path, "", "#06");
33 [ExpectedException (typeof (ArgumentNullException))]
34 public void CheckCtor1 ()
36 FileSystemWatcher fw = new FileSystemWatcher (null);
40 [ExpectedException (typeof (ArgumentException))]
41 public void CheckCtor2 ()
43 FileSystemWatcher fw = new FileSystemWatcher ("");
47 [ExpectedException (typeof (ArgumentException))]
48 public void CheckCtor3 ()
50 FileSystemWatcher fw = new FileSystemWatcher ("notexistsblahblah");
54 [ExpectedException (typeof (ArgumentNullException))]
55 public void CheckCtor4 ()
57 FileSystemWatcher fw = new FileSystemWatcher (Path.GetTempPath (), null);
61 // Doesn't throw here :-?
62 // [ExpectedException (typeof (ArgumentException))]
63 public void CheckCtor5 ()
65 FileSystemWatcher fw = new FileSystemWatcher (Path.GetTempPath (), "invalidpath|");
66 fw = new FileSystemWatcher (Path.GetTempPath (), "*");
70 // ...But here it does...
71 [ExpectedException (typeof (ArgumentException))]
72 public void CheckInvalidPath ()
74 FileSystemWatcher fw = new FileSystemWatcher (Path.GetTempPath (), "invalidpath|");
75 fw.Path = "invalidpath|";
80 [ExpectedException (typeof (ArgumentException))]
81 public void CheckPathWildcard ()
83 FileSystemWatcher fw = new FileSystemWatcher (Path.GetTempPath (), "*");