New test.
[mono.git] / mcs / class / corlib / Test / System.Security.Permissions / IsolatedStorageFilePermissionTest.cs
1 //
2 // IsolatedStorageFilePermissionTest.cs - NUnit Test Cases for IsolatedStorageFilePermission
3 //
4 // Author:
5 //      Sebastien Pouliot  <sebastien@ximian.com>
6 //
7 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
16 // 
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 // 
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28
29 using NUnit.Framework;
30 using System;
31 using System.Security;
32 using System.Security.Permissions;
33
34 namespace MonoTests.System.Security.Permissions {
35
36         [TestFixture]
37         public class IsolatedStorageFilePermissionTest {
38
39                 [Test]
40                 public void PermissionStateNone ()
41                 {
42                         IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission (PermissionState.None);
43                         Assert.AreEqual (IsolatedStorageContainment.None, isfp.UsageAllowed, "UsageAllowed");
44                         Assert.AreEqual (0, isfp.UserQuota, "UserQuota");
45
46                         SecurityElement se = isfp.ToXml ();
47                         // only class and version are present
48                         Assert.AreEqual ("None", se.Attribute ("Allowed"), "Xml-Allowed");
49                         Assert.IsNull (se.Children, "Xml-Children");
50
51                         IsolatedStorageFilePermission copy = (IsolatedStorageFilePermission)isfp.Copy ();
52                         Assert.IsFalse (Object.ReferenceEquals (isfp, copy), "ReferenceEquals");
53                         Assert.AreEqual (isfp.UsageAllowed, copy.UsageAllowed, "UsageAllowed");
54                         Assert.AreEqual (isfp.UserQuota, copy.UserQuota, "UserQuota");
55                 }
56
57                 [Test]
58                 public void PermissionStateUnrestricted ()
59                 {
60                         IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission (PermissionState.Unrestricted);
61                         Assert.AreEqual (IsolatedStorageContainment.UnrestrictedIsolatedStorage, isfp.UsageAllowed, "UsageAllowed");
62                         Assert.AreEqual (Int64.MaxValue, isfp.UserQuota, "UserQuota");
63
64                         SecurityElement se = isfp.ToXml ();
65                         // only class and version are present
66                         Assert.AreEqual ("true", se.Attribute ("Unrestricted"), "Xml-Unrestricted");
67                         Assert.IsNull (se.Children, "Xml-Children");
68
69                         IsolatedStorageFilePermission copy = (IsolatedStorageFilePermission)isfp.Copy ();
70                         Assert.IsFalse (Object.ReferenceEquals (isfp, copy), "ReferenceEquals");
71                         Assert.AreEqual (isfp.UsageAllowed, copy.UsageAllowed, "UsageAllowed");
72                         Assert.AreEqual (isfp.UserQuota, copy.UserQuota, "UserQuota");
73                 }
74
75                 [Test]
76                 [ExpectedException (typeof (ArgumentException))]
77                 public void PermissionStateInvalid ()
78                 {
79                         IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission ((PermissionState)2);
80                 }
81
82                 [Test]
83                 public void Intersect ()
84                 {
85                         IsolatedStorageFilePermission empty = new IsolatedStorageFilePermission (PermissionState.None);
86                         IsolatedStorageFilePermission intersect = (IsolatedStorageFilePermission)empty.Intersect (null);
87                         Assert.IsNull (intersect, "empty N null");
88
89                         intersect = (IsolatedStorageFilePermission)empty.Intersect (empty);
90                         Assert.IsNull (intersect, "empty N empty");
91
92                         IsolatedStorageFilePermission unrestricted = new IsolatedStorageFilePermission (PermissionState.Unrestricted);
93                         intersect = (IsolatedStorageFilePermission)unrestricted.Intersect (null);
94                         Assert.IsNull (intersect, "unrestricted N null");
95
96                         intersect = (IsolatedStorageFilePermission)unrestricted.Intersect (empty);
97                         Assert.IsNotNull (intersect, "unrestricted N empty");
98
99                         intersect = (IsolatedStorageFilePermission)unrestricted.Intersect (unrestricted);
100                         Assert.IsNotNull (intersect, "unrestricted N unrestricted");
101                 }
102
103                 [Test]
104                 [ExpectedException (typeof (ArgumentException))]
105                 public void Intersect_DifferentPermissions ()
106                 {
107                         IsolatedStorageFilePermission a = new IsolatedStorageFilePermission (PermissionState.None);
108                         SecurityPermission b = new SecurityPermission (PermissionState.None);
109                         a.Intersect (b);
110                 }
111
112                 [Test]
113                 public void IsSubsetOf ()
114                 {
115                         IsolatedStorageFilePermission empty = new IsolatedStorageFilePermission (PermissionState.None);
116                         Assert.IsTrue (empty.IsSubsetOf (null), "empty.IsSubsetOf (null)");
117
118                         IsolatedStorageFilePermission unrestricted = new IsolatedStorageFilePermission (PermissionState.Unrestricted);
119                         Assert.IsFalse (unrestricted.IsSubsetOf (null), "unrestricted.IsSubsetOf (null)");
120                         Assert.IsFalse (unrestricted.IsSubsetOf (empty), "unrestricted.IsSubsetOf (empty)");
121                         Assert.IsTrue (empty.IsSubsetOf (unrestricted), "empty.IsSubsetOf (unrestricted)");
122                 }
123
124                 [Test]
125                 [ExpectedException (typeof (ArgumentException))]
126                 public void IsSubsetOf_DifferentPermissions ()
127                 {
128                         IsolatedStorageFilePermission a = new IsolatedStorageFilePermission (PermissionState.None);
129                         SecurityPermission b = new SecurityPermission (PermissionState.None);
130                         a.IsSubsetOf (b);
131                 }
132
133                 [Test]
134                 public void Union ()
135                 {
136                         IsolatedStorageFilePermission empty = new IsolatedStorageFilePermission (PermissionState.None);
137                         IsolatedStorageFilePermission union = (IsolatedStorageFilePermission)empty.Union (null);
138                         Assert.IsNotNull (union, "empty U null");
139                         Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-1");
140                         Assert.IsFalse (Object.ReferenceEquals (empty, union), "ReferenceEquals-1");
141
142                         union = (IsolatedStorageFilePermission)empty.Union (empty);
143                         Assert.IsNotNull (union, "empty U empty");
144                         Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-2");
145                         Assert.IsFalse (Object.ReferenceEquals (empty, union), "ReferenceEquals-2");
146
147                         IsolatedStorageFilePermission unrestricted = new IsolatedStorageFilePermission (PermissionState.Unrestricted);
148                         union = (IsolatedStorageFilePermission)unrestricted.Union (null);
149                         Assert.IsNotNull (union, "unrestricted U null");
150                         Assert.IsTrue (union.IsUnrestricted (), "IsUnrestricted-3");
151                         Assert.IsFalse (Object.ReferenceEquals (unrestricted, union), "ReferenceEquals-3");
152
153                         union = (IsolatedStorageFilePermission)unrestricted.Union (empty);
154                         Assert.IsNotNull (union, "unrestricted U empty");
155                         Assert.IsTrue (union.IsUnrestricted (), "IsUnrestricted-4");
156                         Assert.IsFalse (Object.ReferenceEquals (unrestricted, union), "ReferenceEquals-4");
157
158                         union = (IsolatedStorageFilePermission)unrestricted.Union (unrestricted);
159                         Assert.IsNotNull (union, "unrestricted U unrestricted");
160                         Assert.IsTrue (union.IsUnrestricted (), "IsUnrestricted-5");
161                         Assert.IsFalse (Object.ReferenceEquals (unrestricted, union), "ReferenceEquals-5");
162                 }
163
164                 [Test]
165                 [ExpectedException (typeof (ArgumentException))]
166                 public void Union_DifferentPermissions ()
167                 {
168                         IsolatedStorageFilePermission a = new IsolatedStorageFilePermission (PermissionState.None);
169                         SecurityPermission b = new SecurityPermission (PermissionState.None);
170                         a.Union (b);
171                 }
172
173                 [Test]
174                 public void UsageAllowedQuota ()
175                 {
176                         IsolatedStorageFilePermission empty = new IsolatedStorageFilePermission (PermissionState.None);
177                         IsolatedStorageFilePermission small = new IsolatedStorageFilePermission (PermissionState.None);
178                         small.UsageAllowed = IsolatedStorageContainment.DomainIsolationByUser;
179                         small.UserQuota = 1;
180                         IsolatedStorageFilePermission union = (IsolatedStorageFilePermission)empty.Union (small);
181                         Assert.AreEqual (IsolatedStorageContainment.DomainIsolationByUser, union.UsageAllowed, "DomainIsolationByUser");
182                         Assert.AreEqual (1, union.UserQuota, "1");
183                         Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-1");
184                         Assert.IsTrue (small.IsSubsetOf (union), "IsSubset-1a");
185                         Assert.IsTrue (empty.IsSubsetOf (union), "IsSubset-1b");
186                         Assert.IsTrue (union.IsSubsetOf (small), "IsSubset-1c");
187                         IsolatedStorageFilePermission intersect = (IsolatedStorageFilePermission)union.Intersect (small);
188                         Assert.AreEqual (small.UsageAllowed, intersect.UsageAllowed, "Intersect-UsageAllowed-1");
189                         Assert.AreEqual (small.UserQuota, intersect.UserQuota, "Intersect-UserQuota-1");
190
191                         small.UsageAllowed = IsolatedStorageContainment.AssemblyIsolationByUser;
192                         small.UserQuota = 2;
193                         union = (IsolatedStorageFilePermission)union.Union (small);
194                         Assert.AreEqual (IsolatedStorageContainment.AssemblyIsolationByUser, union.UsageAllowed, "AssemblyIsolationByUser");
195                         Assert.AreEqual (2, union.UserQuota, "2");
196                         Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-2");
197                         Assert.IsTrue (small.IsSubsetOf (union), "IsSubset-2a");
198                         Assert.IsTrue (empty.IsSubsetOf (union), "IsSubset-2b");
199                         Assert.IsTrue (union.IsSubsetOf (small), "IsSubset-2c");
200                         intersect = (IsolatedStorageFilePermission)union.Intersect (small);
201                         Assert.AreEqual (small.UsageAllowed, intersect.UsageAllowed, "Intersect-UsageAllowed-2");
202                         Assert.AreEqual (small.UserQuota, intersect.UserQuota, "Intersect-UserQuota-2");
203 #if NET_2_0
204                         small.UsageAllowed = IsolatedStorageContainment.ApplicationIsolationByUser;
205                         small.UserQuota = 3;
206                         union = (IsolatedStorageFilePermission)union.Union (small);
207                         Assert.AreEqual (IsolatedStorageContainment.AssemblyIsolationByUser, union.UsageAllowed, "ApplicationIsolationByUser");
208                         Assert.AreEqual (3, union.UserQuota, "3");
209                         Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-3");
210                         Assert.IsTrue (small.IsSubsetOf (union), "IsSubset-3a");
211                         Assert.IsTrue (empty.IsSubsetOf (union), "IsSubset-3b");
212                         Assert.IsFalse (union.IsSubsetOf (small), "IsSubset-3c");
213                         intersect = (IsolatedStorageFilePermission)union.Intersect (small);
214                         Assert.AreEqual (small.UsageAllowed, intersect.UsageAllowed, "Intersect-UsageAllowed-3");
215                         Assert.AreEqual (small.UserQuota, intersect.UserQuota, "Intersect-UserQuota-3");
216
217                         small.UsageAllowed = IsolatedStorageContainment.DomainIsolationByMachine;
218                         small.UserQuota = 4;
219                         union = (IsolatedStorageFilePermission)union.Union (small);
220                         Assert.AreEqual (IsolatedStorageContainment.DomainIsolationByMachine, union.UsageAllowed, "DomainIsolationByMachine");
221                         Assert.AreEqual (4, union.UserQuota, "4");
222                         Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-4");
223                         Assert.IsTrue (small.IsSubsetOf (union), "IsSubset-4a");
224                         Assert.IsTrue (empty.IsSubsetOf (union), "IsSubset-4b");
225                         Assert.IsTrue (union.IsSubsetOf (small), "IsSubset-4c");
226                         intersect = (IsolatedStorageFilePermission)union.Intersect (small);
227                         Assert.AreEqual (small.UsageAllowed, intersect.UsageAllowed, "Intersect-UsageAllowed-4");
228                         Assert.AreEqual (small.UserQuota, intersect.UserQuota, "Intersect-UserQuota-4");
229
230                         small.UsageAllowed = IsolatedStorageContainment.AssemblyIsolationByMachine;
231                         small.UserQuota = 5;
232                         union = (IsolatedStorageFilePermission)union.Union (small);
233                         Assert.AreEqual (IsolatedStorageContainment.AssemblyIsolationByMachine, union.UsageAllowed, "AssemblyIsolationByMachine");
234                         Assert.AreEqual (5, union.UserQuota, "5");
235                         Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-5");
236                         Assert.IsTrue (small.IsSubsetOf (union), "IsSubset-5a");
237                         Assert.IsTrue (empty.IsSubsetOf (union), "IsSubset-5b");
238                         Assert.IsTrue (union.IsSubsetOf (small), "IsSubset-5c");
239                         intersect = (IsolatedStorageFilePermission)union.Intersect (small);
240                         Assert.AreEqual (small.UsageAllowed, intersect.UsageAllowed, "Intersect-UsageAllowed-5");
241                         Assert.AreEqual (small.UserQuota, intersect.UserQuota, "Intersect-UserQuota-5");
242
243                         small.UsageAllowed = IsolatedStorageContainment.ApplicationIsolationByMachine;
244                         small.UserQuota = 6;
245                         union = (IsolatedStorageFilePermission)union.Union (small);
246                         Assert.AreEqual (IsolatedStorageContainment.ApplicationIsolationByMachine, union.UsageAllowed, "ApplicationIsolationByMachine");
247                         Assert.AreEqual (6, union.UserQuota, "6");
248                         Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-6");
249                         Assert.IsTrue (small.IsSubsetOf (union), "IsSubset-6a");
250                         Assert.IsTrue (empty.IsSubsetOf (union), "IsSubset-6b");
251                         Assert.IsTrue (union.IsSubsetOf (small), "IsSubset-6c");
252                         intersect = (IsolatedStorageFilePermission)union.Intersect (small);
253                         Assert.AreEqual (small.UsageAllowed, intersect.UsageAllowed, "Intersect-UsageAllowed-6");
254                         Assert.AreEqual (small.UserQuota, intersect.UserQuota, "Intersect-UserQuota-6");
255 #endif
256                         small.UsageAllowed = IsolatedStorageContainment.DomainIsolationByRoamingUser;
257                         small.UserQuota = 7;
258                         union = (IsolatedStorageFilePermission)union.Union (small);
259                         Assert.AreEqual (IsolatedStorageContainment.DomainIsolationByRoamingUser, union.UsageAllowed, "DomainIsolationByRoamingUser");
260                         Assert.AreEqual (7, union.UserQuota, "7a");
261                         Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-7a");
262                         Assert.IsTrue (small.IsSubsetOf (union), "IsSubset-7a");
263                         Assert.IsTrue (empty.IsSubsetOf (union), "IsSubset-7b");
264                         Assert.IsTrue (union.IsSubsetOf (small), "IsSubset-7c");
265                         intersect = (IsolatedStorageFilePermission)union.Intersect (small);
266                         Assert.AreEqual (small.UsageAllowed, intersect.UsageAllowed, "Intersect-UsageAllowed-7");
267                         Assert.AreEqual (small.UserQuota, intersect.UserQuota, "Intersect-UserQuota-7");
268
269                         // can't go back ;-)
270                         small.UsageAllowed = IsolatedStorageContainment.DomainIsolationByUser;
271                         small.UserQuota = 1;
272                         union = (IsolatedStorageFilePermission)union.Union (small);
273                         Assert.AreEqual (IsolatedStorageContainment.DomainIsolationByRoamingUser, union.UsageAllowed, "DomainIsolationByRoamingUser");
274                         Assert.AreEqual (7, union.UserQuota, "7b");
275                         Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-7b");
276
277                         small.UsageAllowed = IsolatedStorageContainment.AssemblyIsolationByRoamingUser;
278                         small.UserQuota = 7; // no change
279                         union = (IsolatedStorageFilePermission)union.Union (small);
280                         Assert.AreEqual (IsolatedStorageContainment.AssemblyIsolationByRoamingUser, union.UsageAllowed, "AssemblyIsolationByRoamingUser");
281                         Assert.AreEqual (7, union.UserQuota, "7c");
282                         Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-7c");
283 #if NET_2_0
284                         small.UsageAllowed = IsolatedStorageContainment.ApplicationIsolationByRoamingUser;
285                         small.UserQuota = 8;
286                         union = (IsolatedStorageFilePermission)union.Union (small);
287                         Assert.AreEqual (IsolatedStorageContainment.ApplicationIsolationByRoamingUser, union.UsageAllowed, "ApplicationIsolationByRoamingUser");
288                         Assert.AreEqual (8, union.UserQuota, "8");
289                         Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-8");
290                         Assert.IsTrue (small.IsSubsetOf (union), "IsSubset-8a");
291                         Assert.IsTrue (empty.IsSubsetOf (union), "IsSubset-8b");
292                         Assert.IsTrue (union.IsSubsetOf (small), "IsSubset-8c");
293                         intersect = (IsolatedStorageFilePermission)union.Intersect (small);
294                         Assert.AreEqual (small.UsageAllowed, intersect.UsageAllowed, "Intersect-UsageAllowed-8");
295                         Assert.AreEqual (small.UserQuota, intersect.UserQuota, "Intersect-UserQuota-8");
296 #endif
297                         small.UsageAllowed = IsolatedStorageContainment.AdministerIsolatedStorageByUser;
298                         small.UserQuota = 9;
299                         union = (IsolatedStorageFilePermission)union.Union (small);
300                         Assert.AreEqual (IsolatedStorageContainment.AdministerIsolatedStorageByUser, union.UsageAllowed, "AdministerIsolatedStorageByUser");
301                         Assert.AreEqual (9, union.UserQuota, "9");
302                         Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-9");
303                         Assert.IsTrue (small.IsSubsetOf (union), "IsSubset-9a");
304                         Assert.IsTrue (empty.IsSubsetOf (union), "IsSubset-9b");
305                         Assert.IsTrue (union.IsSubsetOf (small), "IsSubset-9c");
306                         intersect = (IsolatedStorageFilePermission)union.Intersect (small);
307                         Assert.AreEqual (small.UsageAllowed, intersect.UsageAllowed, "Intersect-UsageAllowed-9");
308                         Assert.AreEqual (small.UserQuota, intersect.UserQuota, "Intersect-UserQuota-9");
309
310                         small.UsageAllowed = IsolatedStorageContainment.UnrestrictedIsolatedStorage;
311                         small.UserQuota = 10;
312                         union = (IsolatedStorageFilePermission)union.Union (small);
313                         Assert.AreEqual (IsolatedStorageContainment.UnrestrictedIsolatedStorage, union.UsageAllowed, "UnrestrictedIsolatedStorage");
314                         Assert.AreEqual (Int64.MaxValue, union.UserQuota, "10");
315                         Assert.IsTrue (union.IsUnrestricted (), "IsUnrestricted-10");
316                         Assert.IsTrue (small.IsSubsetOf (union), "IsSubset-10a");
317                         Assert.IsTrue (empty.IsSubsetOf (union), "IsSubset-10b");
318                         Assert.IsTrue (union.IsSubsetOf (small), "IsSubset-10c");
319                         intersect = (IsolatedStorageFilePermission)union.Intersect (small);
320                         Assert.AreEqual (small.UsageAllowed, intersect.UsageAllowed, "Intersect-UsageAllowed-10");
321                         Assert.IsFalse ((small.UserQuota == intersect.UserQuota), "Intersect-UserQuota-10");
322                 }
323
324                 [Test]
325                 [ExpectedException (typeof (ArgumentNullException))]
326                 public void FromXml_Null ()
327                 {
328                         IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission (PermissionState.None);
329                         isfp.FromXml (null);
330                 }
331
332                 [Test]
333                 [ExpectedException (typeof (ArgumentException))]
334                 public void FromXml_WrongTag ()
335                 {
336                         IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission (PermissionState.None);
337                         SecurityElement se = isfp.ToXml ();
338                         se.Tag = "IMono";
339                         isfp.FromXml (se);
340                 }
341
342                 [Test]
343                 [ExpectedException (typeof (ArgumentException))]
344                 public void FromXml_WrongTagCase ()
345                 {
346                         IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission (PermissionState.None);
347                         SecurityElement se = isfp.ToXml ();
348                         se.Tag = "IPERMISSION"; // instead of IPermission
349                         isfp.FromXml (se);
350                 }
351
352                 [Test]
353                 public void FromXml_WrongClass ()
354                 {
355                         IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission (PermissionState.None);
356                         SecurityElement se = isfp.ToXml ();
357
358                         SecurityElement w = new SecurityElement (se.Tag);
359                         w.AddAttribute ("class", "Wrong" + se.Attribute ("class"));
360                         w.AddAttribute ("version", se.Attribute ("version"));
361                         isfp.FromXml (w);
362                         // doesn't care of the class name at that stage
363                         // anyway the class has already be created so...
364                 }
365
366                 [Test]
367                 public void FromXml_NoClass ()
368                 {
369                         IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission (PermissionState.None);
370                         SecurityElement se = isfp.ToXml ();
371
372                         SecurityElement w = new SecurityElement (se.Tag);
373                         w.AddAttribute ("version", se.Attribute ("version"));
374                         isfp.FromXml (w);
375                         // doesn't even care of the class attribute presence
376                 }
377
378                 [Test]
379                 [ExpectedException (typeof (ArgumentException))]
380                 public void FromXml_WrongVersion ()
381                 {
382                         IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission (PermissionState.None);
383                         SecurityElement se = isfp.ToXml ();
384                         se.Attributes.Remove ("version");
385                         se.Attributes.Add ("version", "2");
386                         isfp.FromXml (se);
387                 }
388
389                 [Test]
390                 public void FromXml_NoVersion ()
391                 {
392                         IsolatedStorageFilePermission isfp = new IsolatedStorageFilePermission (PermissionState.None);
393                         SecurityElement se = isfp.ToXml ();
394
395                         SecurityElement w = new SecurityElement (se.Tag);
396                         w.AddAttribute ("class", se.Attribute ("class"));
397                         isfp.FromXml (w);
398                 }
399         }
400 }