Author: andrews
Date: 2006-06-22 04:35:08 -0400 (Thu, 22 Jun 2006)
New Revision: 61931

Added:
   trunk/mcs/class/System.Web/Test/mainsoft/MainsoftWebTest/HtmlCompare.csproj
   trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/FormPostback.cs
   trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/FormRequest.cs
Modified:
   trunk/mcs/class/System.Web/Test/mainsoft/MainsoftWebTest/XmlComparer.cs
   trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/BaseRequest.cs
   trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/NunitWeb.csproj
   trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/Test1/Class1.cs
   trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/Test1/Test1.csproj
Log:
Add HtmlCompare project; add PostBack skeleton

Added: 
trunk/mcs/class/System.Web/Test/mainsoft/MainsoftWebTest/HtmlCompare.csproj
===================================================================
--- trunk/mcs/class/System.Web/Test/mainsoft/MainsoftWebTest/HtmlCompare.csproj 
2006-06-22 05:13:15 UTC (rev 61930)
+++ trunk/mcs/class/System.Web/Test/mainsoft/MainsoftWebTest/HtmlCompare.csproj 
2006-06-22 08:35:08 UTC (rev 61931)
@@ -0,0 +1,65 @@
+<Project DefaultTargets="Build" 
xmlns="http://schemas.microsoft.com/developer/msbuild/2003";>
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{BF64011B-D7DB-4AB8-8EAB-FE0AA1EE74CD}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>HtmlCompare</RootNamespace>
+    <AssemblyName>HtmlCompare</AssemblyName>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' 
">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 
'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="nunit.framework, Version=2.2.0.0, Culture=neutral, 
PublicKeyToken=96d09a1eb7f44a77" />
+    <Reference Include="System" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="HtmlAgilityPack\AssemblyInfo.cs" />
+    <Compile Include="HtmlAgilityPack\crc32.cs" />
+    <Compile Include="HtmlAgilityPack\Header.cs" />
+    <Compile Include="HtmlAgilityPack\HtmlAttribute.cs" />
+    <Compile Include="HtmlAgilityPack\HtmlDocument.cs" />
+    <Compile Include="HtmlAgilityPack\HtmlEntity.cs" />
+    <Compile Include="HtmlAgilityPack\HtmlNode.cs" />
+    <Compile Include="HtmlAgilityPack\HtmlNodeNavigator.cs" />
+    <Compile Include="HtmlAgilityPack\HtmlWeb.cs" />
+    <Compile Include="HtmlAgilityPack\MixedCodeDocument.cs" />
+    <Compile Include="HtmlAgilityPack\ParseReader.cs" />
+    <Compile Include="HtmlAgilityPack\tools.cs" />
+    <Compile Include="NunitWebTest.cs" />
+    <Compile Include="XmlComparer.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="HtmlAgilityPack\readme.txt" />
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Properties\" />
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets 
below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file

Modified: 
trunk/mcs/class/System.Web/Test/mainsoft/MainsoftWebTest/XmlComparer.cs
===================================================================
--- trunk/mcs/class/System.Web/Test/mainsoft/MainsoftWebTest/XmlComparer.cs     
2006-06-22 05:13:15 UTC (rev 61930)
+++ trunk/mcs/class/System.Web/Test/mainsoft/MainsoftWebTest/XmlComparer.cs     
2006-06-22 08:35:08 UTC (rev 61931)
@@ -1,6 +1,5 @@
 using System;
 using System.Xml;
