Author: spouliot
Date: 2005-06-14 10:23:03 -0400 (Tue, 14 Jun 2005)
New Revision: 45972

Modified:
   trunk/mcs/class/corlib/Test/System.IO.IsolatedStorage/ChangeLog
   
trunk/mcs/class/corlib/Test/System.IO.IsolatedStorage/IsolatedStorageFileCas.cs
Log:
2005-06-14  Sebastien Pouliot  <[EMAIL PROTECTED]>

        * IsolatedStorageFileCas.cs: Added MaximumSize unit tests.



Modified: trunk/mcs/class/corlib/Test/System.IO.IsolatedStorage/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/Test/System.IO.IsolatedStorage/ChangeLog     
2005-06-14 14:21:49 UTC (rev 45971)
+++ trunk/mcs/class/corlib/Test/System.IO.IsolatedStorage/ChangeLog     
2005-06-14 14:23:03 UTC (rev 45972)
@@ -1,3 +1,7 @@
+2005-06-14  Sebastien Pouliot  <[EMAIL PROTECTED]>
+
+       * IsolatedStorageFileCas.cs: Added MaximumSize unit tests.
+
 2005-06-05 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
 
        * IsolatedStorageFileStreamTest.cs:

Modified: 
trunk/mcs/class/corlib/Test/System.IO.IsolatedStorage/IsolatedStorageFileCas.cs
===================================================================
--- 
trunk/mcs/class/corlib/Test/System.IO.IsolatedStorage/IsolatedStorageFileCas.cs 
    2005-06-14 14:21:49 UTC (rev 45971)
+++ 
trunk/mcs/class/corlib/Test/System.IO.IsolatedStorage/IsolatedStorageFileCas.cs 
    2005-06-14 14:23:03 UTC (rev 45972)
@@ -34,6 +34,7 @@
 using System.IO.IsolatedStorage;
 using System.Security;
 using System.Security.Permissions;
+using System.Security.Policy;
 
 namespace MonoCasTests.System.IO.IsolatedStorageTest {
 
@@ -273,5 +274,44 @@
                        isf.Dispose ();
                        isf.Close ();
                }
+
+
+               private ulong MaximumSize (SecurityZone zone)
+               {
+                       IsolatedStorageScope scope = IsolatedStorageScope.User 
| IsolatedStorageScope.Assembly;
+
+                       Evidence ae = new Evidence ();
+                       ae.AddHost (new Zone (zone));
+                       IsolatedStorageFile isf = IsolatedStorageFile.GetStore 
(scope, null, null, ae, typeof (Zone));
+                       return isf.MaximumSize;
+               }
+
+               [Test]
+               public void MaximumSize ()
+               {
+                       Assert.AreEqual (Int64.MaxValue, MaximumSize 
(SecurityZone.MyComputer), "MyComputer");
+                       Assert.AreEqual (Int64.MaxValue, MaximumSize 
(SecurityZone.Intranet), "Intranet");
+#if NET_2_0
+                       Assert.AreEqual (512000, MaximumSize 
(SecurityZone.Internet), "Internet");
+                       Assert.AreEqual (512000, MaximumSize 
(SecurityZone.Trusted), "Trusted");
+#else
+                       Assert.AreEqual (10240, MaximumSize 
(SecurityZone.Internet), "Internet");
+                       Assert.AreEqual (10240, MaximumSize 
(SecurityZone.Trusted), "Trusted");
+#endif
+               }
+
+               [Test]
+               [ExpectedException (typeof (PolicyException))]
+               public void MaximumSize_Untrusted ()
+               {
+                       Assert.AreEqual (Int64.MaxValue, MaximumSize 
(SecurityZone.Untrusted), "Untrusted");
+               }
+
+               [Test]
+               [ExpectedException (typeof (PolicyException))]
+               public void MaximumSize_NoZone ()
+               {
+                       Assert.AreEqual (Int64.MaxValue, MaximumSize 
(SecurityZone.NoZone), "NoZone");
+               }
        }
 }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to