From 39f7420c4d34c73bc7c58d8bcd8a382af4e71492 Mon Sep 17 00:00:00 2001 From: Kiran Challa Date: Fri, 13 Apr 2018 10:37:11 -0700 Subject: [PATCH] Fixed routing test --- test/Microsoft.AspNetCore.Routing.Tests/RouteTest.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.AspNetCore.Routing.Tests/RouteTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/RouteTest.cs index e6ced54ff0..a09935fcd5 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/RouteTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/RouteTest.cs @@ -653,6 +653,8 @@ namespace Microsoft.AspNetCore.Routing public void GetVirtualPath_AlwaysUsesDefaultUrlEncoder() { // Arrange + var nameRouteValue = "name with %special #characters Jörn"; + var expected = "/Home/Index?name=" + UrlEncoder.Default.Encode(nameRouteValue); var services = new ServiceCollection(); services.AddSingleton(NullLoggerFactory.Instance); services.AddSingleton(); @@ -666,7 +668,7 @@ namespace Microsoft.AspNetCore.Routing var context = new VirtualPathContext( httpContext, - values: new RouteValueDictionary(new { name = "name with %special #characters Jörn" }), + values: new RouteValueDictionary(new { name = nameRouteValue }), ambientValues: new RouteValueDictionary(new { controller = "Home", action = "Index" })); var route = CreateRoute("{controller}/{action}"); @@ -675,7 +677,7 @@ namespace Microsoft.AspNetCore.Routing var pathData = route.GetVirtualPath(context); // Assert - Assert.Equal("/Home/Index?name=name%20with%20%25special%20%23characters%20J%C3%B6rn", pathData.VirtualPath); + Assert.Equal(expected, pathData.VirtualPath); Assert.Same(route, pathData.Router); Assert.Empty(pathData.DataTokens); }