Author: yonik
Date: 2007-02-19 04:26:30 -0500 (Mon, 19 Feb 2007)
New Revision: 73100

Modified:
   trunk/mcs/class/System.Web/ChangeLog
   trunk/mcs/class/System.Web/System.Web_test.dll.sources
   trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/BulletedListTest.cs
   trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
   
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangePasswordTest.cs
Log:


Modified: trunk/mcs/class/System.Web/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/ChangeLog        2007-02-19 09:25:40 UTC (rev 
73099)
+++ trunk/mcs/class/System.Web/ChangeLog        2007-02-19 09:26:30 UTC (rev 
73100)
@@ -1,3 +1,7 @@
+2007-02-19  YonikKalin  <[EMAIL PROTECTED]>
+
+       * Add System.Web_test.dll.sources add ChangePasswordTest.cs 
+
 2007-02-18  Eyal Alaluf  <[EMAIL PROTECTED]>
 
        * run-mono-tests.bat: Add J2EE jar to classpath.

Modified: trunk/mcs/class/System.Web/System.Web_test.dll.sources
===================================================================
--- trunk/mcs/class/System.Web/System.Web_test.dll.sources      2007-02-19 
09:25:40 UTC (rev 73099)
+++ trunk/mcs/class/System.Web/System.Web_test.dll.sources      2007-02-19 
09:26:30 UTC (rev 73100)
@@ -145,6 +145,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

Modified: 
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/BulletedListTest.cs
===================================================================
--- 
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/BulletedListTest.cs   
    2007-02-19 09:25:40 UTC (rev 73099)
+++ 
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/BulletedListTest.cs   
    2007-02-19 09:26:30 UTC (rev 73100)
@@ -37,7 +37,10 @@
 using System.Web;
 using System.Web.UI;
 using System.Web.UI.WebControls;
+using MonoTests.SystemWeb.Framework;
+using MonoTests.stand_alone.WebHarness;
 
+
 namespace MonoTests.System.Web.UI.WebControls
 {
        class PokerBulletedList : BulletedList
@@ -97,6 +100,12 @@
        [TestFixture]
        public class BulletedListTest
        {
+               [TestFixtureSetUp]
+               public void SetUp ()
+               {
+                       WebTest.CopyResource (GetType (), 
"NoEventValidation.aspx", "NoEventValidation.aspx");
+               }
+
                [Test]
                public void BulletedList_DefaultProperties ()
                {
@@ -315,6 +324,61 @@
                        Assert.AreEqual (true, clicked, "BeforeClick");
                }
 
+               //PostBack raise event
+               [Test]
+               [Category ("NunitWeb")]
+               public void BulletedList_PostBackEvent ()
+               {
+                       WebTest t = new WebTest ("NoEventValidation.aspx");
+                       t.Invoker = PageInvoker.CreateOnInit (new PageDelegate 
(_PostBackEvent));
+                       string html = t.Run ();
+                       if (html.IndexOf ("Test_Item") < 0)
+                               Assert.Fail ("BulletedList not created");
+
+                       FormRequest fr = new FormRequest (t.Response, "form1");
+                       fr.Controls.Add ("__EVENTTARGET");
+                       fr.Controls.Add ("__EVENTARGUMENT");
+                       fr.Controls["__EVENTTARGET"].Value = "BL";
+                       fr.Controls["__EVENTARGUMENT"].Value = "0";
+                       t.Request = fr;
+                       html = t.Run ();
+                       if (t.UserData == null || (string) t.UserData != 
"list_Click Fired_0")
+                               Assert.Fail ("list_Click Not Fired");
+               }
+
+               #region _PostBackEvent_helper
+               public static void _PostBackEvent (Page p)
+               {
+                       BulletedList list = new BulletedList ();
+                       list.ID = "BL";
+                       list.DisplayMode = BulletedListDisplayMode.LinkButton;
+                       list.Items.Add (new ListItem ("Test_Item", 
"Test_Value", true));
+                       list.Click += new BulletedListEventHandler (list_Click);
+                       p.Controls.Add (list);
+               }
+
+               static void list_Click (object sender, BulletedListEventArgs e)
+               {
+                       WebTest.CurrentTest.UserData = "list_Click Fired_" + 
e.Index.ToString();
+               }
+               #endregion
+
+               [Test]
+               [ExpectedException (typeof (HttpException))]
+               public void VerifyMultiSelectTest ()
+               {
+                       VerifyMultiSelectBulletedList list = new 
VerifyMultiSelectBulletedList ();
+                       list.VerifyMultiSelect ();
+               }
+       
+
+               [TestFixtureTearDown]
+               public void TearDown ()
+               {
+                       WebTest.Unload ();
+               }
+
+               // Help class for DS creation
                private void AddListItems (PokerBulletedList b)
                {
                        ListItem item1 = new ListItem ("Item1", "Item1");
@@ -338,14 +402,6 @@
                        b.Items.Add (item9);
                        b.Items.Add (item10);
                }
-
-        [Test]
-        [ExpectedException(typeof(HttpException))]
-        public void VerifyMultiSelectTest()
-        {
-            VerifyMultiSelectBulletedList list = new 
VerifyMultiSelectBulletedList();
-            list.VerifyMultiSelect();
-        }
        }
 }
 

