Author: spouliot
Date: 2005-03-31 16:44:57 -0500 (Thu, 31 Mar 2005)
New Revision: 42451
Modified:
trunk/mcs/class/corlib/Test/System.Security/ChangeLog
trunk/mcs/class/corlib/Test/System.Security/SecurityExceptionCas.cs
Log:
2005-03-31 Sebastien Pouliot <[EMAIL PROTECTED]>
* SecurityExceptionCas.cs: Added new tests for GetObjectData.
Modified: trunk/mcs/class/corlib/Test/System.Security/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/Test/System.Security/ChangeLog 2005-03-31
21:43:29 UTC (rev 42450)
+++ trunk/mcs/class/corlib/Test/System.Security/ChangeLog 2005-03-31
21:44:57 UTC (rev 42451)
@@ -1,3 +1,7 @@
+2005-03-31 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * SecurityExceptionCas.cs: Added new tests for GetObjectData.
+
2005-01-30 Sebastien Pouliot <[EMAIL PROTECTED]>
* PermissionSetTest.cs: Changed [Ignore] to [Category("NotDotNet")] to
Modified: trunk/mcs/class/corlib/Test/System.Security/SecurityExceptionCas.cs
===================================================================
--- trunk/mcs/class/corlib/Test/System.Security/SecurityExceptionCas.cs
2005-03-31 21:43:29 UTC (rev 42450)
+++ trunk/mcs/class/corlib/Test/System.Security/SecurityExceptionCas.cs
2005-03-31 21:44:57 UTC (rev 42451)
@@ -31,6 +31,7 @@
using System;
using System.Reflection;
+using System.Runtime.Serialization;
using System.Security;
using System.Security.Permissions;
@@ -410,5 +411,26 @@
// as we pass the security checks for PermissionState
property
Assert.IsFalse (se.ToString ().IndexOf (sensitive) ==
-1, sensitive);
}
+
+ [Test]
+ public void GetObjectData ()
+ {
+ SecurityException se = new SecurityException
("message", typeof (string), "state");
+ SerializationInfo info = new SerializationInfo (typeof
(SecurityException), new FormatterConverter ());
+ se.GetObjectData (info, new StreamingContext
(StreamingContextStates.All));
+ Assert.AreEqual ("state", info.GetValue
("PermissionState", typeof (string)), "PermissionState");
+ }
+
+ [Test]
+ [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+ [ExpectedException (typeof (SerializationException))]
+ public void GetObjectData_Deny_Unrestricted ()
+ {
+ SecurityException se = new SecurityException
("message", typeof (string), "state");
+ SerializationInfo info = new SerializationInfo (typeof
(SecurityException), new FormatterConverter ());
+ se.GetObjectData (info, new StreamingContext
(StreamingContextStates.All));
+ // "PermissionState" hasn't been serialized because
it's access was restricted
+ info.GetValue ("PermissionState", typeof (string));
+ }
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches