Imported Upstream version 5.10.0.47

Former-commit-id: d0813289fa2d35e1f8ed77530acb4fb1df441bc0
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-01-24 17:04:36 +00:00
parent 88ff76fe28
commit e46a49ecf1
5927 changed files with 226314 additions and 129848 deletions

View File

@ -1,4 +1,3 @@
System.Web.Routing/AssertExtensions.cs
System.Web.Routing/FakeHttpWorkerRequest.cs
System.Web.Routing/HttpMethodConstraintTest.cs
System.Web.Routing/KnownResponseHeader.cs

View File

@ -1,76 +0,0 @@
//
// AssertExtensions.cs
//
// Author:
// Marek Habersack <mhabersack@novell.com>
//
// Copyright (C) 2009 Novell Inc. http://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.
//
using System;
using System.Web;
using System.Web.Routing;
using NUnit.Framework;
namespace MonoTests.System.Web.Routing
{
public delegate void AssertThrowsDelegate ();
public static class AssertExtensions
{
public static void Throws <EX> (AssertThrowsDelegate code)
{
Throws (typeof (EX), code);
}
public static void Throws <EX> (AssertThrowsDelegate code, string message)
{
Throws (typeof (EX), code, message);
}
public static void Throws (Type exceptionType, AssertThrowsDelegate code)
{
Throws (exceptionType, code, String.Empty);
}
public static void Throws (Type exceptionType, AssertThrowsDelegate code, string message)
{
if (code == null)
throw new ArgumentNullException ("code");
if (exceptionType == null)
throw new ArgumentNullException ("exceptionType");
try {
code ();
} catch (Exception ex) {
if (ex.GetType () != exceptionType)
Assert.Fail (message + " (got exception of type '" + ex.GetType () + "')");
// good!
return;
}
Assert.Fail (message);
}
}
}

View File