Modified: trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog 
2007-02-19 09:25:40 UTC (rev 73099)
+++ trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog 
2007-02-19 09:26:30 UTC (rev 73100)
@@ -1,3 +1,7 @@
+2007-02-19  yonik <[EMAIL PROTECTED]>
+
+     * ChangePasswordTest.cs,BulletedListTest.cs: Add new tests for 
PostbackEvents 
+     
 2007-02-19 Igor Zelmanovich <[EMAIL PROTECTED]>
 
        * GridViewTest:

Modified: 
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangePasswordTest.cs
===================================================================
--- 
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangePasswordTest.cs 
    2007-02-19 09:25:40 UTC (rev 73099)
+++ 
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangePasswordTest.cs 
    2007-02-19 09:26:30 UTC (rev 73100)
@@ -41,7 +41,8 @@
 using MonoTests.SystemWeb.Framework;
 using MonoTests.stand_alone.WebHarness;
 
-using NUnit.Framework;
+using NUnit.Framework;
+using System.Collections.Specialized;
 
 namespace MonoTests.System.Web.UI.WebControls
 {
@@ -566,31 +567,232 @@
 
                        test.Request = fr;
                        html = test.Run ();
-
-                       //
-                       // The following fails with the following exception:
-//System.TypeInitializationException: An exception was thrown by the type 
initializer for System.Web.Security.Membership ---&gt; 
System.Configuration.ConfigurationErrorsException: Could not find type: 
MonoTests.SystemWeb.Framework.FakeMembershipProvider () ()
-//  at System.Web.Configuration.ProvidersHelper.InstantiateProvider 
(System.Configuration.ProviderSettings providerSettings, System.Type 
providerType) [0x00000]
-//  at System.Web.Configuration.ProvidersHelper.InstantiateProviders 
(System.Configuration.ProviderSettingsCollection configProviders, 
System.Configuration.Provider.ProviderCollection providers, System.Type 
providerType) [0x00000]
-//  at System.Web.Security.Membership..cctor () [0x00000] --- End of inner 
exception stack trace ---
-//
-//  at &lt;0x00000&gt; &lt;unknown method&gt;
-//  at System.Web.UI.WebControls.ChangePassword.InitMemberShipProvider () 
[0x00000]
-//  at System.Web.UI.WebControls.ChangePassword.get_MembershipProviderInternal 
() [0x00000]
-//  at System.Web.UI.WebControls.ChangePassword.ProcessChangePasswordEvent 
(System.Web.UI.WebControls.CommandEventArgs args) [0x00000]
-//  at System.Web.UI.WebControls.ChangePassword.OnBubbleEvent (System.Object 
source, System.EventArgs e) [0x00000]
-//  at System.Web.UI.Control.RaiseBubbleEvent (System.Object source, 
System.EventArgs args) [0x00000]
-//  at System.Web.UI.WebControls.Button.OnCommand 
(System.Web.UI.WebControls.CommandEventArgs e) [0x00000]
-//  at System.Web.UI.WebControls.Button.RaisePostBackEvent (System.String 
eventArgument) [0x00000]
-//  at 
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent
 (System.String eventArgument) [0x00000]
