mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-18 12:31:30 -10:00
* System.dll.sources: added new files. * System_test.dll.sources: added new test. * System.IO/DefaultWatcher.cs: stub for the default watcher. * System.IO/WindowsWatcher.cs: stub for the windows watcher. * System.IO/FAMWatcher.cs: FAM watcher. * System.IO/FileAction.cs: enum with event types. * System.IO/FileSystemEventArgs.cs: added SetName property. * System.IO/FileSystemWatcher.cs: added support for the 3 watchers. * System.IO/IFileWatcher.cs: interface implemented by the watchers. * System.IO/SearchPattern.cs: copied from corlib. * Test/System.IO/FileSystemWatcherTest.cs: new test. svn path=/trunk/mcs/; revision=22139
87 lines
2.2 KiB
C#
Executable File
87 lines
2.2 KiB
C#
Executable File
// FileSystemWatcherTest.cs - NUnit Test Cases for the System.IO.FileSystemWatcher class
|
|
//
|
|
// Authors:
|
|
// Gonzalo Paniagua Javier ([email protected])
|
|
//
|
|
// (C) 2004 Novell, Inc. http://www.novell.com
|
|
//
|
|
|
|
using NUnit.Framework;
|
|
using System;
|
|
using System.IO;
|
|
|
|
namespace MonoTests.System.IO
|
|
{
|
|
[TestFixture]
|
|
public class FileSystemWatcherTest : Assertion
|
|
{
|
|
[Test]
|
|
public void CheckDefaults ()
|
|
{
|
|
FileSystemWatcher fw = new FileSystemWatcher ();
|
|
AssertEquals ("#01", fw.EnableRaisingEvents, false);
|
|
AssertEquals ("#02", fw.Filter, "*.*");
|
|
AssertEquals ("#03", fw.IncludeSubdirectories, false);
|
|
AssertEquals ("#04", fw.InternalBufferSize, 8192);
|
|
AssertEquals ("#05", fw.NotifyFilter, NotifyFilters.FileName | NotifyFilters.DirectoryName | NotifyFilters.LastWrite);
|
|
AssertEquals ("#06", fw.Path, "");
|
|
}
|
|
|
|
[Test]
|
|
[ExpectedException (typeof (ArgumentNullException))]
|
|
public void CheckCtor1 ()
|
|
{
|
|
FileSystemWatcher fw = new FileSystemWatcher (null);
|
|
}
|
|
|
|
[Test]
|
|
[ExpectedException (typeof (ArgumentException))]
|
|
public void CheckCtor2 ()
|
|
{
|
|
FileSystemWatcher fw = new FileSystemWatcher ("");
|
|
}
|
|
|
|
[Test]
|
|
[ExpectedException (typeof (ArgumentException))]
|
|
public void CheckCtor3 ()
|
|
{
|
|
FileSystemWatcher fw = new FileSystemWatcher ("notexistsblahblah");
|
|
}
|
|
|
|
[Test]
|
|
[ExpectedException (typeof (ArgumentNullException))]
|
|
public void CheckCtor4 ()
|
|
{
|
|
FileSystemWatcher fw = new FileSystemWatcher (Path.GetTempPath (), null);
|
|
}
|
|
|
|
[Test]
|
|
// Doesn't throw here :-?
|
|
// [ExpectedException (typeof (ArgumentException))]
|
|
public void CheckCtor5 ()
|
|
{
|
|
FileSystemWatcher fw = new FileSystemWatcher (Path.GetTempPath (), "invalidpath|");
|
|
fw = new FileSystemWatcher (Path.GetTempPath (), "*");
|
|
}
|
|
|
|
[Test]
|
|
// ...But here it does...
|
|
[ExpectedException (typeof (ArgumentException))]
|
|
public void CheckInvalidPath ()
|
|
{
|
|
FileSystemWatcher fw = new FileSystemWatcher (Path.GetTempPath (), "invalidpath|");
|
|
fw.Path = "invalidpath|";
|
|
}
|
|
|
|
[Test]
|
|
// ...and here too
|
|
[ExpectedException (typeof (ArgumentException))]
|
|
public void CheckPathWildcard ()
|
|
{
|
|
FileSystemWatcher fw = new FileSystemWatcher (Path.GetTempPath (), "*");
|
|
fw.Path = "*";
|
|
}
|
|
}
|
|
}
|
|
|