2009-06-04 Marek Habersack <mhabersack@novell.com>
authorMarek Habersack <grendel@twistedcode.net>
Thu, 4 Jun 2009 15:31:02 +0000 (15:31 -0000)
committerMarek Habersack <grendel@twistedcode.net>
Thu, 4 Jun 2009 15:31:02 +0000 (15:31 -0000)
* RouteValueDictionaryExtensions.cs: if both values are strings in
Has (string, value), compare them case-insensitively. Fixes bug
#502555

2009-06-04  Marek Habersack  <mhabersack@novell.com>

* RouteCollectionTest.cs: added two more test cases to the bug
#502555 test. They check whether url generation matches defaults
case-insensitively.

svn path=/trunk/mcs/; revision=135438

mcs/class/System.Web.Routing/System.Web.Routing/ChangeLog
mcs/class/System.Web.Routing/System.Web.Routing/RouteValueDictionaryExtensions.cs
mcs/class/System.Web.Routing/Test/System.Web.Routing/ChangeLog
mcs/class/System.Web.Routing/Test/System.Web.Routing/RouteCollectionTest.cs

index 211ec3c0723b5d5bd9d31b3443ef81ce8bd8081e..6f20c67c13d3eefe986f2bbed6e58457d5d18da2 100644 (file)
@@ -1,3 +1,9 @@
+2009-06-04  Marek Habersack  <mhabersack@novell.com>
+
+       * RouteValueDictionaryExtensions.cs: if both values are strings in
+       Has (string, value), compare them case-insensitively. Fixes bug
+       #502555
+
 2009-05-27  Marek Habersack  <mhabersack@novell.com>
 
        * PatternParser.cs: if Match is passed an empty path, do not
index b6452497cd80ec6948eea8f778132a33ff772d45..1a1126b910b4e514bb2e6bca4074b82af9ec09f6 100644 (file)
@@ -49,9 +49,19 @@ namespace System.Web.Routing
                                return false;
 
                        object entryValue;
-                       if (dict.TryGetValue (key, out entryValue))
+                       if (dict.TryGetValue (key, out entryValue)) {
+                               if (value is string) {
+                                       if (!(entryValue is string))
+                                               return false;
+                                       
+                                       string s1 = value as string;
+                                       string s2 = entryValue as string;
+                                       return String.Compare (s1, s2, StringComparison.OrdinalIgnoreCase) == 0;
+                               }
+                               
                                return entryValue == null ? value == null : entryValue.Equals (value);
-
+                       }
+                       
                        return false;
                }
 
index 8affe4360b0bdd0e2864a46a45d945221a34a43c..53548f2bb166e28a22c259f2eea90a943ff8a115 100644 (file)
@@ -1,3 +1,9 @@
+2009-06-04  Marek Habersack  <mhabersack@novell.com>
+
+       * RouteCollectionTest.cs: added two more test cases to the bug
+       #502555 test. They check whether url generation matches defaults
+       case-insensitively.
+
 2009-05-27  Marek Habersack  <mhabersack@novell.com>
 
        * RouteCollectionTest.cs: added a test for routes from
index bb792ebfc797916e27f75e3fdac3ce0e536dfb73..50dfd88696a4061dc64452edf93c52e24423eb25 100644 (file)
@@ -292,6 +292,22 @@ namespace MonoTests.System.Web.Routing
                        Assert.IsNotNull (vpd, "#C1");
                        Assert.AreEqual ("/Account/LogOn_modified", vpd.VirtualPath, "#C2");
                        Assert.AreEqual (0, vpd.DataTokens.Count, "#C3");
+
+                       hc = new HttpContextStub2 ("~/", String.Empty, String.Empty);
+                       hc.SetResponse (new HttpResponseStub (3));
+                       rd = c.GetRouteData (hc);
+                       vpd = c.GetVirtualPath (new RequestContext (hc, rd), new RouteValueDictionary (new { controller = "home" }) );
+                       Assert.IsNotNull (vpd, "#D1");
+                       Assert.AreEqual ("/", vpd.VirtualPath, "#D2");
+                       Assert.AreEqual (0, vpd.DataTokens.Count, "#D3");
+
+                       hc = new HttpContextStub2 ("~/", String.Empty, String.Empty);
+                       hc.SetResponse (new HttpResponseStub (3));
+                       rd = c.GetRouteData (hc);
+                       vpd = c.GetVirtualPath (new RequestContext (hc, rd), new RouteValueDictionary (new { controller = "Home" }) );
+                       Assert.IsNotNull (vpd, "#E1");
+                       Assert.AreEqual ("/", vpd.VirtualPath, "#E2");
+                       Assert.AreEqual (0, vpd.DataTokens.Count, "#E3");
                }
 
                [Test]