-//  at System.Web.UI.Page.RaisePostBackEvent (IPostBackEventHandler 
sourceControl, System.String eventArgument) [0x00000]
-//  at System.Web.UI.Page.RaisePostBackEvents () [0x00000]
-//  at System.Web.UI.Page.InternalProcessRequest () [0x00000]
-//  at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context) 
[0x00000] </pre></code>^M
-//
                        Assert.IsTrue (html.IndexOf ("has been changed") > 0, 
"GetPassword");
-               }
-
+               }
+
+               [Test]
+               [Category ("NotWorking")]
+               [Category ("NunitWeb")]
+               public void PostBackEventCancel ()
+               {
+                       WebTest t = new WebTest ();
+                       t.Invoker = PageInvoker.CreateOnInit (new PageDelegate 
(_PostBackEventCancel));
+                       string html = t.Run ();
+                       if (html.IndexOf ("Change Your Password") < 0)
+                               Assert.Fail ("ChangePassword not created");
+                       FormRequest fr = new FormRequest (t.Response, "form1");
+                       fr.Controls.Add ("__EVENTTARGET");
+                       fr.Controls.Add ("__EVENTARGUMENT");
+                       fr.Controls.Add 
("ChangePassword1$ChangePasswordContainerID$CurrentPassword");
+                       fr.Controls.Add 
("ChangePassword1$ChangePasswordContainerID$NewPassword");
+                       fr.Controls.Add 
("ChangePassword1$ChangePasswordContainerID$ConfirmNewPassword");
+                       fr.Controls.Add 
("ChangePassword1$ChangePasswordContainerID$CancelPushButton");
+                       
fr.Controls["ChangePassword1$ChangePasswordContainerID$CancelPushButton"].Value 
= "Cancel";
+                       t.Request = fr;
+                       html = t.Run ();
+                       if (t.UserData == null || t.UserData.ToString () != 
"CancelButtonClick")
+                               Assert.Fail ("CancelButtonClick event not 
fired");
+               }
+
+               public static void _PostBackEventCancel (Page p)
+               {
+                       ChangePassword w = CreateTestControl (p);
+                       w.CancelButtonClick += new EventHandler 
(w_CancelButtonClick);
+               }
+
+               static void w_CancelButtonClick (object sender, EventArgs e)
+               {
+                       WebTest.CurrentTest.UserData = "CancelButtonClick";
+               }
+
+
+               [Test]
+               [Category ("NotWorking")]
+               [Category ("NunitWeb")]
+               public void PostBackEventChanging ()
+               {
+                       WebTest t = new WebTest ();
+                       t.Invoker = PageInvoker.CreateOnInit (new PageDelegate 
(_PostBackEventChanging));
+                       string html = t.Run ();
+                       if (html.IndexOf ("Change Your Password") < 0)
+                               Assert.Fail ("ChangePassword not created");
+                       FormRequest fr = new FormRequest (t.Response, "form1");
+                       fr.Controls.Add ("__EVENTTARGET");
+                       fr.Controls.Add ("__EVENTARGUMENT");
+                       
+                       fr.Controls.Add 
("ChangePassword1$ChangePasswordContainerID$CurrentPassword");
+                       fr.Controls.Add 
("ChangePassword1$ChangePasswordContainerID$NewPassword");
+                       fr.Controls.Add 
("ChangePassword1$ChangePasswordContainerID$ConfirmNewPassword");
+                       fr.Controls.Add 
("ChangePassword1$ChangePasswordContainerID$ChangePasswordPushButton");
+                       
+                       
fr.Controls["ChangePassword1$ChangePasswordContainerID$CurrentPassword"].Value 
= "a";
+                       
fr.Controls["ChangePassword1$ChangePasswordContainerID$NewPassword"].Value = 
"1";
+                       
fr.Controls["ChangePassword1$ChangePasswordContainerID$ConfirmNewPassword"].Value
 = "1";
+                       
fr.Controls["ChangePassword1$ChangePasswordContainerID$ChangePasswordPushButton"].Value
 = "Change+Password";
+                               
+                       t.Request = fr;
+                       html = t.Run ();
+                       if (t.UserData == null || t.UserData.ToString () != 
"ChangingPassword")
+                               Assert.Fail ("ChangingPassword event not 
fired");
+               }
+
+               public static void _PostBackEventChanging (Page p)
+               {
+                       ChangePassword w = CreateTestControl (p);
+                       w.DisplayUserName = false;
+                       w.ChangingPassword +=new 
LoginCancelEventHandler(w_ChangingPassword);
+               }
+
+               public static void w_ChangingPassword (object sender, 
LoginCancelEventArgs e)
+               {
+                       WebTest.CurrentTest.UserData = "ChangingPassword";
+                       e.Cancel = true;
+               }
+
+               [Test]
+               [Category ("NotWorking")]
+               [Category ("NunitWeb")]
+               public void PostBackEventError ()
+               {
+                       WebTest t = new WebTest ();
+                       t.Invoker = PageInvoker.CreateOnInit (new PageDelegate 
(_PostBackEventError));
+                       string html = t.Run ();
+                       if (html.IndexOf ("Change Your Password") < 0)
+                               Assert.Fail ("ChangePassword not created");
+                       FormRequest fr = new FormRequest (t.Response, "form1");
+                       fr.Controls.Add ("__EVENTTARGET");
+                       fr.Controls.Add ("__EVENTARGUMENT");
+
+                       fr.Controls.Add 
("ChangePassword1$ChangePasswordContainerID$UserName");
+                       fr.Controls.Add 
("ChangePassword1$ChangePasswordContainerID$CurrentPassword");
+                       fr.Controls.Add 
("ChangePassword1$ChangePasswordContainerID$NewPassword");
+                       fr.Controls.Add 
("ChangePassword1$ChangePasswordContainerID$ConfirmNewPassword");
+                       fr.Controls.Add 
("ChangePassword1$ChangePasswordContainerID$ChangePasswordPushButton");
+
+                       
fr.Controls["ChangePassword1$ChangePasswordContainerID$UserName"].Value = 
"WrongUser";
+                       
fr.Controls["ChangePassword1$ChangePasswordContainerID$CurrentPassword"].Value 
= "a";
+                       
fr.Controls["ChangePassword1$ChangePasswordContainerID$NewPassword"].Value = 
"1";
+                       
fr.Controls["ChangePassword1$ChangePasswordContainerID$ConfirmNewPassword"].Value
 = "1";
+                       
fr.Controls["ChangePassword1$ChangePasswordContainerID$ChangePasswordPushButton"].Value
 = "Change+Password";
+
+                       t.Request = fr;
+                       html = t.Run ();
+                       if (t.UserData == null || t.UserData.ToString () != 
"ChangePasswordError")
+                               Assert.Fail ("ChangePasswordError event not 
fired");
+               }
+
+               public static void _PostBackEventError (Page p)
+               {
+                       ChangePassword w = CreateTestControl (p);
+                       w.ChangePasswordError += new EventHandler 
(w_ChangePasswordError);
+               }
+
+               public static void w_ChangePasswordError (object sender, 
EventArgs e)
+               {
+                       WebTest.CurrentTest.UserData = "ChangePasswordError";
+               }
+
+               
+               [Test]
+               [Category ("NotWorking")]
+               [Category ("NunitWeb")]
+               public void PostBackEventChangedPassword ()
+               {
+                       WebTest t = new WebTest ();
+                       t.Invoker = PageInvoker.CreateOnInit (new PageDelegate 
(_PostBackEventChangedPassword));
+                       string html = t.Run ();
+                       if (html.IndexOf ("Change Your Password") < 0)
+                               Assert.Fail ("ChangePassword not created");
+                       FormRequest fr = new FormRequest (t.Response, "form1");
+                       fr.Controls.Add ("__EVENTTARGET");
+                       fr.Controls.Add ("__EVENTARGUMENT");
+
+                       fr.Controls.Add 
("ChangePassword1$ChangePasswordContainerID$CurrentPassword");
+                       fr.Controls.Add 
("ChangePassword1$ChangePasswordContainerID$NewPassword");
+                       fr.Controls.Add 
("ChangePassword1$ChangePasswordContainerID$ConfirmNewPassword");
+                       fr.Controls.Add 
("ChangePassword1$ChangePasswordContainerID$ChangePasswordPushButton");
+
+                       
fr.Controls["ChangePassword1$ChangePasswordContainerID$CurrentPassword"].Value 
= "[EMAIL PROTECTED]";
+                       
fr.Controls["ChangePassword1$ChangePasswordContainerID$NewPassword"].Value = 
"123456?";
+                       
fr.Controls["ChangePassword1$ChangePasswordContainerID$ConfirmNewPassword"].Value
 = "123456?";
+                       
fr.Controls["ChangePassword1$ChangePasswordContainerID$ChangePasswordPushButton"].Value
 = "Change+Password";
+
+                       t.Request = fr;
+                       html = t.Run ();
+                       if (t.UserData == null || t.UserData.ToString () != 
"ChangedPassword")
+                               Assert.Fail ("ChangedPassword event not fired");
+               }
+
+               public static void _PostBackEventChangedPassword (Page p)
+               {
+                       ChangePassword w = CreateTestControl (p);
+                       w.DisplayUserName = false;
+                       w.ChangedPassword += new EventHandler 
(w_ChangedPassword);
+               }
+
+               public static void w_ChangedPassword (object sender, EventArgs 
e)
+               {
+                       WebTest.CurrentTest.UserData = "ChangedPassword";
+               }
+
+               [Test]
+               [Category ("NunitWeb")]
+               [Category ("NotWorking")]
+               public void PostBackEventContinue ()
+               {
+                       WebTest t = new WebTest ();
+                       t.Invoker = PageInvoker.CreateOnInit (new PageDelegate 
(_PostBackEventContinue));
+                       string html = t.Run ();
+                       if (html.IndexOf ("Change Your Password") < 0)
+                               Assert.Fail ("ChangePassword not created");
+                       FormRequest fr = new FormRequest (t.Response, "form1");
+                       fr.Controls.Add ("__EVENTTARGET");
+                       fr.Controls.Add ("__EVENTARGUMENT");
+
+                       fr.Controls.Add 
("ChangePassword1$ChangePasswordContainerID$CurrentPassword");
+                       fr.Controls.Add 
("ChangePassword1$ChangePasswordContainerID$NewPassword");
+                       fr.Controls.Add 
("ChangePassword1$ChangePasswordContainerID$ConfirmNewPassword");
+                       fr.Controls.Add 
("ChangePassword1$ChangePasswordContainerID$ChangePasswordPushButton");
+                       
fr.Controls["ChangePassword1$ChangePasswordContainerID$CurrentPassword"].Value 
= "[EMAIL PROTECTED]";
+                       
fr.Controls["ChangePassword1$ChangePasswordContainerID$NewPassword"].Value = 
"123456?";
+                       
fr.Controls["ChangePassword1$ChangePasswordContainerID$ConfirmNewPassword"].Value
 = "123456?";
+                       
fr.Controls["ChangePassword1$ChangePasswordContainerID$ChangePasswordPushButton"].Value
 = "Change+Password";
+
+                       t.Request = fr;
+                       html = t.Run ();
+                       if (html.IndexOf ("Change Password Complete") < 0)
+                               Assert.Fail ("Password has not beeb changed!");
+                       
+                       fr = new FormRequest (t.Response, "form1");
+                       fr.Controls.Add ("__EVENTTARGET");
+                       fr.Controls.Add ("__EVENTARGUMENT");
+                       fr.Controls.Add 
("ChangePassword1$SuccessContainerID$ContinuePushButton");
+                       
fr.Controls["ChangePassword1$SuccessContainerID$ContinuePushButton"].Value = 
"Continue";
+
+                       t.Request = fr;
+                       html = t.Run ();
+
+                       if (t.UserData == null || t.UserData.ToString () != 
"ContinueButtonClick")
+                               Assert.Fail ("ContinueButtonClick event not 
fired");
+               }
+
+               public static void _PostBackEventContinue (Page p)
+               {
+                       ChangePassword w = CreateTestControl (p);
+                       w.DisplayUserName = false;
+                       w.ContinueButtonClick += new EventHandler 
(w_ContinueButtonClick);
+               }
+
+               public static void w_ContinueButtonClick (object sender, 
EventArgs e)
+               {
+                       WebTest.CurrentTest.UserData = "ContinueButtonClick";
+               }
+
+               [TestFixtureTearDown]
+               public void TearDown ()
+               {
+                       WebTest.Unload ();
+               }
        }
 }
 

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

Reply via email to