[tests] Remove CWL from test catch clause as it can be confused with a real error...
[mono.git] / mcs / class / corlib / Test / System.IO.IsolatedStorage / IsolatedStorageFileTest.cs
1 //
2 // IsolatedStorageFileTest.cs 
3 //      - Unit Tests for abstract IsolatedStorageFile class
4 //
5 // Author:
6 //      Sebastien Pouliot  <sebastien@ximian.com>
7 //
8 // Copyright (C) 2005 Novell Inc. (http://www.novell.com)
9 // Copyright 2011 Xamarin Inc (http://www.xamarin.com).
10 //
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30
31 using System;
32 using System.Collections;
33 using System.IO;
34 using System.IO.IsolatedStorage;
35 using System.Reflection;
36 using System.Security;
37 using System.Security.Permissions;
38 using System.Security.Policy;
39
40 using NUnit.Framework;
41
42 namespace MonoTests.System.IO.IsolatedStorageTest {
43
44         [TestFixture]
45         public class IsolatedStorageFileTest {
46
47                 private const string dirname = "mono-unit-test";
48
49                 private void CheckEnumerated (int n, IsolatedStorageScope scope, IsolatedStorageFile isf)
50                 {
51                         string prefix = n.ToString () + " - " + scope.ToString () + " - ";
52                         Assert.IsNotNull (isf, prefix + "IsolatedStorageFile");
53                         Assert.IsTrue (((scope & isf.Scope) != 0), prefix + "Scope");
54
55                         if ((isf.Scope & IsolatedStorageScope.Assembly) != 0)
56                                 Assert.IsNotNull (isf.AssemblyIdentity, prefix + "AssemblyIdentity");
57                         if ((isf.Scope & IsolatedStorageScope.Domain) != 0)
58                                 Assert.IsNotNull (isf.DomainIdentity, prefix + "DomainIdentity");
59                         if ((isf.Scope & IsolatedStorageScope.Application) != 0)
60                                 Assert.IsNotNull (isf.ApplicationIdentity, prefix + "ApplicationIdentity");
61                 }
62
63                 private void GetEnumerator (IsolatedStorageScope scope)
64                 {
65                         IEnumerator e = IsolatedStorageFile.GetEnumerator (scope);
66                         int n = 0;
67                         while (e.MoveNext ())
68                         {
69                                 IsolatedStorageFile isf = (IsolatedStorageFile)e.Current;
70                                 CheckEnumerated (++n, scope, isf);
71                         }
72                 }
73
74                 [Test]
75                 public void GetEnumerator_User ()
76                 {
77                         GetEnumerator (IsolatedStorageScope.User);
78                 }
79
80                 [Test]
81                 [ExpectedException (typeof (ArgumentException))]
82                 public void GetEnumerator_User_Details ()
83                 {
84                         // giving more details is bad
85                         GetEnumerator (IsolatedStorageScope.User | IsolatedStorageScope.Assembly | IsolatedStorageScope.Domain);
86                 }
87
88                 [Test]
89                 public void GetEnumerator_UserRoaming ()
90                 {
91                         GetEnumerator (IsolatedStorageScope.User | IsolatedStorageScope.Roaming);
92                 }
93
94                 [Test]
95                 [ExpectedException (typeof (ArgumentException))]
96                 public void GetEnumerator_UserRoaming_Details ()
97                 {
98                         // giving more details is bad
99                         GetEnumerator (IsolatedStorageScope.User | IsolatedStorageScope.Assembly | IsolatedStorageScope.Domain | IsolatedStorageScope.Roaming);
100                 }
101                 [Test]
102                 public void GetEnumerator_Machine ()
103                 {
104                         GetEnumerator (IsolatedStorageScope.Machine);
105                 }
106
107                 [Test]
108                 [ExpectedException (typeof (ArgumentException))]
109                 public void GetEnumerator_Machine_Details ()
110                 {
111                         GetEnumerator (IsolatedStorageScope.Machine | IsolatedStorageScope.Assembly);
112                 }
113
114                 [Test]
115                 [ExpectedException (typeof (ArgumentException))]
116                 public void GetEnumerator_Application ()
117                 {
118                         // we can't enum application
119                         GetEnumerator (IsolatedStorageScope.Application);
120                 }
121                 [Test]
122                 public void GetUserStoreForAssembly ()
123                 {
124                         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
125                         Assert.AreEqual (Int64.MaxValue, isf.MaximumSize, "MaximumSize");
126                         Assert.AreEqual (IsolatedStorageScope.User | IsolatedStorageScope.Assembly, isf.Scope, "Scope");
127 #if !NET_2_1
128                         Assert.IsTrue ((isf.AssemblyIdentity is Url), "AssemblyIdentity");
129                         // note: mono transforms the CodeBase into uppercase
130                         // for net 1.1 which uses file:// and not file:///
131                         string codebase = Assembly.GetExecutingAssembly ().CodeBase.ToUpper ().Substring (8);
132                         Assert.IsTrue ((isf.AssemblyIdentity.ToString ().ToUpper ().IndexOf (codebase) > 0), "Url");
133                         Assert.IsTrue ((isf.AssemblyIdentity.ToString ().ToUpper ().IndexOf (codebase) > 0), "Url");
134 #endif
135                         Assert.IsTrue ((isf.CurrentSize >= 0), "CurrentSize");
136                 }
137
138                 [Test]
139                 [ExpectedException (typeof (InvalidOperationException))]
140                 public void GetUserStoreForAssembly_DomainIdentity ()
141                 {
142                         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
143                         object o = isf.DomainIdentity;
144                 }
145
146                 [Test]
147                 [ExpectedException (typeof (InvalidOperationException))]
148                 public void GetUserStoreForAssembly_ApplicationIdentity ()
149                 {
150                         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
151                         object o = isf.ApplicationIdentity;
152                 }
153
154                 [Test]
155                 public void GetUserStoreForDomain ()
156                 {
157                         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForDomain ();
158                         Assert.AreEqual (Int64.MaxValue, isf.MaximumSize, "MaximumSize");
159                         Assert.AreEqual (IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly, isf.Scope, "Scope");
160 #if !NET_2_1
161                         Assert.IsTrue ((isf.AssemblyIdentity is Url), "AssemblyIdentity");
162                         // note: mono transforms the CodeBase into uppercase
163                         // for net 1.1 which uses file:// and not file:///
164                         string codebase = Assembly.GetExecutingAssembly ().CodeBase.ToUpper ().Substring (8);
165                         Assert.IsTrue ((isf.AssemblyIdentity.ToString ().ToUpper ().IndexOf (codebase) > 0), "Url");
166                         Assert.IsTrue ((isf.DomainIdentity is Url), "DomainIdentity");
167                         // note: with MS Assembly.GetEntryAssembly () only works in the default (first) AppDomain
168                         // so we're using the first parameter to GetCommandLineArgs
169                         string exe = Environment.GetCommandLineArgs ()[0].Replace ("\\", "/").ToUpper ();
170                         Assert.IsTrue ((isf.DomainIdentity.ToString ().ToUpper ().IndexOf (exe) > 0), exe + "\n" + isf.DomainIdentity.ToString ().ToUpper ()); //"Url - Domain");
171 #endif
172                         Assert.IsTrue ((isf.CurrentSize >= 0), "CurrentSize");
173                 }
174
175                 [Test]
176                 [ExpectedException (typeof (InvalidOperationException))]
177                 public void GetUserStoreForDomain_ApplicationIdentity ()
178                 {
179                         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForDomain ();
180                         object o = isf.ApplicationIdentity;
181                 }
182
183                 [Test]
184 #if !MOBILE
185                 [ExpectedException (typeof (IsolatedStorageException))]
186 #endif
187                 public void GetUserStoreForApplication_WithoutApplicationIdentity ()
188                 {
189                         // note: a manifest is required
190                         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication ();
191                 }
192
193                 [Test]
194 #if !MOBILE
195                 [ExpectedException (typeof (IsolatedStorageException))]
196 #endif
197                 public void GetUserStoreForApplication ()
198                 {
199                         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication ();
200                         Assert.AreEqual (Int64.MaxValue, isf.MaximumSize, "MaximumSize");
201 #if !NET_2_1
202                         Assert.AreEqual (IsolatedStorageScope.User | IsolatedStorageScope.Assembly, isf.Scope, "Scope");
203                         Assert.IsTrue ((isf.AssemblyIdentity is Url), "AssemblyIdentity");
204                         Assert.IsTrue ((isf.AssemblyIdentity.ToString ().IndexOf (Assembly.GetExecutingAssembly ().CodeBase) > 0), "Url");
205 #endif
206                         Assert.IsTrue ((isf.CurrentSize >= 0), "CurrentSize");
207                 }
208                 
209 #if !NET_2_1
210                 [Test]
211                 [ExpectedException (typeof (IsolatedStorageException))]
212                 public void GetUserStoreForApplication_AssemblyIdentity ()
213                 {
214                         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication ();
215                         object o = isf.AssemblyIdentity;
216                 }
217
218                 [Test]
219                 [ExpectedException (typeof (IsolatedStorageException))]
220                 public void GetUserStoreForApplication_DomainIdentity ()
221                 {
222                         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication ();
223                         object o = isf.DomainIdentity;
224                 }
225 #endif
226
227                 // This is supposed to be working only in SL.
228                 [Test]
229                 [ExpectedException (typeof (NotSupportedException))]
230                 public void GetUserStoreForSite ()
231                 {
232                         IsolatedStorageFile.GetUserStoreForSite ();
233                 }
234
235                 [Test]
236                 public void GetStore_Domain_Zone ()
237                 {
238                         IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly;
239                         IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, typeof (Zone), typeof (Zone));
240                         Assert.AreEqual (Int64.MaxValue, isf.MaximumSize, "MaximumSize");
241 #if !NET_2_1
242                         Assert.AreEqual (IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly, isf.Scope, "Scope");
243                         Assert.IsTrue ((isf.AssemblyIdentity is Zone), "AssemblyIdentity");
244                         Assert.IsTrue ((isf.AssemblyIdentity.ToString ().IndexOf ("MyComputer") > 0), "Zone - Assembly");
245                         Assert.IsTrue ((isf.DomainIdentity is Zone), "DomainIdentity");
246                         Assert.IsTrue ((isf.DomainIdentity.ToString ().IndexOf ("MyComputer") > 0), "Zone - Domain");
247 #endif
248                         Assert.IsTrue ((isf.CurrentSize >= 0), "CurrentSize");
249                 }
250
251                 [Test]
252 #if !MOBILE
253                 [ExpectedException (typeof (IsolatedStorageException))]
254 #endif
255                 public void GetStore_Domain_NonPresentEvidences ()
256                 {
257                         IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly;
258                         IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, typeof (StrongName), typeof (Publisher));
259                 }
260
261                 [Test]
262                 public void GetStore_Assembly_NonPresentDomainEvidences ()
263                 {
264                         IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Assembly;
265                         IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, typeof (StrongName), typeof (Url));
266                         Assert.AreEqual (Int64.MaxValue, isf.MaximumSize, "MaximumSize");
267                         Assert.AreEqual (scope, isf.Scope, "Scope");
268 #if !NET_2_1
269                         Assert.IsTrue ((isf.AssemblyIdentity is Url), "AssemblyIdentity");
270                         // note: mono transforms the CodeBase into uppercase
271                         // for net 1.1 which uses file:// and not file:///
272                         string codebase = Assembly.GetExecutingAssembly ().CodeBase.ToUpper ().Substring (8);
273                         Assert.IsTrue ((isf.AssemblyIdentity.ToString ().ToUpper ().IndexOf (codebase) > 0), "Url");
274                         // DomainIdentity throws a InvalidOperationException
275 #endif
276                         Assert.IsTrue ((isf.CurrentSize >= 0), "CurrentSize");
277                 }
278
279 #if !MOBILE
280                 [Test]
281                 [ExpectedException (typeof (ArgumentNullException))]
282                 public void GetStore_Domain_DomainNullObject ()
283                 {
284                         IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly;
285                         IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, (object)null, new Zone (SecurityZone.MyComputer));
286                 }
287
288                 [Test]
289                 [ExpectedException (typeof (ArgumentNullException))]
290                 public void GetStore_Domain_AssemblyNullObject ()
291                 {
292                         IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly;
293                         IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, new Zone (SecurityZone.MyComputer), (object)null);
294                 }
295
296                 [Test]
297                 public void GetStore_Assembly_DomainNullObject ()
298                 {
299                         IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Assembly;
300                         IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, (object)null, new Zone (SecurityZone.Internet));
301                         Assert.AreEqual (Int64.MaxValue, isf.MaximumSize, "MaximumSize");
302                         Assert.AreEqual (scope, isf.Scope, "Scope");
303                         Assert.IsTrue ((isf.AssemblyIdentity is Zone), "AssemblyIdentity");
304                         Assert.IsTrue ((isf.AssemblyIdentity.ToString ().IndexOf ("Internet") > 0), "Zone - Assembly");
305                         Assert.IsTrue ((isf.CurrentSize >= 0), "CurrentSize");
306                 }
307
308                 [Test]
309                 [ExpectedException (typeof (ArgumentNullException))]
310                 public void GetStore_Assembly_AssemblyNullObject ()
311                 {
312                         IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Assembly;
313                         IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, new Zone (SecurityZone.MyComputer), (object)null);
314                 }
315
316                 [Test]
317                 public void GetStore_Domain_ZoneObjectZoneObject ()
318                 {
319                         IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly;
320                         IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, new Zone (SecurityZone.Internet), new Zone (SecurityZone.Internet));
321                         Assert.AreEqual (Int64.MaxValue, isf.MaximumSize, "MaximumSize");
322                         Assert.AreEqual (scope, isf.Scope, "Scope");
323                         Assert.IsTrue ((isf.AssemblyIdentity is Zone), "AssemblyIdentity");
324                         Assert.IsTrue ((isf.AssemblyIdentity.ToString ().IndexOf ("Internet") > 0), "Zone - Assembly");
325                         Assert.IsTrue ((isf.DomainIdentity is Zone), "DomainIdentity");
326                         Assert.IsTrue ((isf.DomainIdentity.ToString ().IndexOf ("Internet") > 0), "Zone - Domain");
327                         Assert.IsTrue ((isf.CurrentSize >= 0), "CurrentSize");
328                 }
329 #endif
330
331                 [Test]
332                 [ExpectedException (typeof (ArgumentNullException))]
333                 public void GetStore_Application_NullObject ()
334                 {
335                         IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Application;
336                         IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, (object)null);
337                 }
338
339                 [Test]
340 #if !MOBILE
341                 [ExpectedException (typeof (IsolatedStorageException))]
342 #endif
343                 public void GetStore_Application_NullType ()
344                 {
345                         IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Application;
346                         IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, (Type)null);
347                         // again it's the lack of a manifest
348                 }
349
350 #if !MOBILE
351                 [Test]
352                 public void GetStore_DomainScope_Evidences ()
353                 {
354                         IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly;
355
356                         Evidence de = new Evidence ();
357                         de.AddHost (new Zone (SecurityZone.Internet));
358                         Evidence ae = new Evidence ();
359                         ae.AddHost (new Zone (SecurityZone.Intranet));
360                         IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, de, typeof (Zone), ae, typeof (Zone));
361
362                         // Maximum size for Internet isn't (by default) Int64.MaxValue
363                         Assert.AreEqual (scope, isf.Scope, "Scope");
364 #if !NET_2_1
365                         Assert.IsTrue ((isf.AssemblyIdentity is Zone), "AssemblyIdentity");
366                         Assert.IsTrue ((isf.AssemblyIdentity.ToString ().IndexOf ("Intranet") > 0), "Zone - Assembly");
367                         Assert.IsTrue ((isf.DomainIdentity is Zone), "DomainIdentity");
368                         Assert.IsTrue ((isf.DomainIdentity.ToString ().IndexOf ("Internet") > 0), isf.DomainIdentity.ToString ()); //"Zone - Domain");
369 #endif
370                         Assert.IsTrue ((isf.CurrentSize >= 0), "CurrentSize");
371                 }
372
373                 [Test]
374                 [ExpectedException (typeof (ArgumentNullException))]
375                 public void GetStore_DomainScope_Evidence_NullAssemblyEvidence ()
376                 {
377                         IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly;
378
379                         Evidence de = new Evidence ();
380                         de.AddHost (new Zone (SecurityZone.Internet));
381                         IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, de, typeof (Zone), null, null);
382                 }
383
384                 [Test]
385                 [ExpectedException (typeof (ArgumentNullException))]
386                 public void GetStore_DomainScope_Evidence_NullDomainEvidence ()
387                 {
388                         IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly;
389
390                         Evidence ae = new Evidence ();
391                         ae.AddHost (new Zone (SecurityZone.Internet));
392                         IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, null, null, ae, typeof (Zone));
393                 }
394
395                 [Test]
396                 [ExpectedException (typeof (ArgumentNullException))]
397                 public void GetStore_AssemblyScope_Evidence_NullAssemblyEvidence ()
398                 {
399                         IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Assembly;
400
401                         Evidence de = new Evidence ();
402                         de.AddHost (new Zone (SecurityZone.Internet));
403                         IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, de, typeof (Zone), null, null);
404                 }
405
406                 [Test]
407                 public void GetStore_AssemblyScope_Evidence_NullDomainEvidence ()
408                 {
409                         IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Assembly;
410
411                         Evidence ae = new Evidence ();
412                         ae.AddHost (new Zone (SecurityZone.Internet));
413                         IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, null, null, ae, typeof (Zone));
414                 }
415 #endif
416
417                 [Test]
418                 public void RegressionBNC354539 ()
419                 {
420                         string filename = "test-bnc-354539";
421                         byte[] expected = new byte[] { 0x01, 0x42, 0x00 };
422                         byte[] actual = new byte [expected.Length];
423
424                         using (IsolatedStorageFile file = IsolatedStorageFile.GetStore (IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null)) {
425                                 using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream (filename, FileMode.Create, FileAccess.Write, FileShare.None, file)) {
426                                         stream.Write (expected, 0, expected.Length);
427                                 }
428                         }
429
430                         using (IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForAssembly ()) {
431                                 using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream (filename, FileMode.Open, FileAccess.Read, FileShare.Read, file)) {
432                                         stream.Read (actual, 0, actual.Length);
433                                 }
434
435                                 file.DeleteFile (filename);
436                         }
437                         
438                         Assert.AreEqual (expected, actual);
439                 }
440
441                 [Test]
442                 [ExpectedException (typeof (ArgumentNullException))]
443                 public void CreateDirectory_Null ()
444                 {
445                         IsolatedStorageFile.GetUserStoreForAssembly ().CreateDirectory (null);
446                 }
447
448                 [Test]
449                 public void CreateDirectory_FileWithSameNameExists ()
450                 {
451                         string path = "bug374377";
452                         using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForDomain ()) {
453                                 using (IsolatedStorageFileStream fs = new IsolatedStorageFileStream (path, FileMode.OpenOrCreate, isf)) {
454                                 }
455                                 try {
456                                         isf.CreateDirectory (path);
457                                 }
458                                 catch (IsolatedStorageException ex) {
459                                         Assert.IsFalse (ex.Message.IndexOf (path) >= 0, "Message");
460                                         Assert.IsNull (ex.InnerException, "InnerException");
461                                 }
462                         }
463                 }
464
465                 [Test]
466                 public void CreateDirectory_DirectoryWithSameNameExists ()
467                 {
468                         string dir = "new-dir";
469                         string file = Path.Combine (dir, "new-file");
470                         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
471                         try {
472                                 isf.CreateDirectory (dir);
473                                 using (IsolatedStorageFileStream isfs = new IsolatedStorageFileStream (file, FileMode.OpenOrCreate, isf)) {
474                                         isfs.WriteByte (0);
475                                 }
476                                 string pattern = Path.Combine (dir, "*");
477                                 Assert.AreEqual (1, isf.GetFileNames (file).Length, "file exists");
478
479                                 // create again directory
480                                 isf.CreateDirectory (dir);
481                                 Assert.AreEqual (1, isf.GetFileNames (file).Length, "file still exists");
482                         }
483                         finally {
484                                 isf.DeleteFile (file);
485                                 isf.DeleteDirectory (dir);
486                         }
487                 }
488
489                 [Test]
490                 [ExpectedException (typeof (ArgumentException))]
491                 public void GetFilesInSubdirs ()
492                 {
493                         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
494                         string pattern = Path.Combine ("..", "*");
495                         isf.GetFileNames (pattern);
496                 }
497
498         
499                 [Test]
500                 [ExpectedException (typeof (ArgumentException))]
501                 public void GetDirsInSubDirs ()
502                 {
503                         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
504                         isf.CreateDirectory ("subdir");
505                         string [] dir_names = isf.GetDirectoryNames ("subdir/../*");
506                 }
507
508                 [Test] // https://bugzilla.novell.com/show_bug.cgi?id=376188
509                 public void CreateSubDirectory ()
510                 {
511                         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
512                         isf.CreateDirectory ("subdir");
513                         isf.CreateDirectory ("subdir/subdir2");
514                         Assert.AreEqual (1, isf.GetDirectoryNames ("*").Length, "subdir");
515                         Assert.AreEqual (1, isf.GetDirectoryNames ("subdir/*").Length, "subdir/subdir2");
516                         isf.DeleteDirectory ("subdir/subdir2");
517                         isf.DeleteDirectory ("subdir");
518                 }
519
520                 [Test]
521                 [ExpectedException (typeof (IsolatedStorageException))]
522                 public void DeleteDirectory_NonEmpty ()
523                 {
524                         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
525                         isf.CreateDirectory ("subdir");
526                         isf.CreateDirectory ("subdir/subdir2");
527                         isf.DeleteDirectory ("subdir");
528                 }
529
530                 [Test]
531                 public void DeleteFile ()
532                 {
533                         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
534
535                         try {
536                                 isf.DeleteFile (null);
537                                 Assert.Fail ("#Exc0");
538                         } catch (ArgumentNullException) {
539                         }
540
541                         // We are getting an internal IndexOutOfRangeException in 2.0
542                         // Not sure we want to mimic that one.
543                         try {
544                                 isf.DeleteFile (String.Empty);
545                                 Assert.Fail ("#Exc1");
546                         } catch (IsolatedStorageException) {
547                         }
548
549                         try {
550                                 isf.DeleteFile ("idontexist");
551                                 Assert.Fail ("#Exc2");
552                         } catch (IsolatedStorageException) {
553                         }
554
555                         try {
556                                 isf.DeleteFile ("../../file");
557                                 Assert.Fail ("#Exc3");
558                         } catch (IsolatedStorageException) {
559                         }
560                 
561                         try {
562                                 isf.DeleteFile ("subdir/file");
563                                 Assert.Fail ("#Exc4");
564                         } catch (IsolatedStorageException) {
565                         }
566
567                         isf.CreateDirectory ("subdir");
568                         try {
569                                 isf.DeleteFile ("subdir");
570                                 Assert.Fail ("#Exc5");
571                         } catch (IsolatedStorageException) {
572                         }
573                 }
574
575                 [Test]
576                 public void GetStore_NullTypes ()
577                 {
578                         IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Roaming | IsolatedStorageScope.Assembly | IsolatedStorageScope.Domain;
579                         IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, null, null);
580 #if !NET_2_1
581                         Assert.AreEqual (typeof (Url), isf.AssemblyIdentity.GetType (), "AssemblyIdentity");
582                         Assert.AreEqual (typeof (Url), isf.DomainIdentity.GetType (), "DomainIdentity");
583 #endif
584                 }
585
586                 [Test]
587                 public void RemoveFromOtherInstance ()
588                 {
589                         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
590                         IsolatedStorageFile isf2 = IsolatedStorageFile.GetUserStoreForAssembly ();
591
592                         isf.Remove ();
593                         try {
594                                 isf2.Remove ();
595                                 Assert.Fail ("#Exc1");
596                         } catch (IsolatedStorageException) {
597                         }
598                 }
599
600                 [Test]
601                 public void Remove ()
602                 {
603                         // Test that we can call Remove several times
604                         IsolatedStorageFile.Remove (IsolatedStorageScope.User);
605                         IsolatedStorageFile.Remove (IsolatedStorageScope.User);
606
607                         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
608                         isf.Remove ();
609
610                         // The second call to Remove should cause an InvalidOperationException, due to
611                         // marking itself as closed.
612                         try {
613                                 isf.Remove ();
614                                 Assert.Fail ("#Exc1");
615                         } catch (InvalidOperationException) {
616                         }
617
618                         // Open, Close and try to Remove
619                         isf = IsolatedStorageFile.GetUserStoreForAssembly ();
620                         isf.Close ();
621                         try {
622                                 isf.Remove ();
623                                 Assert.Fail ("#Exc2");
624                         } catch (InvalidOperationException) {
625                         }
626                 }
627
628                 [Test]
629                 public void UsedSize ()
630                 {
631                         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
632                         IsolatedStorageFileStream isfs = isf.CreateFile ("file");
633                         StreamWriter writer = new StreamWriter (isfs);
634                         writer.WriteLine ("hello mono");
635                         writer.Close ();
636
637                         Assert.AreEqual (true, isf.UsedSize > 0, "#A0");
638
639                         isf.Close ();
640                         try {
641                                 Console.WriteLine (isf.UsedSize);
642                                 Assert.Fail ("#Exc1");
643                         } catch (InvalidOperationException) {
644                         }
645
646                         isf.Dispose ();
647                         try {
648                                 Console.WriteLine (isf.UsedSize);
649                                 Assert.Fail ("#Exc2");
650                         } catch (ObjectDisposedException) {
651                         }
652                 }
653
654                 [Test]
655                 public void IncreateQuotaTo ()
656                 {
657                         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
658
659                         try {
660                                 isf.IncreaseQuotaTo (-2);
661                                 Assert.Fail ("#Exc1");
662                         } catch (ArgumentException) {
663                         }
664
665                         // I wonder how this behaves on some systems
666                         try {
667                                 isf.IncreaseQuotaTo (100);
668                                 Assert.Fail ("#Exc2");
669                         } catch (ArgumentException) {
670                         }
671
672                         // Since 'Quota' seems to be returning Int64.MaxValue, we cannot truly test against a value
673                         // larger than that.
674                 }
675
676                 [Test]
677                 public void DirectoryExists ()
678                 {
679                         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
680                         isf.CreateDirectory ("subdir");
681                         isf.CreateDirectory ("subdir/subdir2");
682                         isf.CreateDirectory ("subdir3");
683
684                         Assert.AreEqual (true, isf.DirectoryExists ("subdir/"), "#A0");
685                         Assert.AreEqual (true, isf.DirectoryExists ("subdir/subdir2/"), "#A1");
686                         Assert.AreEqual (true, isf.DirectoryExists ("subdir3"), "#A2");
687                         Assert.AreEqual (true, isf.DirectoryExists (String.Empty), "#A3"); // Weird
688                         Assert.AreEqual (false, isf.DirectoryExists ("subdir99"), "#A4");
689                         Assert.AreEqual (false, isf.DirectoryExists ("../../subdir"), "#A5");
690                         Assert.AreEqual (false, isf.DirectoryExists ("*"), "#A5");
691                         Assert.AreEqual (false, isf.DirectoryExists ("subdir*"), "#A6");
692
693                         isf.DeleteDirectory ("subdir3");
694                         Assert.AreEqual (false, isf.DirectoryExists ("subdir3"), "#B0");
695
696                         isf.DeleteDirectory ("subdir/subdir2");
697                         isf.DeleteDirectory ("subdir");
698
699                         try {
700                                 isf.DirectoryExists (null);
701                                 Assert.Fail ("#Exc1");
702                         } catch (ArgumentNullException) {
703                         }
704
705                         isf.Close ();
706                         try {
707                                 isf.DirectoryExists ("subdir");
708                                 Assert.Fail ("#Exc2");
709                         } catch (InvalidOperationException) {
710                         }
711
712                         isf.Dispose ();
713                         try {
714                                 isf.DirectoryExists ("subdir");
715                                 Assert.Fail ("#Exc3");
716                         } catch (ObjectDisposedException) {
717                         }
718
719                         // We want to be sure that if not closing but disposing
720                         // should fire ObjectDisposedException instead of InvalidOperationException
721                         isf = IsolatedStorageFile.GetUserStoreForAssembly ();
722                         isf.Dispose ();
723
724                         try {
725                                 isf.DirectoryExists ("subdir");
726                                 Assert.Fail ("#Exc4");
727                         } catch (ObjectDisposedException) {
728                         }
729                 }
730
731                 [Test]
732                 public void FileExists ()
733                 {
734                         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
735                         IsolatedStorageFileStream file_a = new IsolatedStorageFileStream ("file-a", FileMode.Create, isf);
736                         IsolatedStorageFileStream file_b = new IsolatedStorageFileStream ("file-b", FileMode.Create, isf);
737                         file_a.Close ();
738                         file_b.Close ();
739
740                         Assert.AreEqual (true, isf.FileExists ("file-a"), "#A0");
741                         Assert.AreEqual (true, isf.FileExists ("file-b"), "#A1");
742                         Assert.AreEqual (false, isf.FileExists (String.Empty), "#A2");
743                         Assert.AreEqual (false, isf.FileExists ("file-"), "#A3");
744                         Assert.AreEqual (false, isf.FileExists ("file-*"), "#A4");
745                         Assert.AreEqual (false, isf.FileExists ("../../file-a"), "#A5");
746
747                         isf.CreateDirectory ("subdir");
748                         Assert.AreEqual (false, isf.FileExists ("subdir"), "#B0");
749
750                         try {
751                                 isf.FileExists (null);
752                                 Assert.Fail ("#Exc1");
753                         } catch (ArgumentNullException) {
754                         }
755
756                         isf.Close ();
757                         try {
758                                 isf.FileExists ("file-a");
759                                 Assert.Fail ("#Exc2");
760                         } catch (InvalidOperationException) {
761                         }
762
763                         isf.Dispose ();
764                         try {
765                                 isf.FileExists ("file-a");
766                                 Assert.Fail ("#Exc3");
767                         } catch (ObjectDisposedException) {
768                         }
769                 }
770
771                 [Test]
772                 public void CreateFile ()
773                 {
774                         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
775                         // Make sure we are actually creating it, by first removing it in case it already exists
776                         if (isf.FileExists ("file-a"))
777                                 isf.DeleteFile ("file-a");
778
779                         IsolatedStorageFileStream isf_stream = isf.CreateFile ("file-a");
780                         isf_stream.Close ();
781                         Assert.AreEqual (true, isf.FileExists ("file-a"), "#A0");
782
783                         // Re-open the file that is already created, so we make sure we are passing
784                         // the proper FileOpen
785                         isf_stream = isf.CreateFile ("file-a");
786                         isf_stream.Close ();
787
788                         try {
789                                 isf.CreateFile (null);
790                                 Assert.Fail ("#Exc1");
791                         } catch (ArgumentNullException) {
792                         }
793
794                         try {
795                                 isf.CreateFile ("random-dir/fileb");
796                                 Assert.Fail ("#Exc2");
797                         } catch (DirectoryNotFoundException) {
798                         }
799
800                         isf.Close ();
801                         try {
802                                 isf.CreateFile ("file-b");
803                                 Assert.Fail ("#Exc3");
804                         } catch (InvalidOperationException) {
805                         }
806
807                         isf.Dispose ();
808                         try {
809                                 isf.CreateFile ("file-a");
810                                 Assert.Fail ("#Exc4");
811                         } catch (ObjectDisposedException) {
812                         }
813                 }
814
815                 [Test]
816                 public void GetCreationTime ()
817                 {
818                         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
819
820                         // This is not causing an exception
821                         isf.GetCreationTime ("doesntexist");
822                         isf.GetCreationTime ("dir/doesntexist");
823
824                         try {
825                                 isf.GetCreationTime (String.Empty);
826                                 Assert.Fail ("#Exc1");
827                         } catch (ArgumentException) {
828                         }
829
830                         try {
831                                 isf.GetCreationTime ("   ");
832                                 Assert.Fail ("#Exc2");
833                         } catch (ArgumentException) {
834                         }
835
836                         isf.Close ();
837                         try {
838                                 isf.GetCreationTime ("doesntexist");
839                                 Assert.Fail ("#Exc3");
840                         } catch (InvalidOperationException) {
841                         }
842
843                         isf.Dispose ();
844                         try {
845                                 isf.GetCreationTime ("doesntexist");
846                                 Assert.Fail ("#Exc4");
847                         } catch (ObjectDisposedException) {
848                         }
849                 }
850
851                 [Test]
852                 public void MoveDirectory ()
853                 {
854                         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
855                         // Mare sure to remove them if they exist already
856                         if (isf.DirectoryExists ("subdir"))
857                                 isf.DeleteDirectory ("subdir");
858                         if (isf.DirectoryExists ("subdir-new"))
859                                 isf.DeleteDirectory ("subdir-new");
860
861                         isf.CreateDirectory ("subdir");
862                         Assert.AreEqual (true, isf.DirectoryExists ("subdir"), "#A0");
863
864                         isf.MoveDirectory ("subdir", "subdir-new");
865                         Assert.AreEqual (false, isf.DirectoryExists ("subdir"), "#A1");
866                         Assert.AreEqual (true, isf.DirectoryExists ("subdir-new"), "#A2");
867
868                         try {
869                                 isf.MoveDirectory (String.Empty, "subdir-new-new");
870                                 Assert.Fail ("#Exc1");
871                         } catch (ArgumentException) {
872                         }
873
874                         try {
875                                 isf.MoveDirectory ("  ", "subdir-new-new");
876                                 Assert.Fail ("#Exc2");
877                         } catch (ArgumentException) {
878                         }
879
880                         try {
881                                 isf.MoveDirectory ("doesntexist", "subdir-new-new");
882                                 Assert.Fail ("#Exc3");
883                         } catch (DirectoryNotFoundException) {
884                         }
885
886                         try {
887                                 isf.MoveDirectory ("doesnexist/doesntexist", "subdir-new-new");
888                                 Assert.Fail ("#Exc4");
889                         } catch (DirectoryNotFoundException) {
890                         }
891
892                         try {
893                                 isf.MoveDirectory ("subdir-new", "doesntexist/doesntexist");
894                                 Assert.Fail ("#Exc5");
895                         } catch (DirectoryNotFoundException) {
896                         }
897
898                         // Out of storage dir
899                         try {
900                                 isf.MoveDirectory ("subdir-new", "../../subdir-new");
901                                 Assert.Fail ("#Exc6");
902                         } catch (IsolatedStorageException) {
903                         }
904
905                         isf.Remove ();
906                         isf.Close ();
907                         isf.Dispose ();
908                 }
909
910                 [Test]
911                 public void CopyFile ()
912                 {
913                         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
914                         if (isf.FileExists ("file"))
915                                 isf.DeleteFile ("file");
916                         if (isf.FileExists ("file-new"))
917                                 isf.DeleteFile ("file-new");
918
919                         isf.CreateFile ("file").Close ();
920                         isf.CopyFile ("file", "file-new");
921                         Assert.AreEqual (true, isf.FileExists ("file"), "#A0");
922                         Assert.AreEqual (true, isf.FileExists ("file-new"), "#A1");
923
924                         // At this point 'file-exists' already exists.
925                         isf.CopyFile ("file", "file-new", true);
926                         Assert.AreEqual (true, isf.FileExists ("file"), "#B0");
927                         Assert.AreEqual (true, isf.FileExists ("file-new"), "#B1");
928
929                         isf.CreateDirectory ("subdir");
930                         isf.CreateFile ("subdir/subfile").Close ();
931                         isf.CopyFile ("subdir/subfile", "subdir/subfile-new");
932                         Assert.AreEqual (true, isf.FileExists ("subdir/subfile"), "#C0");
933                         Assert.AreEqual (true, isf.FileExists ("subdir/subfile-new"), "#C1");
934
935                         try {
936                                 isf.CopyFile ("file", "file-new");
937                                 Assert.Fail ("#Exc0");
938                         } catch (IsolatedStorageException) {
939                         }
940
941                         // Using the same file name is failing for even when passing override=true.
942                         try {
943                                 isf.CopyFile ("file-new", "file-new", true);
944                                 Assert.Fail ("#Exc1");
945                         } catch (IsolatedStorageException) {
946                         }
947
948                         try {
949                                 isf.CopyFile ("file-new", "file-new", false);
950                                 Assert.Fail ("#Exc2");
951                         } catch (IsolatedStorageException) {
952                         }
953
954                         // Remove 'file-new' for cleaness purposes.
955                         isf.DeleteFile ("file-new");
956
957                         try {
958                                 isf.CopyFile ("doesntexist", "file-new", false);
959                                 Assert.Fail ("#Exc3");
960                         } catch (FileNotFoundException) {
961                         }
962
963                         try {
964                                 isf.CopyFile ("doesnexist/doesntexist", "file-new", false);
965                                 Assert.Fail ("#Exc4");
966                         } catch (DirectoryNotFoundException) {
967                         }
968
969                         // I'd have expected a DirectoryNotFoundException here.
970                         try {
971                                 isf.CopyFile ("file", "doesntexist/doesntexist");
972                                 Assert.Fail ("#Exc5");
973                         } catch (IsolatedStorageException) {
974                         }
975
976                         // Out of storage dir
977                         try {
978                                 isf.CopyFile ("file", "../../file");
979                                 Assert.Fail ("#Exc6");
980                         } catch (IsolatedStorageException) {
981                         }
982
983                         try {
984                                 isf.CopyFile ("../file", "file-new");
985                                 Assert.Fail ("#Exc7");
986                         } catch (IsolatedStorageException) {
987                         }
988
989                         // We are creating a subdirectory and files within it, so remove it just in case.
990                         isf.Remove ();
991
992                         isf.Close ();
993                         isf.Dispose ();
994                 }
995
996                 [Test]
997                 public void MoveFile ()
998                 {
999                         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
1000                         // Mare sure to remove them if they exist already
1001                         if (isf.FileExists ("file"))
1002                                 isf.DeleteFile ("file");
1003                         if (isf.FileExists ("file-new"))
1004                                 isf.DeleteFile ("file-new");
1005                         if (isf.FileExists ("subdir/subfile"))
1006                                 isf.DeleteFile ("subdir/subfile");
1007                         if (isf.FileExists ("subdir/subfile-new"))
1008                                 isf.DeleteFile ("subdir/subfile-new");
1009
1010                         isf.CreateFile ("file").Close ();
1011                         Assert.AreEqual (true, isf.FileExists ("file"), "#A0");
1012
1013                         // Same file
1014                         isf.MoveFile ("file", "file");
1015                         Assert.AreEqual (true, isf.FileExists ("file"), "#A0-1");
1016
1017                         isf.MoveFile ("file", "file-new");
1018                         Assert.AreEqual (false, isf.FileExists ("file"), "#A1");
1019                         Assert.AreEqual (true, isf.FileExists ("file-new"), "#A2");
1020
1021                         isf.CreateDirectory ("subdir");
1022                         isf.CreateFile ("subdir/subfile").Close ();
1023                         isf.MoveFile ("subdir/subfile", "subdir/subfile-new");
1024                         Assert.AreEqual (false, isf.FileExists ("subdir/subfile"), "#B0");
1025                         Assert.AreEqual (true, isf.FileExists ("subdir/subfile-new"), "#B1");
1026
1027                         try {
1028                                 isf.MoveFile (String.Empty, "file-new-new");
1029                                 Assert.Fail ("#Exc1");
1030                         } catch (ArgumentException) {
1031                         }
1032
1033                         try {
1034                                 isf.MoveFile ("  ", "file-new-new");
1035                                 Assert.Fail ("#Exc2");
1036                         } catch (ArgumentException e) {
1037                         }
1038
1039                         try {
1040                                 isf.MoveFile ("doesntexist", "file-new-new");
1041                                 Assert.Fail ("#Exc3");
1042                         } catch (FileNotFoundException) {
1043                         }
1044
1045                         // CopyFile is throwing a DirectoryNotFoundException here.
1046                         try {
1047                                 isf.MoveFile ("doesnexist/doesntexist", "file-new-new");
1048                                 Assert.Fail ("#Exc4");
1049                         } catch (FileNotFoundException) {
1050                         }
1051
1052                         // I'd have expected a DirectoryNotFoundException here.
1053                         try {
1054                                 isf.MoveFile ("file-new", "doesntexist/doesntexist");
1055                                 Assert.Fail ("#Exc5");
1056                         } catch (IsolatedStorageException) {
1057                         }
1058
1059                         // Out of storage dir
1060                         try {
1061                                 isf.MoveFile ("file-new", "../../file-new");
1062                                 Assert.Fail ("#Exc6");
1063                         } catch (IsolatedStorageException) {
1064                         }
1065
1066                         isf.Remove ();
1067                         isf.Close ();
1068                         isf.Dispose ();
1069                 }
1070
1071                 [Test]
1072                 public void MultiLevel ()
1073                 {
1074                         // see bug #4101
1075                         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
1076                         try {
1077                                 isf.CreateDirectory ("dir1");
1078                                 string [] dirs = isf.GetDirectoryNames ("*");
1079                                 Assert.AreEqual (dirs.Length, 1, "1a");
1080                                 Assert.AreEqual (dirs [0], "dir1", "1b");
1081         
1082                                 isf.CreateDirectory ("dir1/test");
1083                                 dirs = isf.GetDirectoryNames ("dir1/*");
1084                                 Assert.AreEqual (dirs.Length, 1, "2a");
1085                                 Assert.AreEqual (dirs [0], "test", "2b");
1086         
1087                                 isf.CreateDirectory ("dir1/test/test2a");
1088                                 isf.CreateDirectory ("dir1/test/test2b");
1089                                 dirs = isf.GetDirectoryNames ("dir1/test/*");
1090                                 Assert.AreEqual (dirs.Length, 2, "3a");
1091                                 Assert.AreEqual (dirs [0], "test2a", "3b");
1092                                 Assert.AreEqual (dirs [1], "test2b", "3c");
1093                         }
1094                         finally {
1095                                 isf.DeleteDirectory ("dir1/test/test2a");
1096                                 isf.DeleteDirectory ("dir1/test/test2b");
1097                                 isf.DeleteDirectory ("dir1/test");
1098                                 isf.DeleteDirectory ("dir1");
1099                         }
1100                 }
1101                 [Test]
1102                 public void RootedDirectory ()
1103                 {
1104                         IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
1105                         try {
1106                                 isf.CreateDirectory ("test/nested/directory/structure/without/root");
1107                                 isf.CreateDirectory ("/test/nested/directory/structure/with/root");
1108                         }
1109                         finally {
1110                                 isf.DeleteDirectory ("test/nested/directory/structure/without/root");
1111                                 isf.DeleteDirectory ("test/nested/directory/structure/without");
1112
1113                                 isf.DeleteDirectory ("/test/nested/directory/structure/with/root");
1114                                 isf.DeleteDirectory ("/test/nested/directory/structure/with");
1115                                 isf.DeleteDirectory ("/test/nested/directory/structure");
1116                                 isf.DeleteDirectory ("/test/nested/directory");
1117                                 isf.DeleteDirectory ("/test/nested");
1118                                 isf.DeleteDirectory ("/test");
1119                         }
1120                 }
1121         }
1122 }