You've already forked linux-packaging-mono
Imported Upstream version 4.3.2.467
Former-commit-id: 9c2cb47f45fa221e661ab616387c9cda183f283d
This commit is contained in:
@@ -81,11 +81,7 @@ namespace MonoTests.Common
|
||||
|
||||
public override string GetRawUrl ()
|
||||
{
|
||||
#if NET_4_0
|
||||
return "/GetRawUrl";
|
||||
#else
|
||||
return "GetRawUrl";
|
||||
#endif
|
||||
}
|
||||
|
||||
public override string GetHttpVerbName ()
|
||||
|
@@ -40,7 +40,6 @@ namespace MonoTests.System.Web.Routing
|
||||
[TestFixture]
|
||||
public class RequestContextTest
|
||||
{
|
||||
#if NET_4_0
|
||||
[Test]
|
||||
public void DefaultConstructor ()
|
||||
{
|
||||
@@ -49,7 +48,6 @@ namespace MonoTests.System.Web.Routing
|
||||
Assert.AreEqual (null, rc.HttpContext, "#A1");
|
||||
Assert.AreEqual (null, rc.RouteData, "#A2");
|
||||
}
|
||||
#endif
|
||||
[Test]
|
||||
public void Constructor_HttpContextBase_RouteData ()
|
||||
{
|
||||
@@ -72,14 +70,12 @@ namespace MonoTests.System.Web.Routing
|
||||
var rc = new RequestContext (ctx, new RouteData ());
|
||||
|
||||
Assert.AreSame (ctx, rc.HttpContext, "#A1");
|
||||
#if NET_4_0
|
||||
ctx = new HttpContextWrapper (new HttpContext (new HttpRequest ("filename", "http://localhost/filename", String.Empty), new HttpResponse (new StringWriter ())));
|
||||
rc.HttpContext = ctx;
|
||||
Assert.AreSame (ctx, rc.HttpContext, "#A2");
|
||||
|
||||
rc.HttpContext = null;
|
||||
Assert.IsNull (rc.HttpContext, "#A3");
|
||||
#endif
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -90,14 +86,12 @@ namespace MonoTests.System.Web.Routing
|
||||
var rc = new RequestContext (ctx, rd);
|
||||
|
||||
Assert.AreSame (rd, rc.RouteData, "#A1");
|
||||
#if NET_4_0
|
||||
rd = new RouteData ();
|
||||
rc.RouteData = rd;
|
||||
Assert.AreSame (rd, rc.RouteData, "#A2");
|
||||
|
||||
rc.RouteData = null;
|
||||
Assert.IsNull (rc.RouteData, "#A3");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -131,17 +131,8 @@ namespace MonoTests.System.Web.Routing
|
||||
{
|
||||
var rd = new RouteCollection () { RouteExistingFiles = true }.GetRouteData (new HttpContextStub2 (null, null, null));
|
||||
Assert.IsNull (rd, "#A1");
|
||||
#if NET_4_0
|
||||
rd = new RouteCollection ().GetRouteData (new HttpContextStub2 (null, null, null));
|
||||
Assert.IsNull (rd, "#A2");
|
||||
#else
|
||||
try {
|
||||
new RouteCollection ().GetRouteData (new HttpContextStub2 (null, null, null));
|
||||
Assert.Fail ("#A3");
|
||||
} catch (NotImplementedException) {
|
||||
// it should fail due to the NIE on AppRelativeCurrentExecutionFilePath.
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -648,7 +639,6 @@ namespace MonoTests.System.Web.Routing
|
||||
|
||||
Assert.IsNotNull (rd, "#A1");
|
||||
}
|
||||
#if NET_4_0
|
||||
[Test]
|
||||
public void Ignore_String ()
|
||||
{
|
||||
@@ -926,6 +916,15 @@ namespace MonoTests.System.Web.Routing
|
||||
Assert.AreEqual (typeof (PageRouteHandler), rd.RouteHandler.GetType (), "#A4-3");
|
||||
Assert.IsFalse (((PageRouteHandler) rd.RouteHandler).CheckPhysicalUrlAccess, "#A4-4");
|
||||
}
|
||||
#endif
|
||||
|
||||
[Test] // https://bugzilla.xamarin.com/show_bug.cgi?id=13909
|
||||
public void MapPageRoute_Bug13909 ()
|
||||
{
|
||||
var c = new RouteCollection ();
|
||||
|
||||
c.MapPageRoute("test", "test", "~/test.aspx");
|
||||
c.Clear();
|
||||
c.MapPageRoute("test", "test", "~/test.aspx");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -627,7 +627,6 @@ namespace MonoTests.System.Web.Routing
|
||||
var hc = new HttpContextStub ("~/xyzxyzxyzxyzblah", String.Empty);
|
||||
var rd = r.GetRouteData (hc);
|
||||
|
||||
#if NET_4_0 || !DOTNET
|
||||
// When running on Mono this test succeeds - it was a bug in .NET routing for 3.5 which
|
||||
// we don't reproduce anymore.
|
||||
Assert.IsNotNull (rd, "#1");
|
||||
@@ -637,9 +636,6 @@ namespace MonoTests.System.Web.Routing
|
||||
Assert.AreEqual ("xyz", rd.Values ["foo"], "#4-1");
|
||||
Assert.AreEqual ("xyz", rd.Values ["bar"], "#4-2");
|
||||
Assert.AreEqual ("blah", rd.Values ["baz"], "#4-3");
|
||||
#else
|
||||
Assert.IsNull (rd, "#1");
|
||||
#endif
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -738,7 +734,6 @@ namespace MonoTests.System.Web.Routing
|
||||
var hc = new HttpContextStub ("~/xyzxyzxyzxyzxyzxyzblah", String.Empty);
|
||||
var rd = r.GetRouteData (hc);
|
||||
|
||||
#if NET_4_0 || !DOTNET
|
||||
// When running on Mono this test succeeds - it was a bug in .NET routing for 3.5 which
|
||||
// we don't reproduce anymore.
|
||||
Assert.IsNotNull (rd, "#1");
|
||||
@@ -748,9 +743,6 @@ namespace MonoTests.System.Web.Routing
|
||||
Assert.AreEqual ("xyzxyzxyz", rd.Values ["foo"], "#4-1");
|
||||
Assert.AreEqual ("xyz", rd.Values ["bar"], "#4-2");
|
||||
Assert.AreEqual ("blah", rd.Values ["baz"], "#4-3");
|
||||
#else
|
||||
Assert.IsNull (rd, "#1");
|
||||
#endif
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -776,7 +768,6 @@ namespace MonoTests.System.Web.Routing
|
||||
var hc = new HttpContextStub ("~/xyzxyzxyzdabxyzblah", String.Empty);
|
||||
var rd = r.GetRouteData (hc);
|
||||
|
||||
#if NET_4_0 || !DOTNET
|
||||
// When running on Mono this test succeeds - it was a bug in .NET routing for 3.5 which
|
||||
// we don't reproduce anymore.
|
||||
Assert.IsNotNull (rd, "#1");
|
||||
@@ -786,9 +777,6 @@ namespace MonoTests.System.Web.Routing
|
||||
Assert.AreEqual ("xyz", rd.Values ["foo"], "#4-1");
|
||||
Assert.AreEqual ("dab", rd.Values ["bar"], "#4-2");
|
||||
Assert.AreEqual ("blah", rd.Values ["baz"], "#4-3");
|
||||
#else
|
||||
Assert.IsNull (rd, "#1");
|
||||
#endif
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -798,7 +786,6 @@ namespace MonoTests.System.Web.Routing
|
||||
var hc = new HttpContextStub ("~/xyzxyzxyzxyzxyz", String.Empty);
|
||||
var rd = r.GetRouteData (hc);
|
||||
|
||||
#if NET_4_0 || !DOTNET
|
||||
// When running on Mono this test succeeds - it was a bug in .NET routing for 3.5 which
|
||||
// we don't reproduce anymore.
|
||||
Assert.IsNotNull (rd, "#1");
|
||||
@@ -808,9 +795,6 @@ namespace MonoTests.System.Web.Routing
|
||||
Assert.AreEqual ("xyz", rd.Values ["foo"], "#4-1");
|
||||
Assert.AreEqual ("xyz", rd.Values ["bar"], "#4-2");
|
||||
Assert.AreEqual ("xyz", rd.Values ["baz"], "#4-3");
|
||||
#else
|
||||
Assert.IsNull (rd, "#1");
|
||||
#endif
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -1375,7 +1359,6 @@ namespace MonoTests.System.Web.Routing
|
||||
|
||||
}
|
||||
|
||||
#if NET_4_0
|
||||
[Test (Description="Bug #671753")]
|
||||
public void GetVirtualPath15 ()
|
||||
{
|
||||
@@ -1396,7 +1379,6 @@ namespace MonoTests.System.Web.Routing
|
||||
Assert.IsNotNull (RouteTable.Routes.GetVirtualPath (rc, "TestRoute", new RouteValueDictionary ()), "#A3");
|
||||
Assert.IsNotNull (RouteTable.Routes.GetVirtualPath (rc, "TestRoute", null), "#A4");
|
||||
}
|
||||
#endif
|
||||
|
||||
[Test (Description="Xamarin Bug #9116")]
|
||||
public void GetVirtualPath16 ()
|
||||
|
@@ -248,7 +248,6 @@ namespace MonoTests.System.Web.Routing
|
||||
|
||||
public string RewrittenPath { get; set; }
|
||||
}
|
||||
#if NET_4_0
|
||||
class FakeHttpRequestWrapper : HttpRequestWrapper
|
||||
{
|
||||
string requestUrl;
|
||||
@@ -320,7 +319,6 @@ namespace MonoTests.System.Web.Routing
|
||||
wrapper = new FakeHttpRequestWrapper (requestUrl, path, appPath);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
public class MyStopRoutingHandler : StopRoutingHandler
|
||||
{
|
||||
public IHttpHandler CallGetHttpHandler (RequestContext rc)
|
||||
|
@@ -85,17 +85,6 @@ namespace MonoTests.System.Web.Routing
|
||||
m.PostResolveRequestCache (new HttpContextStub2 ("~/foo/bar", null));
|
||||
}
|
||||
|
||||
#if !NET_4_0
|
||||
[Test]
|
||||
[ExpectedException (typeof (InvalidOperationException))]
|
||||
public void PostResolveRequestCacheNullHttpHandler ()
|
||||
{
|
||||
var m = new UrlRoutingModule ();
|
||||
RouteTable.Routes.Add (new MyRoute ("foo/bar", new NullRouteHandler ()));
|
||||
|
||||
m.PostResolveRequestCache (new HttpContextStub2 ("~/foo/bar", null));
|
||||
}
|
||||
#endif
|
||||
[Test]
|
||||
[ExpectedException (typeof (NotImplementedException))]
|
||||
public void PostResolveRequestCacheNoPath ()
|
||||
@@ -106,53 +95,15 @@ namespace MonoTests.System.Web.Routing
|
||||
m.PostResolveRequestCache (new HttpContextStub2 ("~/foo/bar", null));
|
||||
}
|
||||
|
||||
#if !NET_4_0
|
||||
[Test]
|
||||
public void PostResolveRequestCacheCallRewritePath ()
|
||||
{
|
||||
var m = new UrlRoutingModule ();
|
||||
RouteTable.Routes.Add (new MyRoute ("{foo}/{bar}", new MyRouteHandler ()));
|
||||
var hc = new HttpContextStub2 ("~/x/y", "z");
|
||||
try {
|
||||
m.PostResolveRequestCache (hc);
|
||||
Assert.Fail ("#1");
|
||||
} catch (ApplicationException ex) {
|
||||
Assert.AreEqual ("~/UrlRouting.axd", ex.Message, "#2");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PostResolveRequestCacheModifiedPath ()
|
||||
{
|
||||
var m = new UrlRoutingModule ();
|
||||
RouteTable.Routes.Add (new MyRoute ("{foo}/{bar}", new MyRouteHandler ()));
|
||||
var hc = new HttpContextStub2 ("~/x/y", "z", "apppath");
|
||||
hc.SetResponse (new HttpResponseStub (2));
|
||||
try {
|
||||
m.PostResolveRequestCache (hc);
|
||||
Assert.Fail ("#1");
|
||||
} catch (ApplicationException ex) {
|
||||
Assert.AreEqual ("~/UrlRouting.axd", ex.Message, "#2");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
[Test]
|
||||
public void PostResolveRequestCache ()
|
||||
{
|
||||
var m = new UrlRoutingModule ();
|
||||
RouteTable.Routes.Add (new MyRoute ("{foo}/{bar}", new MyRouteHandler ()));
|
||||
#if NET_4_0
|
||||
var hc = new HttpContextStub4 ("~/x/y", "z", "apppath", false);
|
||||
#else
|
||||
var hc = new HttpContextStub3 ("~/x/y", "z", "apppath", false);
|
||||
#endif
|
||||
hc.SetResponse (new HttpResponseStub (2));
|
||||
m.PostResolveRequestCache (hc);
|
||||
#if NET_4_0
|
||||
Assert.AreEqual (null, hc.RewrittenPath, "#1");
|
||||
#else
|
||||
Assert.AreEqual ("~/UrlRouting.axd", hc.RewrittenPath, "#1");
|
||||
#endif
|
||||
// it internally stores the handler
|
||||
}
|
||||
|
||||
@@ -203,49 +154,23 @@ namespace MonoTests.System.Web.Routing
|
||||
{
|
||||
var m = new UrlRoutingModule ();
|
||||
RouteTable.Routes.Add (new MyRoute ("{foo}/{bar}", new MyRouteHandler ()));
|
||||
#if NET_4_0
|
||||
var hc = new HttpContextStub4 ("~/x/y", "z", "apppath", true);
|
||||
#else
|
||||
var hc = new HttpContextStub3 ("~/x/y", "z", "apppath", true);
|
||||
#endif
|
||||
hc.HttpHandler = new MyHttpHandler ();
|
||||
hc.SetResponse (new HttpResponseStub (2));
|
||||
m.PostResolveRequestCache (hc);
|
||||
#if NET_4_0
|
||||
Assert.AreEqual (null, hc.RewrittenPath, "#1");
|
||||
#else
|
||||
Assert.AreEqual ("~/UrlRouting.axd", hc.RewrittenPath, "#1");
|
||||
#endif
|
||||
// It tries to set Handler and causes NIE
|
||||
m.PostMapRequestHandler (hc);
|
||||
}
|
||||
|
||||
[Test]
|
||||
#if !NET_4_0
|
||||
[ExpectedException (typeof (ApplicationException))]
|
||||
#endif
|
||||
public void Pipeline3 ()
|
||||
{
|
||||
var m = new UrlRoutingModule ();
|
||||
RouteTable.Routes.Add (new MyRoute ("{foo}/{bar}", new MyRouteHandler ()));
|
||||
#if NET_4_0
|
||||
var hc = new HttpContextStub5 ("~/x/y", String.Empty, "apppath");
|
||||
#else
|
||||
var hc = new HttpContextStub2 ("~/x/y", String.Empty, "apppath");
|
||||
#endif
|
||||
hc.SetResponse (new HttpResponseStub (2));
|
||||
#if NET_4_0
|
||||
Assert.IsNull (m.RouteCollection.GetRouteData (hc), "#0");
|
||||
#else
|
||||
Assert.IsNotNull (m.RouteCollection.GetRouteData (hc), "#0");
|
||||
m.PostResolveRequestCache (hc);
|
||||
try {
|
||||
m.PostMapRequestHandler (hc);
|
||||
Assert.Fail ("#1");
|
||||
} catch (ApplicationException ex) {
|
||||
Assert.AreEqual ("~/UrlRouting.axd", ex.Message, "#2");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user