Author: spouliot
Date: 2008-01-02 09:44:42 -0500 (Wed, 02 Jan 2008)
New Revision: 92105

Modified:
   trunk/mcs/class/corlib/Test/System.Security/ChangeLog
   trunk/mcs/class/corlib/Test/System.Security/SecureStringTest.cs
Log:
2008-01-02  Sebastien Pouliot  <[EMAIL PROTECTED]>

        * SecureStringTest.cs: Add test cases for Copy (#350840)



Modified: trunk/mcs/class/corlib/Test/System.Security/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/Test/System.Security/ChangeLog       2008-01-02 
14:44:00 UTC (rev 92104)
+++ trunk/mcs/class/corlib/Test/System.Security/ChangeLog       2008-01-02 
14:44:42 UTC (rev 92105)
@@ -1,3 +1,7 @@
+2008-01-02  Sebastien Pouliot  <[EMAIL PROTECTED]>
+
+       * SecureStringTest.cs: Add test cases for Copy (#350840)
+
 2007-11-07  Gert Driesen  <[EMAIL PROTECTED]>
 
        * SecurityElementTest.cs: Allow TestToString to pass on 1.0 profile.

Modified: trunk/mcs/class/corlib/Test/System.Security/SecureStringTest.cs
===================================================================
--- trunk/mcs/class/corlib/Test/System.Security/SecureStringTest.cs     
2008-01-02 14:44:00 UTC (rev 92104)
+++ trunk/mcs/class/corlib/Test/System.Security/SecureStringTest.cs     
2008-01-02 14:44:42 UTC (rev 92105)
@@ -144,6 +144,32 @@
                }
 #endif
                [Test]
+               public void Copy_Empty ()
+               {
+                       SecureString empty = new SecureString ();
+                       Assert.AreEqual (0, empty.Length, "Empty.Length");
+                       SecureString empty_copy = empty.Copy ();
+                       Assert.AreEqual (0, empty_copy.Length, 
"EmptyCopy.Length");
+               }
+
+               [Test]
+               public void Copy ()
+               {
+                       SecureString ss = new SecureString ();
+                       ss.AppendChar ('a');
+                       Assert.AreEqual (1, ss.Length, "Length");
+
+                       SecureString ss2 = ss.Copy();
+                       Assert.AreEqual (1, ss2.Length, "Copy.Length");
+                       Assert.IsFalse (ss2.IsReadOnly (), "Copy.IsReadOnly");
+                       ss2.MakeReadOnly ();
+                       Assert.IsTrue (ss2.IsReadOnly (), "Copy.IsReadOnly-2");
+
+                       SecureString ss3 = ss2.Copy ();
+                       Assert.IsFalse (ss3.IsReadOnly (), "Copy.IsReadOnly-3");
+               }
+
+               [Test]
                [ExpectedException (typeof (ArgumentOutOfRangeException))]
                public void InsertAt_Negative ()
                {

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

Reply via email to