2006-05-01 Chris Toshok <toshok@ximian.com>
authorChris Toshok <toshok@novell.com>
Mon, 1 May 2006 18:25:21 +0000 (18:25 -0000)
committerChris Toshok <toshok@novell.com>
Mon, 1 May 2006 18:25:21 +0000 (18:25 -0000)
* MembershipTest.cs (GeneratePassword): add test for password
generation.

svn path=/trunk/mcs/; revision=60130

mcs/class/System.Web/Test/System.Web.Security/ChangeLog
mcs/class/System.Web/Test/System.Web.Security/MembershipTest.cs

index 9d4ace95cd14805da6f5c71b8020b6cf0b73c4f9..f805c5cb333c4edf1bdc5b7338846368d5b21b9f 100644 (file)
@@ -1,3 +1,8 @@
+2006-05-01  Chris Toshok  <toshok@ximian.com>
+
+       * MembershipTest.cs (GeneratePassword): add test for password
+       generation.
+
 2005-09-21  Sebastien Pouliot  <sebastien@ximian.com> 
 
        * FormsAuthenticationTest.cs: CookieDomain property (2.0) changed from
index bdf692360edbd38e7f2c43a65ad0381c947a0c8a..15b509c7fae2fc26a973e7de4e306b4e9bfa8a92 100644 (file)
@@ -43,6 +43,26 @@ namespace MonoTests.System.Web.Security {
                {
                        Assert.IsNotNull (Membership.Provider, "Membership.Provider");
                }
+
+               [Test]
+               public void GeneratePassword ()
+               {
+                       string pwd;
+                       int count;
+                       int i;
+
+                       pwd = Membership.GeneratePassword (5, 0);
+                       Assert.AreEqual (5, pwd.Length, "A1");
+
+                       pwd = Membership.GeneratePassword (5, 1);
+                       Assert.AreEqual (5, pwd.Length, "A2");
+                       /* count up the non-alphanumeric characters in the string */
+                       count = 0;
+                       for (i = 0; i < pwd.Length; i ++)
+                               if (!Char.IsLetterOrDigit (pwd, i))
+                                       count++;
+                       Assert.IsTrue (count >= 1, "A2");
+               }
        }
 }