Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<%= AppDomain.CurrentDomain.GetData ("BEGIN_CODE_MARKER") %><asp:HyperLink runat="server" NavigateUrl="<%$RouteUrl:SearchTerm=test%>">Search for 'test'</asp:HyperLink><%= AppDomain.CurrentDomain.GetData ("END_CODE_MARKER") %>
</div>
</form>
</body>
</html>

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}

View File

@@ -0,0 +1,2 @@
<%@ Application Language="C#" CodeFile="Global.asax.cs" Inherits="_Global" %>

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Routing;
public partial class _Global : HttpApplication
{
void Application_Start (object sender, EventArgs e)
{
RouteTable.Routes.MapPageRoute ("SearchRoute", "search/{searchterm}", "~/search.aspx",
true,
new RouteValueDictionary {
{ "intValue", 123 },
{ "boolValue", false },
{ "doubleValue", 1.23 }
},
null, null);
RouteTable.Routes.MapPageRoute ("UserRoute", "users/{username}", "~/users.aspx");
}
}

View File

@@ -0,0 +1,18 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="search.aspx.cs" Inherits="search" %>
<!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></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<%= AppDomain.CurrentDomain.GetData ("BEGIN_CODE_MARKER") %>Search term is: <asp:Label runat="server" ID="label1" /><br />
Search term from expression is: <asp:Label ID="label2" runat="server" Text="<%$RouteValue:SearchTerm%>" /><br />
<pre runat="server" id="testLog" /><%= AppDomain.CurrentDomain.GetData ("END_CODE_MARKER") %>
</div>
</form>
</body>
</html>

View File

@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.Compilation;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class search : System.Web.UI.Page
{
protected void Page_Load (object sender, EventArgs e)
{
string searchterm = Page.RouteData.Values ["searchterm"] as string;
label1.Text = searchterm;
var sb = new StringBuilder ();
RunTest (sb, "Missing key", "SearchTermd", typeof (Label), "Text");
RunTest (sb, "Missing property", "SearchTerm", typeof (Label), "NoSuchPropertyHere");
RunTest (sb, "No converter", "SearchTerm", typeof (Image), "Font");
RunTest (sb, "Valid conversion to target", "SearchTerm", typeof (Image), "Enabled");
RunTest (sb, "Invalid conversion to target", "SearchTerm", typeof (HotSpot), "TabIndex");
RunTest (sb, "Complex type converter", "SearchTerm", typeof (Style), "BackColor");
RunTest (sb, "Null controlType", "SearchTerm", null, "Text");
RunTest (sb, "Null propertyName", "SearchTerm", typeof (Label), null);
RunTest (sb, "Empty propertyName", "SearchTerm", typeof (Label), String.Empty);
RunTest (sb, "Non-string value", "intValue", typeof (Label), "Text");
RunTest (sb, "Non-string value", "boolValue", typeof (Label), "Text");
RunTest (sb, "Non-string value", "doubleValue", typeof (Label), "Text");
testLog.InnerText = sb.ToString ();
}
void RunTest (StringBuilder sb, string title, string key, Type controlType, string propertyName)
{
sb.AppendFormat (".: {0} (key: '{1}')\n", title, key);
try {
object val = RouteValueExpressionBuilder.GetRouteValue (this, key, controlType, propertyName);
if (val != null)
sb.AppendFormat ("\tReturned value of type '{0}': {1}\n", val.GetType (), val.ToString ());
else
sb.AppendFormat ("\tReturned null.\n");
} catch (Exception ex) {
sb.AppendFormat ("\tException '{0}' caught\n", ex.GetType ());
}
}
}

View File

@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
</configuration>