Author: krasnov
Date: 2006-11-23 04:23:48 -0500 (Thu, 23 Nov 2006)
New Revision: 68383

Added:
   
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangePasswordTest.cs
   
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/PasswordRecoveryTest.cs
   trunk/mcs/class/System.Web/Test/mainsoft/MainsoftWebApp20/WebControl.config
   trunk/mcs/class/System.Web/Test/mainsoft/NunitWebResources/WebControl.config
Modified:
   trunk/mcs/class/System.Web/ChangeLog
   trunk/mcs/class/System.Web/Makefile
   trunk/mcs/class/System.Web/System.Web_test.dll.sources
   trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
   trunk/mcs/class/System.Web/Test/TestMonoWeb20.vmwcsproj
   
trunk/mcs/class/System.Web/Test/mainsoft/MainsoftWebApp20/MainsoftWebApp20.vmwcsproj
   
trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/FakeMembershipProvider.cs
Log:
* System.Web_test.dll.sources: added PasswordRecoveryTest.cs, 
PasswordRecoveryTest.cs
* Makefile: added WebControl.config resource
* added: ChangePasswordTest.cs, PasswordRecoveryTest.cs

Modified: trunk/mcs/class/System.Web/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/ChangeLog        2006-11-23 08:58:28 UTC (rev 
68382)
+++ trunk/mcs/class/System.Web/ChangeLog        2006-11-23 09:23:48 UTC (rev 
68383)
@@ -1,5 +1,11 @@
 2006-11-09 Vladimir Krasnov <[EMAIL PROTECTED]>
 
+       * System.Web_test.dll.sources: added PasswordRecoveryTest.cs, 
+       PasswordRecoveryTest.cs
+       * Makefile: added WebControl.config resource
+
+2006-11-09 Vladimir Krasnov <[EMAIL PROTECTED]>
+
        * System.Web.dll.sources: added PasswordRecovery.cs
        * System.Web20.vmwcsproj: added PasswordRecovery.cs
 

Modified: trunk/mcs/class/System.Web/Makefile
===================================================================
--- trunk/mcs/class/System.Web/Makefile 2006-11-23 08:58:28 UTC (rev 68382)
+++ trunk/mcs/class/System.Web/Makefile 2006-11-23 09:23:48 UTC (rev 68383)
@@ -102,6 +102,7 @@
        Test/mainsoft/NunitWebResources/XMLDataSourceTest3.aspx \
        Test/mainsoft/NunitWebResources/XMLDataSourceTest4.aspx \
        Test/mainsoft/NunitWebResources/LoginViewTest1.aspx \
+       Test/mainsoft/NunitWebResources/WebControl.config \
        Test/mainsoft/NunitWebResources/WebLogin.config \
        Test/mainsoft/NunitWebResources/CallbackTest1.aspx \
        Test/mainsoft/NunitWebResources/CallbackTest2.aspx \

Modified: trunk/mcs/class/System.Web/System.Web_test.dll.sources
===================================================================
--- trunk/mcs/class/System.Web/System.Web_test.dll.sources      2006-11-23 
08:58:28 UTC (rev 68382)
+++ trunk/mcs/class/System.Web/System.Web_test.dll.sources      2006-11-23 
09:23:48 UTC (rev 68383)
@@ -144,6 +144,7 @@
 System.Web.UI.WebControls/CalendarDayTest.cs
 System.Web.UI.WebControls/CalendarTest.cs
 System.Web.UI.WebControls/CallBackTest.cs
+System.Web.UI.WebControls/ChangePasswordTest.cs
 System.Web.UI.WebControls/CheckBoxFieldTest.cs
 System.Web.UI.WebControls/CheckBoxListTest.cs
 System.Web.UI.WebControls/CheckBoxTest.cs
@@ -220,6 +221,7 @@
 System.Web.UI.WebControls/PagerSettingsTest.cs
 System.Web.UI.WebControls/PanelTest.cs
 System.Web.UI.WebControls/ParameterTest.cs
+System.Web.UI.WebControls/PasswordRecoveryTest.cs
 System.Web.UI.WebControls/PolygonHotSpotTest.cs
 System.Web.UI.WebControls/QueryStringParameterTest.cs
 System.Web.UI.WebControls/RadioButtonListTest.cs

Modified: trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog 
2006-11-23 08:58:28 UTC (rev 68382)
+++ trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog 
2006-11-23 09:23:48 UTC (rev 68383)
@@ -1,3 +1,7 @@
+2006-11-23  Vladimir Krasnov  <[EMAIL PROTECTED]>
+
+       * added: ChangePasswordTest.cs, PasswordRecoveryTest.cs
+
 2006-11-22  Vladimir Krasnov  <[EMAIL PROTECTED]>
 
        * SqlDataSourceDerbyTest.cs: fixed db init
@@ -2,3 +6,2 @@
 
-
 2006-11-22  Igor Zelmanovich   <[EMAIL PROTECTED]>

Added: 
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangePasswordTest.cs
===================================================================
--- 
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangePasswordTest.cs 
    2006-11-23 08:58:28 UTC (rev 68382)
+++ 
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangePasswordTest.cs 
    2006-11-23 09:23:48 UTC (rev 68383)
