Author: yonik
Date: 2006-09-19 08:14:39 -0400 (Tue, 19 Sep 2006)
New Revision: 65632
Added:
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/CrossPagePostingTest.cs
trunk/mcs/class/System.Web/Test/mainsoft/NunitWebResources/CrossPagePosting1.aspx
trunk/mcs/class/System.Web/Test/mainsoft/NunitWebResources/CrossPagePosting2.aspx
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/mainsoft/ChangeLog
trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/FormRequest.cs
trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.config
Log:
Add new test for System.Web.System.Web.UI.WebControls.CrossPagePostingTest.cs;
Include resources: CrossPagePosting1.aspx and CrossPagePosting2.aspx;
Removed ovveriden SetUrl from FormRequest.cs - NunitWeb;
Added to NunitWeb default Web.config NunitWeb assembly reference.
Modified: trunk/mcs/class/System.Web/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/ChangeLog 2006-09-19 12:06:33 UTC (rev
65631)
+++ trunk/mcs/class/System.Web/ChangeLog 2006-09-19 12:14:39 UTC (rev
65632)
@@ -1,3 +1,10 @@
+2006-09-19 Yoni Klain <[EMAIL PROTECTED]>
+
+ * System.Web_test.dll.sources: add new
\System.Web.UI.WebControls\CrossPagePostingTest.cs
+ * MakeFile: add new resources for CrossPagePostingTest.cs :
+ Test/mainsoft/NunitWebResources/CrossPagePosting1.aspx ;
+ Test/mainsoft/NunitWebResources/CrossPagePosting2.aspx ;
+
2006-09-18 Yoni Klain <[EMAIL PROTECTED]>
* System.Web_test.dll.sources: add new
\System.Web.UI.WebControls\MappingUrlTest.cs
Modified: trunk/mcs/class/System.Web/Makefile
===================================================================
--- trunk/mcs/class/System.Web/Makefile 2006-09-19 12:06:33 UTC (rev 65631)
+++ trunk/mcs/class/System.Web/Makefile 2006-09-19 12:14:39 UTC (rev 65632)
@@ -111,6 +111,8 @@
Test/mainsoft/NunitWebResources/WebMapping.config \
Test/mainsoft/NunitWebResources/Mapping.aspx \
Test/mainsoft/NunitWebResources/Mapping1.aspx \
+ Test/mainsoft/NunitWebResources/CrossPagePosting1.aspx \
+ Test/mainsoft/NunitWebResources/CrossPagePosting2.aspx \
Test/mainsoft/MainsoftWebTest/nunitweb_config.xml
NUNIT_RESOURCE_FILES = $(TEST_RESOURCE_FILES)
Modified: trunk/mcs/class/System.Web/System.Web_test.dll.sources
===================================================================
--- trunk/mcs/class/System.Web/System.Web_test.dll.sources 2006-09-19
12:06:33 UTC (rev 65631)
+++ trunk/mcs/class/System.Web/System.Web_test.dll.sources 2006-09-19
12:14:39 UTC (rev 65632)
@@ -151,6 +151,7 @@
System.Web.UI.WebControls/ContentTest.cs
System.Web.UI.WebControls/CreateUserWizardStepTest.cs
System.Web.UI.WebControls/CreateUserWizardTest.cs
+System.Web.UI.WebControls/CrossPagePostingTest.cs
System.Web.UI.WebControls/CustomValidatorTest.cs
System.Web.UI.WebControls/DataBoundControlTest.cs
System.Web.UI.WebControls/DataControlFieldCollectionTest.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-09-19 12:06:33 UTC (rev 65631)
+++ trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
2006-09-19 12:14:39 UTC (rev 65632)
@@ -1,3 +1,7 @@
+2006-09-19 Yoni Klain <[EMAIL PROTECTED]>
+
+ * CrossPagePostingTest.cs: New test was added
+
2006-09-18 Yoni Klain <[EMAIL PROTECTED]>
* MappingUrlTest.cs: New test was added
Added:
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/CrossPagePostingTest.cs
===================================================================
---
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/CrossPagePostingTest.cs
2006-09-19 12:06:33 UTC (rev 65631)
+++
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/CrossPagePostingTest.cs
2006-09-19 12:14:39 UTC (rev 65632)
@@ -0,0 +1,156 @@
+//
+// Tests for System.Web.UI.WebControls.CrossPagePostingTest.cs
+//
+// Author:
+// Yoni Klein ([EMAIL PROTECTED])
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.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.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+using MonoTests.SystemWeb.Framework;
+using System.Web.UI;
+using System.Threading;
+using System.Collections;
+
+namespace MonoTests.System.Web.UI.WebControls
+{
+
+
+ [TestFixture]
+ public class CrossPagePosting
+ {
+ [TestFixtureSetUp]
+ public void Set_Up ()
+ {
+#if DOT_NET
+ WebTest.CopyResource (GetType (),
"MonoTests.System.Web.UI.WebControls.Resources.CrossPagePosting1.aspx",
"CrossPagePosting1.aspx");
+ WebTest.CopyResource (GetType (),
"MonoTests.System.Web.UI.WebControls.Resources.CrossPagePosting2.aspx",
"CrossPagePosting2.aspx");
+#else
+ WebTest.CopyResource (GetType (),
"CrossPagePosting1.aspx", "CrossPagePosting1.aspx");
+ WebTest.CopyResource (GetType (),
"CrossPagePosting2.aspx", "CrossPagePosting2.aspx");
+#endif
+ }
+
+ [SetUp]
+ public void SetupTestCase ()
+ {
+ Thread.Sleep (100);
+ }
+
+ [Test]
+ [Category ("NunitWeb")]
+ [Category ("NotWorking")]
+ public void CrossPagePosting_BaseFixture ()
+ {
+ WebTest t = new WebTest ("CrossPagePosting1.aspx");
+ string html = t.Run ();
+
+ if (html.IndexOf ("LinkButtonText") < 0)
+ Assert.Fail ("Link button not created fail");
+
+ PageDelegates pd = new PageDelegates ();
+ pd.Load = Load;
+ t.Invoker = new PageInvoker (pd);
+
+ FormRequest fr = new FormRequest (t.Response, "form1");
+ fr.Controls.Add ("__EVENTTARGET");
+ fr.Controls.Add ("__EVENTARGUMENT");
+
+ fr.Controls["__EVENTTARGET"].Value = "LinkButton1";
+ fr.Controls["__EVENTARGUMENT"].Value = "";
+
+ t.Request = fr;
+ fr.Url = "CrossPagePosting2.aspx";
+ html = t.Run ();
+ if (html.IndexOf ("CrossedPostbackPage") < 0)
+ Assert.Fail ("CrossPagePosting removeing to
target page fail");
+ }
+
+ public static void Load (Page p)
+ {
+ if (p.PreviousPage == null)
+ Assert.Fail ("Post back page does not exist
fail");
+
+ }
+
+ [Test]
+ [Category ("NunitWeb")]
+ [Category ("NotWorking")]
+ public void CrossPagePosting_BaseFlow ()
+ {
+ // NOTE!!! Test user data assigned stright on aspx pages
+ WebTest t = new WebTest ("CrossPagePosting1.aspx");
+ string html = t.Run ();
+
+ if (html.IndexOf ("LinkButtonText") < 0)
+ Assert.Fail ("Link button not created fail");
+
+ FormRequest fr = new FormRequest (t.Response, "form1");
+ fr.Controls.Add ("__EVENTTARGET");
+ fr.Controls.Add ("__EVENTARGUMENT");
+
+ fr.Controls["__EVENTTARGET"].Value = "LinkButton1";
+ fr.Controls["__EVENTARGUMENT"].Value = "";
+
+ t.Request = fr;
+ fr.Url = "CrossPagePosting2.aspx";
+ html = t.Run ();
+ ExpectTestResult (t);
+ }
+
+ private void ExpectTestResult (WebTest t)
+ {
+ // NOTE!!! Test user data assigned stright on aspx pages
+ if (t.UserData == null)
+ Assert.Fail ("User data not created fail");
+
+ ArrayList list = t.UserData as ArrayList;
+ if (list == null)
+ Assert.Fail ("User data type failed");
+
+ Assert.AreEqual ("Page1 - Load", list[0].ToString (),
"Application flow #1");
+ Assert.AreEqual ("Page1 - LoadComplete",
list[1].ToString (), "Application flow #2");
+ Assert.AreEqual ("Page1 - PreRender", list[2].ToString
(), "Application flow #3");
+ Assert.AreEqual ("Page1 - SaveStateComplete",
list[3].ToString (), "Application flow #4");
+ Assert.AreEqual ("Page1 - Unload", list[4].ToString (),
"Application flow #5");
+ Assert.AreEqual ("Page2 - OnInit", list[5].ToString (),
"Application flow #6");
+ Assert.AreEqual ("Page2 - Load", list[6].ToString (),
"Application flow #7");
+ Assert.AreEqual ("Page2 - LoadComplete",
list[7].ToString (), "Application flow #8");
+ Assert.AreEqual ("Page2 - PreRender", list[8].ToString
(), "Application flow #9");
+ Assert.AreEqual ("Page2 - SaveStateComplete",
list[9].ToString (), "Application flow #10");
+ Assert.AreEqual ("Page2 - Unload", list[10].ToString
(), "Application flow #11");
+ }
+
+ [TestFixtureTearDown]
+ public void Unload ()
+ {
+ WebTest.Unload ();
+ }
+ }
+}
+#endif
Modified: trunk/mcs/class/System.Web/Test/mainsoft/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/Test/mainsoft/ChangeLog 2006-09-19 12:06:33 UTC
(rev 65631)
+++ trunk/mcs/class/System.Web/Test/mainsoft/ChangeLog 2006-09-19 12:14:39 UTC
(rev 65632)
@@ -1,3 +1,10 @@
+2006-09-19 Yoni Klain <[EMAIL PROTECTED]>
+ * Web.config added NunitWeb assembly ;
+ * WebTest.cs remove overriden set url ;
+ * new resources :
+ Test/mainsoft/NunitWebResources/CrossPagePosting1.aspx ;
+ Test/mainsoft/NunitWebResources/CrossPagePosting2.aspx ;
+
2006-09-18 Yoni Klain <[EMAIL PROTECTED]>
* new resources :
Modified:
trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/FormRequest.cs
===================================================================
--- trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/FormRequest.cs
2006-09-19 12:06:33 UTC (rev 65631)
+++ trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/FormRequest.cs
2006-09-19 12:14:39 UTC (rev 65632)
@@ -101,14 +101,7 @@
/// property should not be changed, otherwise an <see
cref="Exception"/>
/// is thrown.
/// </summary>
- /// <exception cref="Exception">Thrown when trying to change
this property.</exception>
- public override string Url
- {
- get { return base.Url; }
- set { throw new Exception ("Must not change Url of
FormPostback"); }
- }
-
- /// <summary>
+
/// Get returns true if the form method was POST, otherwise
returns false.
/// Unlike the base class, here this property should not be
/// changed, otherwise an <see cref="Exception"/> is thrown.
Modified:
trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.config
===================================================================
---
trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.config
2006-09-19 12:06:33 UTC (rev 65631)
+++
trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.config
2006-09-19 12:14:39 UTC (rev 65632)
@@ -2,7 +2,14 @@
<configuration>
<system.web>
<siteMap enabled="true"/>
- <compilation debug="true"/>
+ <compilation debug="true">
+ <assemblies>
+ <add assembly="NunitWeb"/>
+ </assemblies>
+ </compilation>
+
+
+
<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"/>
Added:
trunk/mcs/class/System.Web/Test/mainsoft/NunitWebResources/CrossPagePosting1.aspx
===================================================================
---
trunk/mcs/class/System.Web/Test/mainsoft/NunitWebResources/CrossPagePosting1.aspx
2006-09-19 12:06:33 UTC (rev 65631)
+++
trunk/mcs/class/System.Web/Test/mainsoft/NunitWebResources/CrossPagePosting1.aspx
2006-09-19 12:14:39 UTC (rev 65632)
@@ -0,0 +1,120 @@
+<%@ Page Language="C#" AutoEventWireup="true" %>
+<%@ Import Namespace="MonoTests.SystemWeb.Framework" %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<script runat="server">
+
+ protected void LinkButton1_Click (object sender, EventArgs e)
+ {
+ if (WebTest.CurrentTest.UserData == null) {
+ ArrayList list = new ArrayList ();
+ list.Add ("LinkButton1_Click");
+ WebTest.CurrentTest.UserData = list;
+ }
+ else {
+ ArrayList list = WebTest.CurrentTest.UserData as ArrayList;
+ if (list == null)
+ throw new NullReferenceException ();
+ list.Add ("LinkButton1_Click");
+ WebTest.CurrentTest.UserData = list;
+ }
+ }
+
+ protected void Page_Load (object sender, EventArgs e)
+ {
+ if (WebTest.CurrentTest.UserData == null) {
+ ArrayList list = new ArrayList ();
+ list.Add ("Page1 - Load");
+ WebTest.CurrentTest.UserData = list;
+ }
+ else {
+ ArrayList list = WebTest.CurrentTest.UserData as ArrayList;
+ if (list == null)
+ throw new NullReferenceException ();
+ list.Add ("Page1 - Load");
+ WebTest.CurrentTest.UserData = list;
+ }
+ }
+
+ protected override void OnLoadComplete (EventArgs e)
+ {
+ base.OnLoadComplete (e);
+ if (WebTest.CurrentTest.UserData == null) {
+ ArrayList list = new ArrayList ();
+ list.Add ("Page1 - LoadComplete");
+ WebTest.CurrentTest.UserData = list;
+ }
+ else {
+ ArrayList list = WebTest.CurrentTest.UserData as ArrayList;
+ if (list == null)
+ throw new NullReferenceException ();
+ list.Add ("Page1 - LoadComplete");
+ WebTest.CurrentTest.UserData = list;
+ }
+ }
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ base.OnPreRender (e);
+ if (WebTest.CurrentTest.UserData == null) {
+ ArrayList list = new ArrayList ();
+ list.Add ("Page1 - PreRender");
+ WebTest.CurrentTest.UserData = list;
+ }
+ else {
+ ArrayList list = WebTest.CurrentTest.UserData as ArrayList;
+ if (list == null)
+ throw new NullReferenceException ();
+ list.Add ("Page1 - PreRender");
+ WebTest.CurrentTest.UserData = list;
+ }
+ }
+
+ protected override void OnUnload (EventArgs e)
+ {
+ base.OnUnload (e);
+ if (WebTest.CurrentTest.UserData == null) {
+ ArrayList list = new ArrayList ();
+ list.Add ("Page1 - Unload");
+ WebTest.CurrentTest.UserData = list;
+ }
+ else {
+ ArrayList list = WebTest.CurrentTest.UserData as ArrayList;
+ if (list == null)
+ throw new NullReferenceException ();
+ list.Add ("Page1 - Unload");
+ WebTest.CurrentTest.UserData = list;
+ }
+ }
+
+ protected override void OnSaveStateComplete (EventArgs e)
+ {
+ base.OnSaveStateComplete (e);
+ if (WebTest.CurrentTest.UserData == null) {
+ ArrayList list = new ArrayList ();
+ list.Add ("Page1 - SaveStateComplete");
+ WebTest.CurrentTest.UserData = list;
+ }
+ else {
+ ArrayList list = WebTest.CurrentTest.UserData as ArrayList;
+ if (list == null)
+ throw new NullReferenceException ();
+ list.Add ("Page1 - SaveStateComplete");
+ WebTest.CurrentTest.UserData = list;
+ }
+ }
+</script>
+
+<html xmlns="http://www.w3.org/1999/xhtml" >
+<head runat="server">
+ <title>Untitled Page</title>
+</head>
+<body>
+ <form id="form1" runat="server">
+ <div>
+ <asp:LinkButton ID="LinkButton1" runat="server"
PostBackUrl="~/CrossPagePosting2.aspx"
OnClick="LinkButton1_Click">LinkButtonText</asp:LinkButton>
+ </div>
+ </form>
+</body>
+</html>
Added:
trunk/mcs/class/System.Web/Test/mainsoft/NunitWebResources/CrossPagePosting2.aspx
===================================================================
---
trunk/mcs/class/System.Web/Test/mainsoft/NunitWebResources/CrossPagePosting2.aspx
2006-09-19 12:06:33 UTC (rev 65631)
+++
trunk/mcs/class/System.Web/Test/mainsoft/NunitWebResources/CrossPagePosting2.aspx
2006-09-19 12:14:39 UTC (rev 65632)
@@ -0,0 +1,125 @@
+<%@ Page Language="C#" AutoEventWireup="true" %>
+<%@ Import Namespace="MonoTests.SystemWeb.Framework" %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" >
+<head runat="server">
+ <title>Untitled Page</title>
+ <script runat="server">
+ protected override void OnInit (EventArgs e)
+ {
+ base.OnInit (e);
+ if (WebTest.CurrentTest.UserData == null) {
+ ArrayList list = new ArrayList ();
+ list.Add ("Page2 - OnInit");
+ WebTest.CurrentTest.UserData = list;
+ }
+ else {
+ ArrayList list = WebTest.CurrentTest.UserData as ArrayList;
+ if (list == null)
+ throw new NullReferenceException ();
+ list.Add ("Page2 - OnInit");
+ WebTest.CurrentTest.UserData = list;
+ }
+ }
+
+ protected override void OnLoad (EventArgs e)
+ {
+ if (WebTest.CurrentTest.UserData == null) {
+ ArrayList list = new ArrayList ();
+ list.Add ("Page2 - Load");
+ WebTest.CurrentTest.UserData = list;
+ }
+ else {
+ ArrayList list = WebTest.CurrentTest.UserData as ArrayList;
+ if (list == null)
+ throw new NullReferenceException ();
+ list.Add ("Page2 - Load");
+ WebTest.CurrentTest.UserData = list;
+ }
+ }
+
+ protected override void OnLoadComplete (EventArgs e)
+ {
+ base.OnLoadComplete (e);
+ if (WebTest.CurrentTest.UserData == null) {
+ ArrayList list = new ArrayList ();
+ list.Add ("Page2 - LoadComplete");
+ WebTest.CurrentTest.UserData = list;
+ }
+ else {
+ ArrayList list = WebTest.CurrentTest.UserData as ArrayList;
+ if (list == null)
+ throw new NullReferenceException ();
+ list.Add ("Page2 - LoadComplete");
+ WebTest.CurrentTest.UserData = list;
+ }
+ }
+
+ protected override void OnPreRender (EventArgs e)
+ {
+ base.OnPreRender (e);
+ if (WebTest.CurrentTest.UserData == null) {
+ ArrayList list = new ArrayList ();
+ list.Add ("Page2 - PreRender");
+ WebTest.CurrentTest.UserData = list;
+ }
+ else {
+ ArrayList list = WebTest.CurrentTest.UserData as ArrayList;
+ if (list == null)
+ throw new NullReferenceException ();
+ list.Add ("Page2 - PreRender");
+ WebTest.CurrentTest.UserData = list;
+ }
+ }
+
+ protected override void OnUnload (EventArgs e)
+ {
+ base.OnUnload (e);
+ if (WebTest.CurrentTest.UserData == null) {
+ ArrayList list = new ArrayList ();
+ list.Add ("Page2 - Unload");
+ WebTest.CurrentTest.UserData = list;
+ }
+ else {
+ ArrayList list = WebTest.CurrentTest.UserData as ArrayList;
+ if (list == null)
+ throw new NullReferenceException ();
+ list.Add ("Page2 - Unload");
+ WebTest.CurrentTest.UserData = list;
+ }
+ }
+
+ protected override void OnSaveStateComplete (EventArgs e)
+ {
+ base.OnSaveStateComplete (e);
+ if (WebTest.CurrentTest.UserData == null) {
+ ArrayList list = new ArrayList ();
+ list.Add ("Page2 - SaveStateComplete");
+ WebTest.CurrentTest.UserData = list;
+ }
+ else {
+ ArrayList list = WebTest.CurrentTest.UserData as ArrayList;
+ if (list == null)
+ throw new NullReferenceException ();
+ list.Add ("Page2 - SaveStateComplete");
+ WebTest.CurrentTest.UserData = list;
+ }
+ }
+
+ </script>
+</head>
+
+
+
+
+
+<body>
+ <form id="form1" runat="server">
+ <div>
+ CrossedPostbackPage
+ </div>
+ </form>
+</body>
+</html>
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches