Browse Source

2006-05-01 Chris Toshok <[email protected]>

	* MembershipTest.cs (GeneratePassword): add test for password
	generation.


svn path=/trunk/mcs/; revision=60130
Chris Toshok 19 years ago
parent
commit
08fa1dc9f4

+ 5 - 0
mcs/class/System.Web/Test/System.Web.Security/ChangeLog

@@ -1,3 +1,8 @@
+2006-05-01  Chris Toshok  <[email protected]>
+
+	* MembershipTest.cs (GeneratePassword): add test for password
+	generation.
+
 2005-09-21  Sebastien Pouliot  <[email protected]> 
 
 	* FormsAuthenticationTest.cs: CookieDomain property (2.0) changed from

+ 20 - 0
mcs/class/System.Web/Test/System.Web.Security/MembershipTest.cs

@@ -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");
+		}
 	}
 }