* IsolatedStorageFileTest.cs: New test for DeleteFile.
authorCarlos Alberto Cortez <calberto.cortez@gmail.com>
Mon, 7 Jun 2010 17:46:29 +0000 (17:46 -0000)
committerCarlos Alberto Cortez <calberto.cortez@gmail.com>
Mon, 7 Jun 2010 17:46:29 +0000 (17:46 -0000)
2010-06-07  Carlos Alberto Cortez <calberto.cortez@gmail.com>

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

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

index 1a08ef657fb1dfb109b2dc58f23ba5b20970e6f2..16db131582e43c0209154b81430cd8ef914e89bd 100644 (file)
@@ -1,3 +1,7 @@
+2010-06-07  Carlos Alberto Cortez <calberto.cortez@gmail.com>
+
+       * IsolatedStorageFileTest.cs: New test for DeleteFile.
+
 2010-06-07  Carlos Alberto Cortez <calberto.cortez@gmail.com>
 
        * IsolatedStorageFileTest.cs: Update our tests to catch/report the new
index 57fa50345357c3f66e9c6e19dd39c5a2bcb760b2..a88868f7785f6ed612aed55302ee247fce776a31 100644 (file)
@@ -516,6 +516,55 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
                        isf.DeleteDirectory ("subdir");
                }
 
+               [Test]
+               public void DeleteFile ()
+               {
+                       IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
+
+                       try {
+                               isf.DeleteFile (null);
+                               Assert.Fail ("#Exc0");
+                       } catch (ArgumentNullException) {
+                       }
+
+#if NET_4_0
+                       // We are getting an internal IndexOutOfRangeException in 2.0
+                       // Not sure we want to mimic that one.
+                       try {
+                               isf.DeleteFile (String.Empty);
+                               Assert.Fail ("#Exc1");
+                       } catch (IsolatedStorageException) {
+                       }
+#endif
+
+                       try {
+                               isf.DeleteFile ("idontexist");
+                               Assert.Fail ("#Exc2");
+                       } catch (IsolatedStorageException) {
+                       }
+
+#if NET_4_0
+                       try {
+                               isf.DeleteFile ("../../file");
+                               Assert.Fail ("#Exc3");
+                       } catch (IsolatedStorageException) {
+                       }
+#endif
+               
+                       try {
+                               isf.DeleteFile ("subdir/file");
+                               Assert.Fail ("#Exc4");
+                       } catch (IsolatedStorageException) {
+                       }
+
+                       isf.CreateDirectory ("subdir");
+                       try {
+                               isf.DeleteFile ("subdir");
+                               Assert.Fail ("#Exc5");
+                       } catch (IsolatedStorageException) {
+                       }
+               }
+
                [Test]
                public void GetStore_NullTypes ()
                {