Standalone test for a web hosting bug
authorAndrew Skiba <andrews@mono-cvs.ximian.com>
Mon, 5 Jun 2006 11:22:13 +0000 (11:22 -0000)
committerAndrew Skiba <andrews@mono-cvs.ximian.com>
Mon, 5 Jun 2006 11:22:13 +0000 (11:22 -0000)
svn path=/trunk/mcs/; revision=61452

mcs/class/System.Web/Test/standalone/hosting/test1/Class1.cs [new file with mode: 0644]
mcs/class/System.Web/Test/standalone/hosting/test1/Makefile [new file with mode: 0644]
mcs/class/System.Web/Test/standalone/hosting/test1/Program1.cs [new file with mode: 0644]

diff --git a/mcs/class/System.Web/Test/standalone/hosting/test1/Class1.cs b/mcs/class/System.Web/Test/standalone/hosting/test1/Class1.cs
new file mode 100644 (file)
index 0000000..de0dcbd
--- /dev/null
@@ -0,0 +1,15 @@
+using System;
+using System.Web;
+using System.Web.Hosting;
+
+namespace ClassLibrary1
+{
+       public class Class1:MarshalByRefObject
+       {
+               public void Run ()
+               {
+                       HttpRuntime.ProcessRequest (new SimpleWorkerRequest ("PageWithMaster.aspx", "", Console.Out));
+               }
+       }
+}
+
diff --git a/mcs/class/System.Web/Test/standalone/hosting/test1/Makefile b/mcs/class/System.Web/Test/standalone/hosting/test1/Makefile
new file mode 100644 (file)
index 0000000..7e570c5
--- /dev/null
@@ -0,0 +1,16 @@
+all: Program1.exe
+
+run-test: Program1.exe
+       mono Program1.exe
+
+dist-clean: clean
+       rm -rf bin My.master PageWithMaster.aspx
+
+clean:
+       rm -f Program1.exe Class1.dll
+
+Program1.exe: Program1.cs Class1.dll
+       gmcs -out:$@ -r:System.Web -r:Class1 Program1.cs
+
+Class1.dll: Class1.cs
+       gmcs -out:$@ -r:System.Web Class1.cs -target:library
diff --git a/mcs/class/System.Web/Test/standalone/hosting/test1/Program1.cs b/mcs/class/System.Web/Test/standalone/hosting/test1/Program1.cs
new file mode 100644 (file)
index 0000000..a467316
--- /dev/null
@@ -0,0 +1,46 @@
+using System;
+using System.Web.UI;
+using System.Web;
+using System.Web.Hosting;
+using ClassLibrary1;
+using System.IO;
+
+namespace ConsoleApplication1
+{
+
+       class Program
+       {
+               static void Main (string[] args)
+               {
+                       string master = @"<%@   Master Language=""C#"" %>
+<!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"" xml:lang=""en"" >
+<head id=""Head1"" runat=""server"">
+<title></title>
+</head>
+<body>
+<asp:contentplaceholder id=""Main"" runat=""server"" />
+</body>
+</html>";
+                       string page = @"<%@ Page MasterPageFile=""My.master"" %>
+<asp:content id=""Content1"" contentplaceholderid=""Main"" runat=""server"">
+<form id=""form1"" runat=""server"" />
+</asp:content>";
+                       string physDir = Directory.GetCurrentDirectory ();
+                       if (!Directory.Exists ("bin"))
+                               Directory.CreateDirectory ("bin");
+                       string masterPath = "My.master";
+                       if (!File.Exists (masterPath))
+                               using (StreamWriter sw = new StreamWriter (masterPath))
+                                       sw.Write (master);
+                       string pagePath = "PageWithMaster.aspx";
+                       if (!File.Exists (pagePath))
+                               using (StreamWriter sw = new StreamWriter (pagePath))
+                                       sw.Write (page);
+                       Class1 c1 = (Class1) ApplicationHost.CreateApplicationHost (
+                                       typeof (Class1), "/", physDir);
+                       c1.Run ();
+               }
+       }
+}
+