-using NUnit.Framework;
 
 namespace MonoTests.stand_alone.WebHarness
 {

Modified: 
trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/BaseRequest.cs
===================================================================
--- trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/BaseRequest.cs   
2006-06-22 05:13:15 UTC (rev 61930)
+++ trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/BaseRequest.cs   
2006-06-22 08:35:08 UTC (rev 61931)
@@ -13,8 +13,19 @@
        [Serializable]
        public class BaseRequest
        {
-               string _url;
-               public string Url
+               string _url;
+
+               public BaseRequest ()
+               {
+               }
+
+               public BaseRequest (string url)
+                       : this ()
+               {
+                       this._url = url;
+               }
+
+               public virtual string Url
                {
                        get { return _url; }
                        set { _url = value; }

Added: 
trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/FormPostback.cs
===================================================================
--- trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/FormPostback.cs  
2006-06-22 05:13:15 UTC (rev 61930)
+++ trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/FormPostback.cs  
2006-06-22 08:35:08 UTC (rev 61931)
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Specialized;
+
+namespace MonoTests.SystemWeb.Framework
+{
+       [Serializable]
+       public class FormPostback:FormRequest
+       {
+               internal FormPostback (string url, NameValueCollection fields)
+                       :base (url)
+               {
+                       this._fields = fields;
+               }
+
+               private NameValueCollection _fields;
+               public NameValueCollection Fields
+               {
+                       get { return Fields; }
+               }
+
+               public virtual string Url
+               {
+                       get { return base.Url; }
+                       set { throw new Exception ("Must not change Url of 
FormPostback"); }
+               }
+       }
+}

Added: trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/FormRequest.cs
===================================================================
--- trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/FormRequest.cs   
2006-06-22 05:13:15 UTC (rev 61930)
+++ trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/FormRequest.cs   
2006-06-22 08:35:08 UTC (rev 61931)
@@ -0,0 +1,61 @@
+using System;
+using System.Xml;
+using System.Collections.Specialized;
+using System.Web;
+using System.IO;
+using System.Text;
+
+namespace MonoTests.SystemWeb.Framework
+{
+       [Serializable]
+       public class FormRequest: BaseRequest
+       {
+               public FormRequest ()
+               {
+               }
+
+               public FormRequest (string url)
+                       :base (url)
+               {
+               }
+
+               [NonSerialized]
+               string lastResult;
+
+               public virtual string GetRequestResult (HttpWorkerRequest 
request)
+               {
+                       lastResult = base.GetRequestResult (request);
+                       return lastResult;
+               }
+
+               public FormPostback CreateNext (string formId)
+               {
+                       HtmlAgilityPack.HtmlDocument htmlDoc = new 
HtmlAgilityPack.HtmlDocument ();
+                       htmlDoc.LoadHtml (lastResult);
+
+                       StringBuilder tempxml = new StringBuilder (); 
+                       StringWriter tsw = new StringWriter (tempxml);
+                       htmlDoc.OptionOutputAsXml = true;
+                       htmlDoc.Save (tsw);
+
+                       XmlDocument doc = new XmlDocument ();
+                       doc.LoadXml (tempxml.ToString ());
+
+                       XmlNode formNode = doc.SelectSingleNode ("[EMAIL 
PROTECTED]" + formId + "]");
+                       if (formNode == null)
+                               throw new ArgumentException ("Form with id='" + 
formId +
+                                       "' was not found in document: " + 
lastResult);
+
+                       string targetUrl = formNode.Attributes ["action"].Value;
+                       if (targetUrl == null)
+                               targetUrl = this.Url;
+
+                       NameValueCollection fields = new NameValueCollection ();
+                       foreach (XmlNode inputNode in formNode.SelectNodes 
("input"))
+                               fields.Add (inputNode.Attributes["name"].Value,
+                                       inputNode.Attributes["value"].Value);
+
+                       return new FormPostback (targetUrl, fields);
+               }
+       }
+}

Modified: 
trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/NunitWeb.csproj
===================================================================
--- trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/NunitWeb.csproj  
2006-06-22 05:13:15 UTC (rev 61930)
+++ trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/NunitWeb.csproj  
2006-06-22 08:35:08 UTC (rev 61931)
@@ -29,13 +29,14 @@
   </PropertyGroup>
   <ItemGroup>
     <Reference Include="System" />
-    <Reference Include="System.configuration" />
-    <Reference Include="System.Data" />
     <Reference Include="System.Web" />
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
     <Compile Include="BaseInvoker.cs" />
+    <Compile Include="BaseRequest.cs" />
+    <Compile Include="FormPostback.cs" />
+    <Compile Include="FormRequest.cs" />
     <Compile Include="HandlerInvoker.cs" />
     <Compile Include="MyHandler.cs" />
     <Compile Include="BaseWorkerRequest.cs">
@@ -46,7 +47,6 @@
     </Compile>
     <Compile Include="PageDelegates.cs" />
     <Compile Include="PageInvoker.cs" />
-    <Compile Include="SimpleRequest.cs" />
     <Compile Include="StandardUrl.cs" />
     <Compile Include="WebTest.cs">
       <SubType>Code</SubType>
@@ -69,6 +69,12 @@
     <EmbeddedResource Include="Resources\MyPageWithMaster.aspx">
     </EmbeddedResource>
   </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\MainsoftWebTest\HtmlCompare.csproj">
+      <Project>{BF64011B-D7DB-4AB8-8EAB-FE0AA1EE74CD}</Project>
+      <Name>HtmlCompare</Name>
+    </ProjectReference>
+  </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets 
below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
@@ -77,4 +83,4 @@
   <Target Name="AfterBuild">
   </Target>
   -->
-</Project>
+</Project>
\ No newline at end of file

Modified: trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/Test1/Class1.cs
===================================================================
--- trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/Test1/Class1.cs   
2006-06-22 05:13:15 UTC (rev 61930)
+++ trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/Test1/Class1.cs   
2006-06-22 08:35:08 UTC (rev 61931)
@@ -1,10 +1,10 @@
 using System;
 using System.Text;
 using NUnit.Framework;
+using MonoTests.SystemWeb.Framework;
 using System.Web;
 using System.Web.UI;
 using System.Web.UI.WebControls;
-using NunitWeb;
 using System.Drawing;
 using System.Runtime.Serialization;
 using System.IO;
@@ -18,13 +18,14 @@
        {
                public void TearDownFixture ()
                {
-                       NunitWeb.Helper.Unload ();
+                       WebTest.Unload ();
                }
 
                [Test]
                public void RenderSiteMapPath ()
                {
-                       string res = Helper.Instance.RunInPage 
(_RenderSiteMapPath);
+                       PageInvoker pi = PageInvoker.CreateOnLoad 
(_RenderSiteMapPath);
+                       string res = new WebTest (pi).Run ();
                        Console.WriteLine (res);
                        Assert.IsFalse (string.IsNullOrEmpty (res));
                }
@@ -38,7 +39,8 @@
                [Test]
                public void RenderSiteMapPathProp ()
                {
-                       string res = Helper.Instance.RunInPage 
(_RenderSiteMapPathProp);
+                       PageInvoker pi = PageInvoker.CreateOnLoad 
(_RenderSiteMapPathProp);
+                       string res = new WebTest (pi).Run ();
                        Console.WriteLine (res);
                        Assert.IsFalse (string.IsNullOrEmpty (res));
                }
@@ -53,7 +55,10 @@
                [Test]
                public void TestMasterPage ()
                {
-                       string res = Helper.Instance.RunInPageWithMaster 
(_TestMasterPage);
+                       PageInvoker pi = PageInvoker.CreateOnLoad 
(_TestMasterPage);
+                       WebTest t = new WebTest (pi);
+                       t.Request.Url = StandardUrl.PAGE_WITH_MASTER;
+                       string res = t.Run ();
                        Console.WriteLine (res);
                        Assert.IsFalse (string.IsNullOrEmpty (res));
                }
@@ -67,7 +72,7 @@
                [Test]
                public void TestStyle ()
                {
-                       string res = Helper.Instance.RunInPage(_TestStyle);
+                       string res = new WebTest (PageInvoker.CreateOnLoad 
(_TestStyle)).Run ();
                        Console.WriteLine (res);
                        Assert.IsFalse (string.IsNullOrEmpty (res));
                }
@@ -83,7 +88,7 @@
                [Test]
                public void TestDefaultRender ()
                {
-                       string str = Helper.Instance.RunInPage 
(_TestDefaultRender, null);
+                       string str = new WebTest (PageInvoker.CreateOnLoad 
(_TestDefaultRender)).Run ();
                        Assert.IsFalse (string.IsNullOrEmpty (str));
                }
 
@@ -100,11 +105,38 @@
                [Test]
                public void TestSkin ()
                {
-                       NunitWeb.Helper.Instance.CopyResource 
(Assembly.GetExecutingAssembly (), "Test1.Resources.Default.skin", 
"App_Themes/Black/Default.skin");
-                       NunitWeb.Helper.Instance.CopyResource 
(Assembly.GetExecutingAssembly (), "Test1.Resources.MyPageWithTheme.aspx", 
"MyPageWithTheme.aspx");
-                       string res = NunitWeb.Helper.Instance.RunUrl 
("MyPageWithTheme.aspx", null, null);
+                       Assembly SampleAssembly;
+                       // Instantiate a target object.
+                       Int32 Integer1 = new Int32 ();
+                       Type Type1;
+                       // Set the Type instance to the target class type.
+                       Type1 = Integer1.GetType ();
+                       // Instantiate an Assembly class to the assembly 
housing the Integer type.  
+                       SampleAssembly = Assembly.GetAssembly (Integer1.GetType 
());
+                       // Display the physical location of the assembly 
containing the manifest.
+                       Console.WriteLine ("Location=" + 
SampleAssembly.Location);
+
+
+
+                       WebTest.CopyResource (GetType (), 
"Test1.Resources.Default.skin", "App_Themes/Black/Default.skin");
+                       WebTest.CopyResource (GetType (), 
"Test1.Resources.MyPageWithTheme.aspx", "MyPageWithTheme.aspx");
+                       string res = new WebTest ("MyPageWithTheme.aspx").Run 
();
                        Debug.WriteLine (res);                  
                }
 
+               [Test]
+               public void UnloadTest ()
+               {
+                       new WebTest (new PageInvoker (new PageDelegates 
())).Run ();
+                       WebTest.Unload ();
+                       new WebTest (new PageInvoker (new PageDelegates 
())).Run ();
+               }
+
+               [Test]
+               public void PostBack ()
+               {
+                       WebTest.CopyResource (GetType (), 
"Test1.Resources.Postback.aspx", "Postback.aspx");
+                       string res = new WebTest ("Postback.aspx").Run ();
+               }
        }
 }

Modified: trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/Test1/Test1.csproj
===================================================================
--- trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/Test1/Test1.csproj        
2006-06-22 05:13:15 UTC (rev 61930)
+++ trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/Test1/Test1.csproj        
2006-06-22 08:35:08 UTC (rev 61931)
@@ -31,10 +31,13 @@
     <Reference Include="System" />
     <Reference Include="System.Drawing" />
     <Reference Include="System.Web" />
+    <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Class1.cs" />
-    <Compile Include="ThemeTest.cs" />
+    <Compile Include="..\..\..\System.Web.UI.WebControls\FileUploadTest.cs">
+      <Link>FileUploadTest.cs</Link>
+    </Compile>
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\NunitWeb\NunitWeb.csproj">
@@ -70,6 +73,9 @@
       <Link>Resources\Web.sitemap</Link>
     </EmbeddedResource>
   </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Resources\Postback.aspx" />
+  </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets 
below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.

_______________________________________________
Mono-patches maillist  -  Mono-patches@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to