2010-06-07 Carlos Alberto Cortez <calberto.cortez@gmail.com>
authorCarlos Alberto Cortez <calberto.cortez@gmail.com>
Mon, 7 Jun 2010 15:01:11 +0000 (15:01 -0000)
committerCarlos Alberto Cortez <calberto.cortez@gmail.com>
Mon, 7 Jun 2010 15:01:11 +0000 (15:01 -0000)
* IsolatedStorageFileTest.cs: Update our tests to catch/report the new
exceptions fired in 4.0, as well as a new test to assert that
GetDirectoryNames fires an ArgumentException if '..' is passed as part
of the path.

svn path=/trunk/mcs/; revision=158590

mcs/class/corlib/Test/System.IO.IsolatedStorage/ChangeLog
mcs/class/corlib/Test/System.IO.IsolatedStorage/IsolatedStorageFileTest.cs

index 5f864e6ba8327f0724583261877e2416fa40ed41..1a08ef657fb1dfb109b2dc58f23ba5b20970e6f2 100644 (file)
@@ -1,3 +1,10 @@
+2010-06-07  Carlos Alberto Cortez <calberto.cortez@gmail.com>
+
+       * IsolatedStorageFileTest.cs: Update our tests to catch/report the new
+       exceptions fired in 4.0, as well as a new test to assert that
+       GetDirectoryNames fires an ArgumentException if '..' is passed as part
+       of the path.
+
 2010-06-06  Carlos Alberto Cortez <calberto.cortez@gmail.com>
 
        * IsolatedStorageFileTest.cs: Include check for paths outside our
index d89ff4d20a95e610cdbbe344f3df9870f97e5836..57fa50345357c3f66e9c6e19dd39c5a2bcb760b2 100644 (file)
@@ -429,12 +429,19 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
                                try {
                                        isf.CreateDirectory (path);
                                }
+#if NET_4_0
+                               catch (IsolatedStorageException ex) {
+                                       Assert.IsFalse (ex.Message.IndexOf (path) >= 0, "Message");
+                                       Assert.IsNull (ex.InnerException, "InnerException");
+                               }
+#else
                                catch (IOException ex) {
                                        Assert.AreEqual (typeof (IOException), ex.GetType (), "Type");
                                        // don't leak path information
                                        Assert.IsFalse (ex.Message.IndexOf (path) >= 0, "Message");
                                        Assert.IsNull (ex.InnerException, "InnerException");
                                }
+#endif
                        }
                }
 
@@ -463,7 +470,11 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
                }
 
                [Test]
+#if NET_4_0
+               [ExpectedException (typeof (ArgumentException))]
+#else
                [ExpectedException (typeof (SecurityException))]
+#endif
                public void GetFilesInSubdirs ()
                {
                        IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
@@ -471,6 +482,18 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
                        isf.GetFileNames (pattern);
                }
 
+        
+#if NET_4_0
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void GetDirsInSubDirs ()
+               {
+                       IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
+                       isf.CreateDirectory ("subdir");
+                       string [] dir_names = isf.GetDirectoryNames ("subdir/../*");
+               }
+#endif
+
                [Test] // https://bugzilla.novell.com/show_bug.cgi?id=376188
                public void CreateSubDirectory ()
                {