@@ -0,0 +1,575 @@
+//
+// ChangePasswordTest.cs - Unit tests for 
System.Web.UI.WebControls.ChangePassword
+//
+// Author:
+//     Vladimir Krasnov  <[EMAIL PROTECTED]>
+//
+// (C) 2005 Mainsoft Corporation (http://www.mainsoft.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.Drawing;
+using System.Threading;
+using System.Collections;
+using System.IO;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Web.Security;
+using System.Text.RegularExpressions;
+using MonoTests.SystemWeb.Framework;
+using MonoTests.stand_alone.WebHarness;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Web.UI.WebControls
+{
+
+       public class TestChangePassword : ChangePassword
+       {
+
+               public string Tag
+               {
+                       get { return base.TagName; }
+               }
+
+               public StateBag StateBag
+               {
+                       get { return base.ViewState; }
+               }
+
+               public string Render ()
+               {
+                       StringWriter sw = new StringWriter ();
+                       sw.NewLine = "\n";
+                       HtmlTextWriter writer = new HtmlTextWriter (sw);
+                       base.Render (writer);
+                       return writer.InnerWriter.ToString ();
+               }
+
+               public Style GetStyle ()
+               {
+                       return base.CreateControlStyle ();
+               }
+
+               public void TrackState ()
+               {
+                       TrackViewState ();
+               }
+
+               public void LoadState (object state)
+               {
+                       LoadViewState (state);
+               }
+
+               public object SaveState ()
+               {
+                       return SaveViewState ();
+               }
+
+               public void SetDesignMode (IDictionary dic)
+               {
+                       base.SetDesignModeState (dic);
+               }
+
+               private bool onBubble;
+
+               public bool OnBubbleEventCalled
+               {
+                       get { return onBubble; }
+                       set { onBubble = value; }
+               }
+
+               protected override bool OnBubbleEvent (object source, EventArgs 
e)
+               {
+                       onBubble = true;
+                       return base.OnBubbleEvent (source, e);
+               }
+
+               public bool DoBubbleEvent (object source, EventArgs e)
+               {
+                       return base.OnBubbleEvent (source, e);
+               }
+
+               public void DoEnsureChildControls ()
+               {
+                       base.EnsureChildControls ();
+               }
+
+               public bool DoOnBubbleEvent (EventArgs e)
+               {
+                       return base.OnBubbleEvent (this, e);
+               }
+       }
+
+       [Serializable]
+       [TestFixture]
+       public class ChangePasswordTest
+       {
+               [TestFixtureSetUp]
+               public void CopyTestResources ()
+               {
+                       WebTest.CopyResource (GetType (), "WebControl.config", 
"Web.config");
+               }
+
+               [SetUp]
+               public void TestSetup ()
+               {
+                       Thread.Sleep (150);
+               }
+
+               [Test]
+               public void DefaultProperties ()
+               {
+                       TestChangePassword w = new TestChangePassword ();
+                       Assert.AreEqual (0, w.Attributes.Count, 
"Attributes.Count");
+                       Assert.AreEqual (0, w.StateBag.Count, 
"ViewState.Count");
+                       Assert.AreEqual (string.Empty, w.CancelButtonImageUrl, 
"CancelButtonImageUrl");
+                       Assert.AreEqual ("Cancel", w.CancelButtonText, 
"CancelButtonText");
+                       Assert.AreEqual (ButtonType.Button, w.CancelButtonType, 
"CancelButtonType");
+                       Assert.AreEqual (string.Empty, 
w.CancelDestinationPageUrl, "CancelDestinationPageUrl");
+                       Assert.AreEqual (string.Empty, 
w.ChangePasswordButtonImageUrl, "ChangePasswordButtonImageUrl");
+                       Assert.AreEqual ("Change Password", 
w.ChangePasswordButtonText, "ChangePasswordButtonText");
+                       Assert.AreEqual (ButtonType.Button, 
w.ChangePasswordButtonType, "ChangePasswordButtonType");
+                       Assert.AreEqual ("Change Your Password", 
w.ChangePasswordTitleText, "ChangePasswordTitleText");
+                       Assert.AreEqual (string.Empty, w.ConfirmNewPassword, 
"CompleteSuccessText");
+                       Assert.AreEqual (string.Empty, w.HelpPageIconUrl, 
"HelpPageIconUrl");
+                       Assert.AreEqual (string.Empty, w.HelpPageText, 
"HelpPageText");
+                       Assert.AreEqual (string.Empty, w.HelpPageUrl, 
"HelpPageUrl");
+                       Assert.AreEqual (string.Empty, w.CreateUserIconUrl, 
"CreateUserIconUrl");
+                       Assert.AreEqual (string.Empty, w.CreateUserText, 
"CreateUserText");
+                       Assert.AreEqual (string.Empty, w.CreateUserUrl, 
"CreateUserUrl");
+                       Assert.AreEqual (string.Empty, w.EditProfileIconUrl, 
"EditProfileIconUrl");
+                       Assert.AreEqual (string.Empty, w.EditProfileText, 
"EditProfileText");
+                       Assert.AreEqual (string.Empty, w.EditProfileUrl, 
"EditProfileUrl");
+                       Assert.AreEqual (string.Empty, 
w.PasswordRecoveryIconUrl, "PasswordRecoveryIconUrl");
+                       Assert.AreEqual (string.Empty, w.PasswordRecoveryText, 
"PasswordRecoveryText");
+                       Assert.AreEqual (string.Empty, w.PasswordRecoveryUrl, 
"PasswordRecoveryUrl");
+                       Assert.AreEqual ("Confirm New Password:", 
w.ConfirmNewPasswordLabelText, "ConfirmNewPasswordLabelText");
+                       Assert.AreEqual ("The Confirm New Password must match 
the New Password entry.", w.ConfirmPasswordCompareErrorMessage, 
"ConfirmPasswordCompareErrorMessage");
+                       Assert.AreEqual (String.Empty, 
w.ConfirmPasswordRequiredErrorMessage, "ConfirmPasswordRequiredErrorMessage");
+                       Assert.AreEqual (string.Empty, 
w.ContinueButtonImageUrl, "ContinueButtonImageUrl");
+                       Assert.AreEqual ("Continue", w.ContinueButtonText, 
"ContinueButtonText");
+                       Assert.AreEqual (ButtonType.Button, 
w.ContinueButtonType, "ContinueButtonType");
+                       Assert.AreEqual (string.Empty, 
w.ContinueDestinationPageUrl, "ContinueDestinationPageUrl");
+                       Assert.AreEqual (false, w.DisplayUserName, 
"DisplayUserName");
+                       Assert.AreEqual (string.Empty, w.InstructionText, 
"InstructionText");
+                       Assert.AreEqual ("New Password:", 
w.NewPasswordLabelText, "NewPasswordLabelText");
+                       Assert.AreEqual (string.Empty, w.PasswordHintText, 
"PasswordHintText");
+                       Assert.AreEqual ("Password:", w.PasswordLabelText, 
"PasswordLabelText");
+                       Assert.AreEqual (string.Empty, w.SuccessPageUrl, 
"SuccessPageUrl");
+                       Assert.AreEqual ("Your password has been changed!", 
w.SuccessText, "SuccessText");
+                       Assert.AreEqual ("Change Password Complete", 
w.SuccessTitleText, "SuccessTitleText");
+                       Assert.AreEqual ("User Name:", w.UserNameLabelText, 
"UserNameLabelText");
+               }
+
+               [Test]
+               public void AssignToDefaultProperties ()
+               {
+                       TestChangePassword w = new TestChangePassword ();
+                       Assert.AreEqual (0, w.Attributes.Count, 
"Attributes.Count");
+                       Assert.AreEqual (0, w.StateBag.Count, 
"ViewState.Count");
+
+                       int count = 0;
+
+                       w.CancelButtonImageUrl = "text";
+                       Assert.AreEqual ("text", w.CancelButtonImageUrl, 
"Assign CancelButtonImageUrl,");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
CancelButtonImageUrl,");
+
+                       w.CancelButtonText = "text";
+                       Assert.AreEqual ("text", w.CancelButtonText, "Assign 
CancelButtonText");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
CancelButtonText");
+
+                       w.CancelDestinationPageUrl = "text";
+                       Assert.AreEqual ("text", w.CancelDestinationPageUrl, 
"Assign CancelDestinationPageUrl");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
CancelDestinationPageUrl");
+
+                       w.ChangePasswordButtonImageUrl = "text";
+                       Assert.AreEqual ("text", 
w.ChangePasswordButtonImageUrl, "Assign ChangePasswordButtonImageUrl");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
ChangePasswordButtonImageUrl");
+
+                       w.HelpPageText = "text";
+                       Assert.AreEqual ("text", w.HelpPageText, "Assign 
HelpPageText");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
HelpPageText");
+
+                       w.ChangePasswordButtonText = "text";
+                       Assert.AreEqual ("text", w.ChangePasswordButtonText, 
"Assign ChangePasswordButtonText");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
ChangePasswordButtonText");
+
+                       w.ChangePasswordFailureText = "text";
+                       Assert.AreEqual ("text", w.ChangePasswordFailureText, 
"Assign ChangePasswordFailureText");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
ChangePasswordFailureText");
+
+                       w.ChangePasswordTitleText = "msg";
+                       Assert.AreEqual ("msg", w.ChangePasswordTitleText, 
"Assign ChangePasswordTitleText");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
ChangePasswordTitleText");
+
+                       w.ConfirmNewPasswordLabelText = "msg";
+                       Assert.AreEqual ("msg", w.ConfirmNewPasswordLabelText, 
"Assign ConfirmNewPasswordLabelText");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
ConfirmNewPasswordLabelText");
+
+                       w.ContinueButtonImageUrl = "msg";
+                       Assert.AreEqual ("msg", w.ContinueButtonImageUrl, 
"Assign ContinueButtonImageUrl");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
ContinueButtonImageUrl");
+
+                       w.ContinueButtonText = "msg";
+                       Assert.AreEqual ("msg", w.ContinueButtonText, "Assign 
ContinueButtonText");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
ContinueButtonText");
+
+                       w.ContinueDestinationPageUrl = "msg";
+                       Assert.AreEqual ("msg", w.ContinueDestinationPageUrl, 
"Assign ContinueDestinationPageUrl");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
ContinueDestinationPageUrl");
+
+                       w.CreateUserIconUrl = "msg";
+                       Assert.AreEqual ("msg", w.CreateUserIconUrl, "Assign 
CreateUserIconUrl");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
CreateUserIconUrl");
+
+                       w.CreateUserText = "msg";
+                       Assert.AreEqual ("msg", w.CreateUserText, "Assign 
CreateUserText");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
CreateUserText");
+
+                       w.CreateUserUrl = "msg";
+                       Assert.AreEqual ("msg", w.CreateUserUrl, "Assign 
CreateUserUrl");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
CreateUserUrl");
+
+                       w.DisplayUserName = true;
+                       Assert.AreEqual (true, w.DisplayUserName, "Assign 
DisplayUserName");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
DisplayUserName");
+
+                       w.EditProfileIconUrl = "msg";
+                       Assert.AreEqual ("msg", w.EditProfileIconUrl, "Assign 
EditProfileIconUrl");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
EditProfileIconUrl");
+
+                       w.EditProfileText = "msg";
+                       Assert.AreEqual ("msg", w.EditProfileText, "Assign 
EditProfileText");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
EditProfileText");
+
+                       w.HelpPageIconUrl = "msg";
+                       Assert.AreEqual ("msg", w.HelpPageIconUrl, "Assign 
HelpPageIconUrl");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
HelpPageIconUrl");
+
+                       w.HelpPageUrl = "msg";
+                       Assert.AreEqual ("msg", w.HelpPageUrl, "Assign 
HelpPageUrl");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
HelpPageUrl");
+
+                       w.InstructionText = "msg";
+                       Assert.AreEqual ("msg", w.InstructionText, "Assign 
InstructionText");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
InstructionText");
+
+                       w.MembershipProvider = "msg";
+                       Assert.AreEqual ("msg", w.MembershipProvider, "Assign 
MembershipProvider");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
MembershipProvider");
+
+                       w.NewPasswordLabelText = "msg";
+                       Assert.AreEqual ("msg", w.NewPasswordLabelText, "Assign 
NewPasswordLabelText");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
NewPasswordLabelText");
+
+                       w.PasswordHintText = "msg";
+                       Assert.AreEqual ("msg", w.PasswordHintText, "Assign 
PasswordHintText");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
PasswordHintText");
+
+                       w.PasswordLabelText = "msg";
+                       Assert.AreEqual ("msg", w.PasswordLabelText, "Assign 
PasswordLabelText");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
PasswordLabelText");
+
+                       w.PasswordRecoveryIconUrl = "msg";
+                       Assert.AreEqual ("msg", w.PasswordRecoveryIconUrl, 
"Assign PasswordRecoveryIconUrl");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
PasswordRecoveryIconUrl");
+
+                       w.PasswordRecoveryText = "msg";
+                       Assert.AreEqual ("msg", w.PasswordRecoveryText, "Assign 
PasswordRecoveryText");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
PasswordRecoveryText");
+
+                       w.PasswordRecoveryUrl = "msg";
+                       Assert.AreEqual ("msg", w.PasswordRecoveryUrl, "Assign 
PasswordRecoveryUrl");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
PasswordRecoveryUrl");
+
+                       w.PasswordRequiredErrorMessage = "msg";
+                       Assert.AreEqual ("msg", w.PasswordRequiredErrorMessage, 
"Assign PasswordRequiredErrorMessage");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
PasswordRequiredErrorMessage");
+
+                       w.SuccessPageUrl = "msg";
+                       Assert.AreEqual ("msg", w.SuccessPageUrl, "Assign 
SuccessPageUrl");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
SuccessPageUrl");
+
+                       w.SuccessText = "msg";
+                       Assert.AreEqual ("msg", w.SuccessText, "Assign 
SuccessText");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
SuccessText");
+
+                       w.SuccessTitleText = "msg";
+                       Assert.AreEqual ("msg", w.SuccessTitleText, "Assign 
SuccessTitleText");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
SuccessTitleText");
+
+                       w.UserNameLabelText = "msg";
+                       Assert.AreEqual ("msg", w.UserNameLabelText, "Assign 
UserNameLabelText");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
UserNameLabelText");
+               }
+
+               public static void BasicRenderTestInit (Page p)
+               {
+                       CreateTestControl (p);
+               }
+
+               public static ChangePassword CreateTestControl (Page p)
+               {
+                       LiteralControl lcb = new LiteralControl 
(HtmlDiff.BEGIN_TAG);
+                       LiteralControl lce = new LiteralControl 
(HtmlDiff.END_TAG);
+
+                       ChangePassword w = new ChangePassword ();
+                       w.ID = "ChangePassword1";
+                       w.DisplayUserName = true;
+
+                       p.Form.Controls.Add (lcb);
+                       p.Form.Controls.Add (w);
+                       p.Form.Controls.Add (lce);
+
+                       return w;
+               }
+
+               [Test]
+               [Category ("NunitWeb")]
+               public void BasicRenderTest ()
+               {
+                       string html = new WebTest (PageInvoker.CreateOnLoad (
+                               new PageDelegate (BasicRenderTestInit))).Run ();
+
+                       int st = 0;
+                       Assert.IsTrue ((st = html.IndexOf ("<table", st)) > 0, 
"base render test 1");
+                       Assert.IsTrue ((st = html.IndexOf ("ChangePassword1", 
st)) > 0, "base render test 2");
+                       Assert.IsTrue ((st = html.IndexOf 
("border-collapse:collapse", st)) > 0, "base render test 3");
+                       Assert.IsTrue ((st = html.IndexOf ("<table", st)) > 0, 
"base render test 4");
+                       Assert.IsTrue ((st = html.IndexOf ("Change Your 
Password", st)) > 0, "base render test 5");
+                       Assert.IsTrue ((st = html.IndexOf ("User Name:", st)) > 
0, "base render test 6");
+                       Assert.IsTrue ((st = html.IndexOf ("Password:", st)) > 
0, "base render test 7");
+                       Assert.IsTrue ((st = html.IndexOf ("New Password:", 
st)) > 0, "base render test 8");
+                       Assert.IsTrue ((st = html.IndexOf ("Change Password", 
st)) > 0, "base render test 9");
+               }
+
+               [Test]
+               [Category ("NunitWeb")]
+               public void TitlesRenderTest ()
+               {
+                       string html = new WebTest (PageInvoker.CreateOnLoad (
+                               new PageDelegate (TitlesRenderTestInit))).Run 
();
+
+                       Assert.IsTrue (html.IndexOf ("userid") > 0, 
"UserNameLabelText");
+                       Assert.IsTrue (html.IndexOf ("PasswordLabelText") > 0, 
"PasswordLabelText");
+                       Assert.IsTrue (html.IndexOf ("NewPasswordLabelText") > 
0, "NewPasswordLabelText");
+                       Assert.IsTrue (html.IndexOf 
("ConfirmNewPasswordLabelText") > 0, "ConfirmNewPasswordLabelText");
+                       Assert.IsTrue (html.IndexOf ("InstructionText") > 0, 
"InstructionText");
+                       Assert.IsTrue (html.IndexOf ("PasswordHintText") > 0, 
"PasswordHintText");
+                       Assert.IsTrue (html.IndexOf ("zzxcmnmncx") > 0, 
"zzxcmnmncx");
+               }
+
+               public static void TitlesRenderTestInit (Page p)
+               {
+                       ChangePassword w = CreateTestControl (p);
+                       w.UserNameLabelText = "userid";
+                       w.PasswordLabelText = "PasswordLabelText";
+                       w.NewPasswordLabelText = "NewPasswordLabelText";
+                       w.ConfirmNewPasswordLabelText = 
"ConfirmNewPasswordLabelText";
+                       w.InstructionText = "InstructionText";
+                       w.PasswordHintText = "PasswordHintText";
+                       w.ChangePasswordButtonText = "zzxcmnmncx";
+               }
+
+               [Test]
+               [Category ("NunitWeb")]
+               public void ExtraTitlesRenderTest ()
+               {
+                       string html = new WebTest (PageInvoker.CreateOnLoad (
+                               new PageDelegate 
(ExtraTitlesRenderTestInit))).Run ();
+
+                       Assert.IsTrue (html.IndexOf ("PasswordHintText") > 0, 
"PasswordHintText");
+                       Assert.IsTrue (html.IndexOf 
("http://www.HelpPageUrl.com";) > 0, "HelpPageUrl");
+                       Assert.IsTrue (html.IndexOf ("HelpPageText") > 0, 
"HelpPageText");
+                       Assert.IsTrue (html.IndexOf 
("http://www.HelpPageIconUrl.com";) > 0, "HelpPageIconUrl");
+                       Assert.IsTrue (html.IndexOf ("CreateUserIconUrl") > 0, 
"CreateUserIconUrl");
+                       Assert.IsTrue (html.IndexOf ("CreateUserText") > 0, 
"CreateUserText");
+                       Assert.IsTrue (html.IndexOf ("CreateUserUrl") > 0, 
"CreateUserUrl");
+               }
+
+               public static void ExtraTitlesRenderTestInit (Page p)
+               {
+                       ChangePassword w = CreateTestControl (p);
+                       w.HelpPageUrl = "http://www.HelpPageUrl.com";;
+                       w.HelpPageText = "HelpPageText";
+                       w.HelpPageIconUrl = "http://www.HelpPageIconUrl.com";;
+                       w.CreateUserIconUrl = "CreateUserIconUrl";
+                       w.CreateUserText = "CreateUserText";
+                       w.CreateUserUrl = "CreateUserUrl";
+                       w.PasswordHintText = "PasswordHintText";
+               }
+
+               [Test]
+               [Category ("NunitWeb")]
+               public void StylesRenderTest ()
+               {
+                       string html = new WebTest (PageInvoker.CreateOnLoad (
+                               new PageDelegate (StylesRenderTestInit))).Run 
();
+
+                       Assert.IsTrue (html.IndexOf ("LightGoldenrodYellow;") > 
0, "TextBoxStyle");
+                       Assert.IsTrue (html.IndexOf ("732px") > 0, 
"TitleTextStyle");
+                       Assert.IsTrue (html.IndexOf ("LightSkyBlue;") > 0, 
"HyperLinkStyle");
+                       Assert.IsTrue (html.IndexOf ("MediumSeaGreen;") > 0, 
"InstructionTextStyle");
+                       Assert.IsTrue (html.IndexOf ("MediumSpringGreen;") > 0, 
"LabelStyle");
+               }
+
+               private string GetDecoratedId (string html, string id)
+               {
+                       Regex reg = new Regex ("name=\".*[\\$\\:]" + id + "\"");
+                       Match match = reg.Match (html);
+
+                       string fixedId = match.Value;
+                       if (fixedId.Length > 0)
+                               fixedId = fixedId.Substring (fixedId.IndexOf 
("\""), fixedId.Length - fixedId.IndexOf ("\"")).Trim ('\"');
+
+                       return fixedId;
+               }
+
+               private static string GetEventTarget (string html, string id)
+               {
+                       Regex reg = new Regex ("__doPostBack.*\\(.*'.*" + id + 
"'");
+                       Match match = reg.Match (html);
+
+                       string fixedId = match.Value;
+                       if (fixedId.Length > 0)
+                               fixedId = fixedId.Substring (fixedId.IndexOf 
("'"), fixedId.Length - fixedId.IndexOf ("'")).Trim ('\'');
+
+                       return fixedId;
+               }
+
+               [Test]
+               [Category ("NunitWeb")]
+               public void BasicPostbackTest ()
+               {
+                       PageInvoker pi = PageInvoker.CreateOnLoad (new 
PageDelegate (StylesRenderTestInit));
+                       WebTest test = new WebTest (pi);
+
+                       string html = test.Run ();
+                       test.Invoker = pi;
+
+                       FormRequest fr = new FormRequest (test.Response, 
"form1");
+
+                       fr.Controls.Add (new BaseControl (GetDecoratedId (html, 
"UserName"), "username"));
+
+                       PageDelegates pd = new PageDelegates ();
+                       pd.PreRender = new PageDelegate 
(BasicPostTestPreRender);
+                       pd.Load = new PageDelegate (StylesRenderTestInit);
+                       pi.Delegates = pd;
+
+                       test.Request = fr;
+                       html = test.Run ();
+
+                       Assert.IsTrue (html.IndexOf ("username") > 0, "rendered 
user name");
+
+                       Assert.IsTrue (html.IndexOf ("LightGoldenrodYellow;") > 
0, "TextBoxStyle");
+                       Assert.IsTrue (html.IndexOf ("732px") > 0, 
"TitleTextStyle");
+                       Assert.IsTrue (html.IndexOf ("LightSkyBlue;") > 0, 
"HyperLinkStyle");
+                       Assert.IsTrue (html.IndexOf ("MediumSeaGreen;") > 0, 
"InstructionTextStyle");
+                       Assert.IsTrue (html.IndexOf ("MediumSpringGreen;") > 0, 
"LabelStyle");
+                       Assert.IsTrue (html.IndexOf ("PeachPuff;") > 0, 
"LabelStyle");
+               }
+
+               public static void BasicPostTestPreRender (Page p)
+               {
+                       ChangePassword w = (ChangePassword) p.FindControl 
("ChangePassword1");
+                       if (w == null)
+                               Assert.Fail ("postback1");
+
+                       Assert.AreEqual ("username", w.UserName, "posted user 
name");
+               }
+
+               public static void StylesRenderTestInit (Page p)
+               {
+                       ChangePassword w = CreateTestControl (p);
+                       w.MembershipProvider = "FakeProvider";
+                       w.SendingMail += new 
MailMessageEventHandler(w_SendingMail);
+                       w.SendMailError += new 
SendMailErrorEventHandler(w_SendMailError);
+                       w.DisplayUserName = true;
+
+                       if (!p.IsPostBack) {
+                               w.TextBoxStyle.BackColor = 
Color.LightGoldenrodYellow;
+                               w.TitleTextStyle.Height = Unit.Pixel (732);
+                               w.LabelStyle.BackColor = 
Color.MediumSpringGreen;
+
+                               w.HelpPageUrl = "http://www.HelpPageUrl.com";;
+                               w.HelpPageText = "hhh";
+                               w.HyperLinkStyle.BackColor = Color.LightSkyBlue;
+
+                               w.InstructionText = "text";
+                               w.InstructionTextStyle.BackColor = 
Color.MediumSeaGreen;
+
+                               w.PasswordHintText = "PasswordHintText";
+                               w.PasswordHintStyle.BackColor = Color.PeachPuff;
+                       }
+               }
+
+               public static void w_SendingMail (object sender, 
MailMessageEventArgs e)
+               {
+                       if (e.Message.Body.IndexOf ("123") > 0)
+                               WebTest.CurrentTest.UserData = "w_SendingMail";
+               }
+               
+               public static void w_SendMailError (object sender, 
SendMailErrorEventArgs e)
+               {
+                       e.Handled = true;
+               }
+
+               // TODO:
+               // ValidatorTextStyle
+               // ErrorMessageStyle
+               [Test]
+               [Category ("NotDotNet")]
+               [Category ("NunitWeb")]
+               public void ChngPasswordTest ()
+               {
+                       PageInvoker pi = PageInvoker.CreateOnLoad (new 
PageDelegate (StylesRenderTestInit));
+                       WebTest test = new WebTest (pi);
+
+                       string html = test.Run ();
+                       test.Invoker = pi;
+
+                       FormRequest fr = new FormRequest (test.Response, 
"form1");
+
+                       fr.Controls.Add (new BaseControl (GetDecoratedId (html, 
"UserName"), "heh"));
+                       fr.Controls.Add (new BaseControl (GetDecoratedId (html, 
"CurrentPassword"), "heh"));
+                       fr.Controls.Add (new BaseControl (GetDecoratedId (html, 
"NewPassword"), "hehe"));
+                       fr.Controls.Add (new BaseControl (GetDecoratedId (html, 
"ConfirmNewPassword"), "hehe"));
+                       string button = GetDecoratedId (html, 
"ChangePasswordButton");
+                       if (button.Length > 0)
+                               fr.Controls.Add (new BaseControl 
(GetDecoratedId (html, "ChangePasswordButton"), "ChangePasswordButton"));
+                       else
+                               fr.Controls.Add (new BaseControl 
("__EVENTTARGET", GetEventTarget (html, "ChangePassword")));
+
+                       test.Request = fr;
+                       html = test.Run ();
+
+                       Assert.IsTrue (html.IndexOf ("has been changed") > 0, 
"GetPassword");
+               }
+
+       }
+}
+
+#endif

Added: 
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/PasswordRecoveryTest.cs
===================================================================
--- 
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/PasswordRecoveryTest.cs
   2006-11-23 08:58:28 UTC (rev 68382)
+++ 
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/PasswordRecoveryTest.cs
   2006-11-23 09:23:48 UTC (rev 68383)
@@ -0,0 +1,493 @@
+//
+// PasswordRecoveryTest.cs - Unit tests for 
System.Web.UI.WebControls.PasswordRecovery
+//
+// Author:
+//     Vladimir Krasnov  <[EMAIL PROTECTED]>
+//
+// (C) 2005 Mainsoft Corporation (http://www.mainsoft.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.Drawing;
+using System.Threading;
+using System.Collections;
+using System.IO;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Web.Security;
+using System.Text.RegularExpressions;
+using MonoTests.SystemWeb.Framework;
+using MonoTests.stand_alone.WebHarness;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Web.UI.WebControls
+{
+
+       public class TestPasswordRecovery : PasswordRecovery
+       {
+
+               public string Tag
+               {
+                       get { return base.TagName; }
+               }
+
+               public StateBag StateBag
+               {
+                       get { return base.ViewState; }
+               }
+
+               public string Render ()
+               {
+                       StringWriter sw = new StringWriter ();
+                       sw.NewLine = "\n";
+                       HtmlTextWriter writer = new HtmlTextWriter (sw);
+                       base.Render (writer);
+                       return writer.InnerWriter.ToString ();
+               }
+
+               public Style GetStyle ()
+               {
+                       return base.CreateControlStyle ();
+               }
+
+               public void TrackState ()
+               {
+                       TrackViewState ();
+               }
+
+               public void LoadState (object state)
+               {
+                       LoadViewState (state);
+               }
+
+               public object SaveState ()
+               {
+                       return SaveViewState ();
+               }
+
+               public void SetDesignMode (IDictionary dic)
+               {
+                       base.SetDesignModeState (dic);
+               }
+
+               private bool onBubble;
+
+               public bool OnBubbleEventCalled
+               {
+                       get { return onBubble; }
+                       set { onBubble = value; }
+               }
+
+               protected override bool OnBubbleEvent (object source, EventArgs 
e)
+               {
+                       onBubble = true;
+                       return base.OnBubbleEvent (source, e);
+               }
+
+               public bool DoBubbleEvent (object source, EventArgs e)
+               {
+                       return base.OnBubbleEvent (source, e);
+               }
+
+               public void DoEnsureChildControls ()
+               {
+                       base.EnsureChildControls ();
+               }
+
+               public bool DoOnBubbleEvent (EventArgs e)
+               {
+                       return base.OnBubbleEvent (this, e);
+               }
+       }
+
+       [Serializable]
+       [TestFixture]
+       public class PasswordRecoveryTest
+       {
+               [TestFixtureSetUp]
+               public void CopyTestResources ()
+               {
+                       WebTest.CopyResource (GetType (), "WebControl.config", 
"Web.config");
+               }
+
+               [SetUp]
+               public void TestSetup ()
+               {
+                       Thread.Sleep (150);
+               }
+
+               [Test]
+               public void DefaultProperties ()
+               {
+                       TestPasswordRecovery w = new TestPasswordRecovery ();
+                       Assert.AreEqual (0, w.Attributes.Count, 
"Attributes.Count");
+                       Assert.AreEqual (0, w.StateBag.Count, 
"ViewState.Count");
+
+                       Assert.AreEqual ("Answer:", w.AnswerLabelText, 
"AnswerLabelText");
+                       Assert.AreEqual ("Answer is required.", 
w.AnswerRequiredErrorMessage, "AnswerRequiredErrorMessage");
+                       //Assert.IsFalse (w.AutoGeneratePassword, 
"AutoGeneratePassword");
+                       Assert.AreEqual ("Your attempt to retrieve your 
password was not successful. Please try again.", w.GeneralFailureText, 
"CompleteSuccessText");
+                       Assert.AreEqual (string.Empty, w.HelpPageIconUrl, 
"HelpPageIconUrl");
+                       Assert.AreEqual (string.Empty, w.HelpPageText, 
"HelpPageText");
+                       Assert.AreEqual (string.Empty, w.HelpPageUrl, 
"HelpPageUrl");
+                       Assert.AreEqual ("Your answer could not be verified. 
Please try again.", w.QuestionFailureText, "InstructionText");
+                       Assert.AreEqual ("Answer the following question to 
receive your password.", w.QuestionInstructionText, "InstructionText");
+                       Assert.AreEqual ("Question:", w.QuestionLabelText, 
"ConfirmPasswordCompareErrorMessage");
+                       Assert.AreEqual ("Identity Confirmation", 
w.QuestionTitleText, "ConfirmPasswordLabelText");
+                       Assert.AreEqual ("Submit", w.SubmitButtonText, 
"ConfirmPasswordRequiredErrorMessage");
+                       Assert.AreEqual (ButtonType.Button, w.SubmitButtonType, 
"ContinueButtonImageUrl");
+                       Assert.AreEqual (string.Empty, w.SuccessPageUrl, 
"ContinueButtonText");
+                       Assert.AreEqual ("Your password has been sent to you.", 
w.SuccessText, "ContinueButtonType");
+                       Assert.AreEqual ("We were unable to access your 
information. Please try again.", w.UserNameFailureText, 
"ContinueDestinationPageUrl");
+                       Assert.AreEqual ("Enter your User Name to receive your 
password.", w.UserNameInstructionText, "CreateUserButtonImageUrl");
+                       Assert.AreEqual ("User Name:", w.UserNameLabelText, 
"CreateUserButtonText");
+                       Assert.AreEqual ("User Name is required.", 
w.UserNameRequiredErrorMessage, "CreateUserButtonType");
+                       Assert.AreEqual ("Forgot Your Password?", 
w.UserNameTitleText, "DuplicateEmailErrorMessage");
+               }
+
+               [Test]
+               public void AssignToDefaultProperties ()
+               {
+                       TestPasswordRecovery w = new TestPasswordRecovery ();
+                       Assert.AreEqual (0, w.Attributes.Count, 
"Attributes.Count");
+                       Assert.AreEqual (0, w.StateBag.Count, 
"ViewState.Count");
+
+                       int count = 0;
+
+                       w.AnswerLabelText = "text";
+                       Assert.AreEqual ("text", w.AnswerLabelText, "Assign 
AnswerLabelText,");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
AnswerLabelText,");
+
+                       w.AnswerRequiredErrorMessage = "text";
+                       Assert.AreEqual ("text", w.AnswerRequiredErrorMessage, 
"Assign AnswerRequiredErrorMessage");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
AnswerRequiredErrorMessage");
+
+                       w.GeneralFailureText = "text";
+                       Assert.AreEqual ("text", w.GeneralFailureText, "Assign 
GeneralFailureText");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
GeneralFailureText");
+
+                       w.HelpPageIconUrl = "text";
+                       Assert.AreEqual ("text", w.HelpPageIconUrl, "Assign 
HelpPageIconUrl");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
HelpPageIconUrl");
+
+                       w.HelpPageText = "text";
+                       Assert.AreEqual ("text", w.HelpPageText, "Assign 
HelpPageText");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
HelpPageText");
+
+                       w.HelpPageUrl = "text";
+                       Assert.AreEqual ("text", w.HelpPageUrl, "Assign 
HelpPageUrl");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
HelpPageUrl");
+
+                       w.MembershipProvider = "text";
+                       Assert.AreEqual ("text", w.MembershipProvider, "Assign 
MembershipProvider");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
MembershipProvider");
+
+                       w.QuestionFailureText = "msg";
+                       Assert.AreEqual ("msg", w.QuestionFailureText, "Assign 
QuestionFailureText");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
QuestionFailureText");
+
+                       w.QuestionInstructionText = "msg";
+                       Assert.AreEqual ("msg", w.QuestionInstructionText, 
"Assign QuestionInstructionText");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
QuestionInstructionText");
+
+                       w.QuestionLabelText = "msg";
+                       Assert.AreEqual ("msg", w.QuestionLabelText, "Assign 
QuestionLabelText");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
QuestionLabelText");
+
+                       w.QuestionTitleText = "msg";
+                       Assert.AreEqual ("msg", w.QuestionTitleText, "Assign 
QuestionTitleText");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
QuestionTitleText");
+
+                       w.SubmitButtonImageUrl = "msg";
+                       Assert.AreEqual ("msg", w.SubmitButtonImageUrl, "Assign 
SubmitButtonImageUrl");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
SubmitButtonImageUrl");
+
+                       w.SuccessPageUrl = "msg";
+                       Assert.AreEqual ("msg", w.SuccessPageUrl, "Assign 
SuccessPageUrl");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
SuccessPageUrl");
+
+                       w.SuccessText = "msg";
+                       Assert.AreEqual ("msg", w.SuccessText, "Assign 
SuccessText");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
SuccessText");
+
+                       w.UserName = "msg";
+                       Assert.AreEqual ("msg", w.UserName, "Assign UserName");
+                       Assert.AreEqual (count, w.StateBag.Count, "Viewstate 
UserName");
+
+                       w.UserNameInstructionText = "msg";
+                       Assert.AreEqual ("msg", w.UserNameInstructionText, 
"Assign UserNameInstructionText");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
UserNameInstructionText");
+
+                       w.UserNameLabelText = "msg";
+                       Assert.AreEqual ("msg", w.UserNameLabelText, "Assign 
UserNameLabelText");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
UserNameLabelText");
+
+                       w.UserNameRequiredErrorMessage = "msg";
+                       Assert.AreEqual ("msg", w.UserNameRequiredErrorMessage, 
"Assign UserNameRequiredErrorMessage");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
UserNameRequiredErrorMessage");
+
+                       w.UserNameTitleText = "msg";
+                       Assert.AreEqual ("msg", w.UserNameTitleText, "Assign 
UserNameTitleText");
+                       Assert.AreEqual (++count, w.StateBag.Count, "Viewstate 
UserNameTitleText");
+
+               }
+
+               public static void BasicRenderTestInit (Page p)
+               {
+                       CreateTestControl (p);
+               }
+
+               public static PasswordRecovery CreateTestControl (Page p)
+               {
+                       LiteralControl lcb = new LiteralControl 
(HtmlDiff.BEGIN_TAG);
+                       LiteralControl lce = new LiteralControl 
(HtmlDiff.END_TAG);
+
+                       PasswordRecovery w = new PasswordRecovery ();
+                       w.ID = "PasswordRecovery1";
+
+                       p.Form.Controls.Add (lcb);
+                       p.Form.Controls.Add (w);
+                       p.Form.Controls.Add (lce);
+
+                       return w;
+               }
+
+               [Test]
+               [Category ("NunitWeb")]
+               public void BasicRenderTest ()
+               {
+                       string html = new WebTest (PageInvoker.CreateOnLoad (
+                               new PageDelegate (BasicRenderTestInit))).Run ();
+
+                       int st = 0;
+                       Assert.IsTrue ((st = html.IndexOf ("<table", st)) > 0, 
"base render test 1");
+                       Assert.IsTrue ((st = html.IndexOf ("PasswordRecovery1", 
st)) > 0, "base render test 2");
+                       Assert.IsTrue ((st = html.IndexOf 
("border-collapse:collapse", st)) > 0, "base render test 3");
+                       Assert.IsTrue ((st = html.IndexOf ("<table", st)) > 0, 
"base render test 4");
+                       Assert.IsTrue ((st = html.IndexOf ("Forgot Your 
Password?", st)) > 0, "base render test 6");
+                       Assert.IsTrue ((st = html.IndexOf ("Enter your User 
Name to receive your password.", st)) > 0, "base render test 7");
+                       Assert.IsTrue ((st = html.IndexOf ("User Name:", st)) > 
0, "base render test 8");
+                       Assert.IsTrue ((st = html.IndexOf ("Submit", st)) > 0, 
"base render test 9");
+               }
+
+               [Test]
+               [Category ("NunitWeb")]
+               public void TitlesRenderTest ()
+               {
+                       string html = new WebTest (PageInvoker.CreateOnLoad (
+                               new PageDelegate (TitlesRenderTestInit))).Run 
();
+
+                       Assert.IsTrue (html.IndexOf ("userid") > 0, 
"UserNameLabelText");
+                       Assert.IsTrue (html.IndexOf ("forgot") > 0, 
"UserNameTitleText");
+                       Assert.IsTrue (html.IndexOf ("UserNameInstructionText") 
> 0, "UserNameInstructionText");
+                       Assert.IsTrue (html.IndexOf ("zzxcmnmncx") > 0, 
"SubmitButtonText");
+               }
+
+               public static void TitlesRenderTestInit (Page p)
+               {
+                       PasswordRecovery w = CreateTestControl (p);
+                       w.UserNameLabelText = "userid";
+                       w.UserNameTitleText = "forgot";
+                       w.UserNameInstructionText = "UserNameInstructionText";
+                       w.SubmitButtonText = "zzxcmnmncx";
+               }
+
+               [Test]
+               [Category ("NunitWeb")]
+               public void ExtraTitlesRenderTest ()
+               {
+                       string html = new WebTest (PageInvoker.CreateOnLoad (
+                               new PageDelegate 
(ExtraTitlesRenderTestInit))).Run ();
+
+                       Assert.IsTrue (html.IndexOf 
("http://www.HelpPageUrl.com";) > 0, "HelpPageUrl");
+                       Assert.IsTrue (html.IndexOf ("HelpPageText") > 0, 
"HelpPageText");
+                       Assert.IsTrue (html.IndexOf 
("http://www.HelpPageIconUrl.com";) > 0, "HelpPageIconUrl");
+               }
+
+               public static void ExtraTitlesRenderTestInit (Page p)
+               {
+                       PasswordRecovery w = CreateTestControl (p);
+                       w.HelpPageUrl = "http://www.HelpPageUrl.com";;
+                       w.HelpPageText = "HelpPageText";
+                       w.HelpPageIconUrl = "http://www.HelpPageIconUrl.com";;
+               }
+
+               [Test]
+               [Category ("NunitWeb")]
+               public void StylesRenderTest ()
+               {
+                       string html = new WebTest (PageInvoker.CreateOnLoad (
+                               new PageDelegate (StylesRenderTestInit))).Run 
();
+
+                       Assert.IsTrue (html.IndexOf ("LightGoldenrodYellow;") > 
0, "TextBoxStyle");
+                       Assert.IsTrue (html.IndexOf ("732px") > 0, 
"TitleTextStyle");
+                       Assert.IsTrue (html.IndexOf ("LightSkyBlue;") > 0, 
"HyperLinkStyle");
+                       Assert.IsTrue (html.IndexOf ("MediumSeaGreen;") > 0, 
"InstructionTextStyle");
+                       Assert.IsTrue (html.IndexOf ("MediumSpringGreen;") > 0, 
"LabelStyle");
+               }
+
+               private string GetDecoratedId (string html, string id)
+               {
+                       Regex reg = new Regex ("name=\".*[\\$\\:]" + id + "\"");
+                       Match match = reg.Match (html);
+
+                       string fixedId = match.Value;
+                       if (fixedId.Length > 0)
+                               fixedId = fixedId.Substring (fixedId.IndexOf 
("\""), fixedId.Length - fixedId.IndexOf ("\"")).Trim ('\"');
+
+                       return fixedId;
+               }
+
+               private static string GetEventTarget (string html, string id)
+               {
+                       Regex reg = new Regex ("__doPostBack.*\\(.*'.*" + id + 
"'");
+                       Match match = reg.Match (html);
+
+                       string fixedId = match.Value;
+                       if (fixedId.Length > 0)
+                               fixedId = fixedId.Substring (fixedId.IndexOf 
("'"), fixedId.Length - fixedId.IndexOf ("'")).Trim ('\'');
+
+                       return fixedId;
+               }
+
+               [Test]
+               [Category ("NunitWeb")]
+               public void BasicPostbackTest ()
+               {
+                       PageInvoker pi = PageInvoker.CreateOnLoad (new 
PageDelegate (StylesRenderTestInit));
+                       WebTest test = new WebTest (pi);
+
+                       string html = test.Run ();
+                       test.Invoker = pi;
+
+                       FormRequest fr = new FormRequest (test.Response, 
"form1");
+
+                       fr.Controls.Add (new BaseControl (GetDecoratedId (html, 
"UserName"), "username"));
+
+                       PageDelegates pd = new PageDelegates ();
+                       pd.PreRender = new PageDelegate 
(BasicPostTestPreRender);
+                       pd.Load = new PageDelegate (StylesRenderTestInit);
+                       pi.Delegates = pd;
+
+                       test.Request = fr;
+                       html = test.Run ();
+
+                       Assert.IsTrue (html.IndexOf ("username") > 0, "rendered 
user name");
+
+                       Assert.IsTrue (html.IndexOf ("LightGoldenrodYellow;") > 
0, "TextBoxStyle");
+                       Assert.IsTrue (html.IndexOf ("732px") > 0, 
"TitleTextStyle");
+                       Assert.IsTrue (html.IndexOf ("LightSkyBlue;") > 0, 
"HyperLinkStyle");
+                       Assert.IsTrue (html.IndexOf ("MediumSeaGreen;") > 0, 
"InstructionTextStyle");
+                       Assert.IsTrue (html.IndexOf ("MediumSpringGreen;") > 0, 
"LabelStyle");
+               }
+
+               public static void BasicPostTestPreRender (Page p)
+               {
+                       PasswordRecovery w = (PasswordRecovery) p.FindControl 
("PasswordRecovery1");
+                       if (w == null)
+                               Assert.Fail ("postback1");
+
+                       Assert.AreEqual ("username", w.UserName, "posted user 
name");
+               }
+
+               public static void StylesRenderTestInit (Page p)
+               {
+                       PasswordRecovery w = CreateTestControl (p);
+                       w.MembershipProvider = "FakeProvider";
+                       w.SendingMail += new 
MailMessageEventHandler(w_SendingMail);
+                       w.SendMailError += new 
SendMailErrorEventHandler(w_SendMailError);
+
+                       if (!p.IsPostBack) {
+                               w.TextBoxStyle.BackColor = 
Color.LightGoldenrodYellow;
+                               w.TitleTextStyle.Height = Unit.Pixel (732);
+                               w.LabelStyle.BackColor = 
Color.MediumSpringGreen;
+
+                               w.HelpPageUrl = "http://www.HelpPageUrl.com";;
+                               w.HelpPageText = "hhh";
+                               w.HyperLinkStyle.BackColor = Color.LightSkyBlue;
+
+                               w.UserNameInstructionText = "text";
+                               w.InstructionTextStyle.BackColor = 
Color.MediumSeaGreen;
+                       }
+               }
+
+               public static void w_SendingMail (object sender, 
MailMessageEventArgs e)
+               {
+                       if (e.Message.Body.IndexOf ("123") > 0)
+                               WebTest.CurrentTest.UserData = "w_SendingMail";
+               }
+               
+               public static void w_SendMailError (object sender, 
SendMailErrorEventArgs e)
+               {
+                       e.Handled = true;
+               }
+
+               // TODO:
+               // ValidatorTextStyle
+               // ErrorMessageStyle
+               [Test]
+               [Category ("NotDotNet")]
+               [Category ("NunitWeb")]
+               public void GetPasswordTest ()
+               {
+                       PageInvoker pi = PageInvoker.CreateOnLoad (new 
PageDelegate (StylesRenderTestInit));
+                       WebTest test = new WebTest (pi);
+
+                       string html = test.Run ();
+                       test.Invoker = pi;
+
+                       FormRequest fr = new FormRequest (test.Response, 
"form1");
+
+                       fr.Controls.Add (new BaseControl (GetDecoratedId (html, 
"UserName"), "heh"));
+                       string button = GetDecoratedId (html, "SubmitButton");
+                       if (button.Length > 0)
+                               fr.Controls.Add (new BaseControl 
(GetDecoratedId (html, "SubmitButton"), "SubmitButton"));
+                       else
+                               fr.Controls.Add (new BaseControl 
("__EVENTTARGET", GetEventTarget (html, "SubmitButton")));
+
+                       test.Request = fr;
+                       html = test.Run ();
+
+                       FormRequest fr2 = new FormRequest (test.Response, 
"form1");
+
+                       fr2.Controls.Add (new BaseControl (GetDecoratedId 
(html, "Answer"), "heh"));
+                       button = GetDecoratedId (html, "SubmitButton");
+                       if (button.Length > 0)
+                               fr2.Controls.Add (new BaseControl 
(GetDecoratedId (html, "SubmitButton"), "SubmitButton"));
+                       else
+                               fr2.Controls.Add (new BaseControl 
("__EVENTTARGET", GetEventTarget (html, "SubmitButton")));
+
+                       test.Request = fr2;
+                       html = test.Run ();
+
+                       Assert.IsTrue (html.IndexOf ("sent to you") > 0, 
"GetPassword");
+                       Assert.AreEqual ("w_SendingMail", 
(string)test.UserData, "Mailsent");
+               }
+
+       }
+}
+
+#endif

Modified: trunk/mcs/class/System.Web/Test/TestMonoWeb20.vmwcsproj
===================================================================
--- trunk/mcs/class/System.Web/Test/TestMonoWeb20.vmwcsproj     2006-11-23 
08:58:28 UTC (rev 68382)
+++ trunk/mcs/class/System.Web/Test/TestMonoWeb20.vmwcsproj     2006-11-23 
09:23:48 UTC (rev 68383)
@@ -217,6 +217,7 @@
     <Compile Include="System.Web.UI.WebControls\CalendarDayTest.cs" />
     <Compile Include="System.Web.UI.WebControls\CalendarTest.cs" />
     <Compile Include="System.Web.UI.WebControls\CallBackTest.cs" />
+    <Compile Include="System.Web.UI.WebControls\ChangePasswordTest.cs" />
     <Compile Include="System.Web.UI.WebControls\CheckBoxFieldTest.cs" />
     <Compile Include="System.Web.UI.WebControls\CheckBoxListTest.cs" />
     <Compile Include="System.Web.UI.WebControls\CheckBoxTest.cs" />
@@ -295,6 +296,7 @@
     <Compile Include="System.Web.UI.WebControls\PagedDataSourceTest.cs" />
     <Compile Include="System.Web.UI.WebControls\PagerSettingsTest.cs" />
     <Compile Include="System.Web.UI.WebControls\PanelTest.cs" />
+    <Compile Include="System.Web.UI.WebControls\PasswordRecoveryTest.cs" />
     <Compile Include="System.Web.UI.WebControls\PolygonHotSpotTest.cs" />
     <Compile Include="System.Web.UI.WebControls\RadioButtonListTest.cs" />
     <Compile Include="System.Web.UI.WebControls\RadioButtonTest.cs" />

Modified: 
trunk/mcs/class/System.Web/Test/mainsoft/MainsoftWebApp20/MainsoftWebApp20.vmwcsproj
===================================================================
--- 
trunk/mcs/class/System.Web/Test/mainsoft/MainsoftWebApp20/MainsoftWebApp20.vmwcsproj
        2006-11-23 08:58:28 UTC (rev 68382)
+++ 
trunk/mcs/class/System.Web/Test/mainsoft/MainsoftWebApp20/MainsoftWebApp20.vmwcsproj
        2006-11-23 09:23:48 UTC (rev 68383)
@@ -140,6 +140,9 @@
   <ItemGroup>
     <Content Include="Web.config" />
     <Content Include="Web.sitemap" />
+    <Content Include="WebControl.config" >
+       <LogicalName>WebControl.config</LogicalName>
+    </Content>
     <Content Include="WebLogin.config" />
   </ItemGroup>
   <ItemGroup>

Added: 
trunk/mcs/class/System.Web/Test/mainsoft/MainsoftWebApp20/WebControl.config
===================================================================
--- trunk/mcs/class/System.Web/Test/mainsoft/MainsoftWebApp20/WebControl.config 
2006-11-23 08:58:28 UTC (rev 68382)
+++ trunk/mcs/class/System.Web/Test/mainsoft/MainsoftWebApp20/WebControl.config 
2006-11-23 09:23:48 UTC (rev 68383)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+  <system.web>
+    <siteMap enabled="true"/>
+    <compilation debug="true"/>
+    <httpHandlers>
+      <add path="WebResource.axd" verb="GET" 
type="System.Web.Handlers.AssemblyResourceLoader" validate="True" />
+      <add path="page.fake" verb ="GET" 
type="MonoTests.SystemWeb.Framework.MyHandler"/>      
+    </httpHandlers>
+
+    <membership>
+      <providers>
+        <add name="FakeProvider" 
type="MonoTests.SystemWeb.Framework.FakeMembershipProvider, NunitWeb"
+             enablePasswordRetrieval="false" enablePasswordReset="true" 
requiresQuestionAndAnswer="true"
+             applicationName="/" requiresUniqueEmail="false" 
passwordFormat="Hashed"
+             maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"
+             minRequiredNonalphanumericCharacters="1" 
passwordAttemptWindow="10"
+             passwordStrengthRegularExpression="" />
+      </providers>
+    </membership>
+  </system.web>
+  <system.net>
+    <mailSettings>
+      <smtp from="[EMAIL PROTECTED]">
+        <network host="localhost" port="125"/>
+      </smtp>
+    </mailSettings>
+  </system.net>
+</configuration>

Modified: 
trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/FakeMembershipProvider.cs
===================================================================
--- 
trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/FakeMembershipProvider.cs
        2006-11-23 08:58:28 UTC (rev 68382)
+++ 
trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/FakeMembershipProvider.cs
        2006-11-23 09:23:48 UTC (rev 68383)
@@ -164,13 +164,13 @@
 
                public override MembershipUser GetUser (string username, bool 
userIsOnline)
                {
-                       MembershipUser u = new MembershipUser ("", username, 
"", "", "", "", true, false, DateTime.Now, DateTime.Now, DateTime.Now, 
DateTime.Now, DateTime.Now);
+                       MembershipUser u = new MembershipUser ("", username, 
"", "[EMAIL PROTECTED]", "", "", true, false, DateTime.Now, DateTime.Now, 
DateTime.Now, DateTime.Now, DateTime.Now);
                        return u;
                }
 
                public override MembershipUser GetUser (object providerUserKey, 
bool userIsOnline)
                {
-                       MembershipUser u = new MembershipUser ("", "", 
providerUserKey, "", "", "", true, false, DateTime.Now, DateTime.Now, 
DateTime.Now, DateTime.Now, DateTime.Now);
+                       MembershipUser u = new MembershipUser ("", "", 
providerUserKey, "[EMAIL PROTECTED]", "", "", true, false, DateTime.Now, 
DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now);
                        return u;
                }
 

Added: 
trunk/mcs/class/System.Web/Test/mainsoft/NunitWebResources/WebControl.config
===================================================================
--- 
trunk/mcs/class/System.Web/Test/mainsoft/NunitWebResources/WebControl.config    
    2006-11-23 08:58:28 UTC (rev 68382)
+++ 
trunk/mcs/class/System.Web/Test/mainsoft/NunitWebResources/WebControl.config    
    2006-11-23 09:23:48 UTC (rev 68383)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+  <system.web>
+    <siteMap enabled="true"/>
+    <compilation debug="true"/>
+    <httpHandlers>
+      <add path="WebResource.axd" verb="GET" 
type="System.Web.Handlers.AssemblyResourceLoader" validate="True" />
+      <add path="page.fake" verb ="GET" 
type="MonoTests.SystemWeb.Framework.MyHandler"/>      
+    </httpHandlers>
+
+    <membership>
+      <providers>
+        <add name="FakeProvider" 
type="MonoTests.SystemWeb.Framework.FakeMembershipProvider, NunitWeb"
+             enablePasswordRetrieval="false" enablePasswordReset="true" 
requiresQuestionAndAnswer="true"
+             applicationName="/" requiresUniqueEmail="false" 
passwordFormat="Hashed"
+             maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"
+             minRequiredNonalphanumericCharacters="1" 
passwordAttemptWindow="10"
+             passwordStrengthRegularExpression="" />
+      </providers>
+    </membership>
+  </system.web>
+  <system.net>
+    <mailSettings>
+      <smtp from="[EMAIL PROTECTED]">
+        <network host="localhost" port="125"/>
+      </smtp>
+    </mailSettings>
+  </system.net>
+</configuration>

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

Reply via email to