@ -53,12 +53,12 @@ namespace MonoTests.System.Web.Routing
{
RequestContext rc;
AssertExtensions.Throws<ArgumentNullException> (() => {
Assert.Throws<ArgumentNullException> (() => {
rc = new RequestContext (null, new RouteData ());
}, "#A1");
var ctx = new HttpContextWrapper (new HttpContext (new HttpRequest ("filename", "http://localhost/filename", String.Empty), new HttpResponse (new StringWriter ())));
AssertExtensions.Throws<ArgumentNullException> (() => {
Assert.Throws<ArgumentNullException> (() => {
rc = new RequestContext (ctx, null);
}, "#A2");
}

View File

@ -644,7 +644,7 @@ namespace MonoTests.System.Web.Routing
{
var c = new RouteCollection ();
AssertExtensions.Throws<ArgumentNullException> (() => {
Assert.Throws<ArgumentNullException> (() => {
c.Ignore (null);
}, "#A1");
@ -666,7 +666,7 @@ namespace MonoTests.System.Web.Routing
{
var c = new RouteCollection ();
AssertExtensions.Throws<ArgumentNullException> (() => {
Assert.Throws<ArgumentNullException> (() => {
c.Ignore (null, new { allaspx = @".*\.aspx(/.*)?" });
}, "#A1");
@ -686,7 +686,7 @@ namespace MonoTests.System.Web.Routing
c = new RouteCollection ();
c.Ignore ("{*allaspx}", "something invalid");
AssertExtensions.Throws<InvalidOperationException> (() => {
Assert.Throws<InvalidOperationException> (() => {
rd = c.GetRouteData (hc);
}, "#A2");
}
@ -706,7 +706,7 @@ namespace MonoTests.System.Web.Routing
Assert.AreEqual (typeof (PageRouteHandler), rd.RouteHandler.GetType (), "#A1-3");
c = new RouteCollection ();
AssertExtensions.Throws<ArgumentNullException> (() => {
Assert.Throws<ArgumentNullException> (() => {
c.MapPageRoute ("RouteName", null, "~/some-url");
}, "#A2");
@ -718,7 +718,7 @@ namespace MonoTests.System.Web.Routing
c = new RouteCollection ();
// thrown by PageRouteHandler's constructor
AssertExtensions.Throws<ArgumentException> (() => {
Assert.Throws<ArgumentException> (() => {
c.MapPageRoute ("RouteName", "~/some-url", null);
}, "#A3");
}
@ -739,7 +739,7 @@ namespace MonoTests.System.Web.Routing
Assert.IsTrue (((PageRouteHandler) rd.RouteHandler).CheckPhysicalUrlAccess, "#A1-4");
c = new RouteCollection ();
AssertExtensions.Throws<ArgumentNullException> (() => {
Assert.Throws<ArgumentNullException> (() => {
c.MapPageRoute ("RouteName", null, "~/some-url", true);
}, "#A2");
@ -751,7 +751,7 @@ namespace MonoTests.System.Web.Routing
c = new RouteCollection ();
// thrown by PageRouteHandler's constructor
AssertExtensions.Throws<ArgumentException> (() => {
Assert.Throws<ArgumentException> (() => {
c.MapPageRoute ("RouteName", "~/some-url", null, true);
}, "#A3");
@ -781,7 +781,7 @@ namespace MonoTests.System.Web.Routing
Assert.IsTrue (((PageRouteHandler) rd.RouteHandler).CheckPhysicalUrlAccess, "#A1-4");
c = new RouteCollection ();
AssertExtensions.Throws<ArgumentNullException> (() => {
Assert.Throws<ArgumentNullException> (() => {
c.MapPageRoute ("RouteName", null, "~/some-url", true, defaults);
}, "#A2");
@ -793,7 +793,7 @@ namespace MonoTests.System.Web.Routing
c = new RouteCollection ();
// thrown by PageRouteHandler's constructor
AssertExtensions.Throws<ArgumentException> (() => {
Assert.Throws<ArgumentException> (() => {
c.MapPageRoute ("RouteName", "~/some-url", null, true, defaults);
}, "#A3");
@ -832,7 +832,7 @@ namespace MonoTests.System.Web.Routing
Assert.IsTrue (((PageRouteHandler) rd.RouteHandler).CheckPhysicalUrlAccess, "#A1-4");
c = new RouteCollection ();
AssertExtensions.Throws<ArgumentNullException> (() => {
Assert.Throws<ArgumentNullException> (() => {
c.MapPageRoute ("RouteName", null, "~/some-url", true, defaults, constraints);
}, "#A2");
@ -844,7 +844,7 @@ namespace MonoTests.System.Web.Routing
c = new RouteCollection ();
// thrown by PageRouteHandler's constructor
AssertExtensions.Throws<ArgumentException> (() => {
Assert.Throws<ArgumentException> (() => {
c.MapPageRoute ("RouteName", "~/some-url", null, true, defaults, constraints);
}, "#A3");
@ -884,7 +884,7 @@ namespace MonoTests.System.Web.Routing
Assert.IsTrue (((PageRouteHandler) rd.RouteHandler).CheckPhysicalUrlAccess, "#A1-4");
c = new RouteCollection ();
AssertExtensions.Throws<ArgumentNullException> (() => {
Assert.Throws<ArgumentNullException> (() => {
c.MapPageRoute ("RouteName", null, "~/some-url", true, defaults, constraints, dataTokens);
}, "#A2");
@ -896,7 +896,7 @@ namespace MonoTests.System.Web.Routing
c = new RouteCollection ();
// thrown by PageRouteHandler's constructor
AssertExtensions.Throws<ArgumentException> (() => {
Assert.Throws<ArgumentException> (() => {
c.MapPageRoute ("RouteName", "~/some-url", null, true, defaults, constraints, dataTokens);
}, "#A3");

View File

@ -113,7 +113,7 @@ namespace MonoTests.System.Web.Routing
Route r;
foreach (TestUrl tu in __invalidUrls) {
AssertExtensions.Throws (tu.ExpectedExceptionType, () => r = new Route (tu.Url, null), tu.Label);
Assert.Throws (tu.ExpectedExceptionType, () => r = new Route (tu.Url, null), tu.Label);
}
}
@ -1763,18 +1763,18 @@ namespace MonoTests.System.Web.Routing
Assert.IsFalse (route.DoProcessConstraint (null, "regex", "parameter", new RouteValueDictionary (), RouteDirection.IncomingRequest), "#1");
// constraint is null
AssertExtensions.Throws <InvalidOperationException> (
Assert.Throws <InvalidOperationException> (
() => route.DoProcessConstraint (null, null, "parameter", new RouteValueDictionary (), RouteDirection.IncomingRequest),
"#2"
);
// constraint is neither a string or an IRouteConstraint instance
AssertExtensions.Throws <InvalidOperationException> (
Assert.Throws <InvalidOperationException> (
() => route.DoProcessConstraint (null, 1, "parameter", new RouteValueDictionary (), RouteDirection.IncomingRequest),
"#3"
);
AssertExtensions.Throws <ArgumentNullException> (
Assert.Throws <ArgumentNullException> (
() => route.DoProcessConstraint (null, "regex", null, new RouteValueDictionary (), RouteDirection.IncomingRequest),
"#4"
);
@ -1782,7 +1782,7 @@ namespace MonoTests.System.Web.Routing
Assert.IsFalse (route.DoProcessConstraint (null, "regex", String.Empty, new RouteValueDictionary (), RouteDirection.IncomingRequest), "#5");
// This is a .NET programming error, so not sure if we should test for this...
AssertExtensions.Throws <NullReferenceException> (
Assert.Throws <NullReferenceException> (
() => route.DoProcessConstraint (null, "regex", "parameter", null, RouteDirection.IncomingRequest),
"#6"
);