Author: spouliot
Date: 2005-03-15 16:09:05 -0500 (Tue, 15 Mar 2005)
New Revision: 41857
Modified:
trunk/mcs/class/corlib/Test/System.IO/ChangeLog
trunk/mcs/class/corlib/Test/System.IO/FileStreamTest.cs
Log:
2005-03-15 Sebastien Pouliot <[EMAIL PROTECTED]>
* FileStreamTest.cs: Added tests for all FileMode when a directory
doesn't exists. Added a test for UnauthorizedAccessException when a
directory is opened as a file.
Modified: trunk/mcs/class/corlib/Test/System.IO/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/Test/System.IO/ChangeLog 2005-03-15 21:07:29 UTC
(rev 41856)
+++ trunk/mcs/class/corlib/Test/System.IO/ChangeLog 2005-03-15 21:09:05 UTC
(rev 41857)
@@ -1,3 +1,9 @@
+2005-03-15 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * FileStreamTest.cs: Added tests for all FileMode when a directory
+ doesn't exists. Added a test for UnauthorizedAccessException when a
+ directory is opened as a file.
+
2005-01-28 Sebastien Pouliot <[EMAIL PROTECTED]>
* FileLoadExceptionCas.cs: Fixed failures under MS for NET_1_1.
Modified: trunk/mcs/class/corlib/Test/System.IO/FileStreamTest.cs
===================================================================
--- trunk/mcs/class/corlib/Test/System.IO/FileStreamTest.cs 2005-03-15
21:07:29 UTC (rev 41856)
+++ trunk/mcs/class/corlib/Test/System.IO/FileStreamTest.cs 2005-03-15
21:09:05 UTC (rev 41857)
@@ -158,9 +158,7 @@
}
}
- [Test]
- [ExpectedException (typeof (DirectoryNotFoundException))]
- public void CtorDirectoryNotFoundException ()
+ private void CtorDirectoryNotFoundException (FileMode mode)
{
string path = TempFolder + DSC +
"thisDirectoryShouldNotExists";
if (Directory.Exists (path))
@@ -168,7 +166,7 @@
FileStream stream = null;
try {
- stream = new FileStream (path + DSC +
"eitherthisfile.test", FileMode.CreateNew);
+ stream = new FileStream (path + DSC +
"eitherthisfile.test", mode);
} finally {
if (stream != null)
@@ -180,6 +178,48 @@
}
[Test]
+ [ExpectedException (typeof (DirectoryNotFoundException))]
+ public void CtorDirectoryNotFoundException_CreateNew ()
+ {
+ CtorDirectoryNotFoundException (FileMode.CreateNew);
+ }
+
+ [Test]
+ [ExpectedException (typeof (DirectoryNotFoundException))]
+ public void CtorDirectoryNotFoundException_Create ()
+ {
+ CtorDirectoryNotFoundException (FileMode.Create);
+ }
+
+ [Test]
+ [ExpectedException (typeof (DirectoryNotFoundException))]
+ public void CtorDirectoryNotFoundException_Open ()
+ {
+ CtorDirectoryNotFoundException (FileMode.Open);
+ }
+
+ [Test]
+ [ExpectedException (typeof (DirectoryNotFoundException))]
+ public void CtorDirectoryNotFoundException_OpenOrCreate ()
+ {
+ CtorDirectoryNotFoundException (FileMode.OpenOrCreate);
+ }
+
+ [Test]
+ [ExpectedException (typeof (DirectoryNotFoundException))]
+ public void CtorDirectoryNotFoundException_Truncate ()
+ {
+ CtorDirectoryNotFoundException (FileMode.Truncate);
+ }
+
+ [Test]
+ [ExpectedException (typeof (DirectoryNotFoundException))]
+ public void CtorDirectoryNotFoundException_Append ()
+ {
+ CtorDirectoryNotFoundException (FileMode.Append);
+ }
+
+ [Test]
[ExpectedException (typeof (ArgumentOutOfRangeException))]
public void CtorArgumentOutOfRangeException3 ()
{
@@ -391,6 +431,19 @@
}
[Test]
+ [ExpectedException (typeof (UnauthorizedAccessException))]
+ public void CtorReadDirectoryAsFile ()
+ {
+ FileStream stream = null;
+ try {
+ stream = new FileStream (TempFolder,
FileMode.Open, FileAccess.Read);
+ } finally {
+ if (stream != null)
+ stream.Close ();
+ }
+ }
+
+ [Test]
public void Write ()
{
string path = TempFolder + DSC + "FileStreamTest.Write";
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches