From 29a5cb8aa9bfda4883545f6f1b7c00e52d9b4b55 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Fri, 23 Jan 2015 15:20:51 -0800 Subject: [PATCH] Change the namespace for the MapRoute extension --- .../RouteBuilderExtensions.cs | 3 +- .../Template/TemplateRouteTest.cs | 33 ++++++++++--------- .../TemplateParserDefaultValuesTests.cs | 5 +-- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/Microsoft.AspNet.Routing/RouteBuilderExtensions.cs b/src/Microsoft.AspNet.Routing/RouteBuilderExtensions.cs index a45497c6b8..400edd386d 100644 --- a/src/Microsoft.AspNet.Routing/RouteBuilderExtensions.cs +++ b/src/Microsoft.AspNet.Routing/RouteBuilderExtensions.cs @@ -3,10 +3,11 @@ using System; using System.Collections.Generic; +using Microsoft.AspNet.Routing; using Microsoft.AspNet.Routing.Template; using Microsoft.Framework.DependencyInjection; -namespace Microsoft.AspNet.Routing +namespace Microsoft.AspNet.Builder { public static class RouteBuilderExtensions { diff --git a/test/Microsoft.AspNet.Routing.Tests/Template/TemplateRouteTest.cs b/test/Microsoft.AspNet.Routing.Tests/Template/TemplateRouteTest.cs index 67b3d80d85..4bbdcf7990 100644 --- a/test/Microsoft.AspNet.Routing.Tests/Template/TemplateRouteTest.cs +++ b/test/Microsoft.AspNet.Routing.Tests/Template/TemplateRouteTest.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; using Microsoft.AspNet.Routing.Constraints; using Microsoft.AspNet.Routing.Logging; @@ -210,7 +211,7 @@ namespace Microsoft.AspNet.Routing.Template Assert.True(routeValues.ContainsKey("country")); Assert.Equal("USA", routeValues["country"]); Assert.True(routeValues.ContainsKey("id")); - Assert.Equal("5",routeValues["id"]); + Assert.Equal("5", routeValues["id"]); Assert.True(context.RouteData.Values.ContainsKey("country")); Assert.Equal("USA", context.RouteData.Values["country"]); @@ -223,7 +224,7 @@ namespace Microsoft.AspNet.Routing.Template Assert.NotSame(originalDataTokens, context.RouteData.DataTokens); Assert.NotSame(route.DataTokens, context.RouteData.DataTokens); } - + [Fact] public async Task RouteAsync_MergesExistingRouteData_PassedToConstraint() { @@ -492,7 +493,7 @@ namespace Microsoft.AspNet.Routing.Template Assert.NotEmpty(route.Constraints); Assert.IsType(route.Constraints["id"]); - + // Act await route.RouteAsync(context); @@ -571,7 +572,7 @@ namespace Microsoft.AspNet.Routing.Template mockTarget.Object, template, defaults: null, - constraints: constraints, + constraints: constraints, dataTokens: null, inlineConstraintResolver: _inlineConstraintResolver); @@ -581,7 +582,7 @@ namespace Microsoft.AspNet.Routing.Template Assert.IsType(innerConstraint); var compositeConstraint = (CompositeRouteConstraint)innerConstraint; Assert.Equal(compositeConstraint.Constraints.Count(), 2); - + Assert.Single(compositeConstraint.Constraints, c => c is IntRouteConstraint); Assert.Single(compositeConstraint.Constraints, c => c is RangeRouteConstraint); @@ -629,7 +630,7 @@ namespace Microsoft.AspNet.Routing.Template // Act await route.RouteAsync(context); - + // Assert Assert.False(context.IsHandled); } @@ -1062,7 +1063,7 @@ namespace Microsoft.AspNet.Routing.Template var route = CreateRoute(target.Object, "{controller}/{action}"); var context = CreateVirtualPathContext( - new { action = "Store" }, + new { action = "Store" }, new { Controller = "Home", action = "Blog" }); var expectedValues = new RouteValueDictionary(new { controller = "Home", action = "Store" }); @@ -1243,7 +1244,7 @@ namespace Microsoft.AspNet.Routing.Template // Arrange var route = CreateRoute("{controller}/{action}/{id:int}"); var context = CreateVirtualPathContext( - values: new { action = "Index", controller = "Home", id = 4 }); + values: new { action = "Index", controller = "Home", id = 4 }); // Act var path = route.GetVirtualPath(context); @@ -1359,7 +1360,7 @@ namespace Microsoft.AspNet.Routing.Template constraints: null); var context = CreateVirtualPathContext( - values: new { action = "Index", controller = "Home", name = "products", format = "xml"}); + values: new { action = "Index", controller = "Home", name = "products", format = "xml" }); // Act var path = route.GetVirtualPath(context); @@ -1379,7 +1380,7 @@ namespace Microsoft.AspNet.Routing.Template constraints: null); var context = CreateVirtualPathContext( - values: new { action = "Index", controller = "Home", name = "products"}); + values: new { action = "Index", controller = "Home", name = "products" }); // Act var path = route.GetVirtualPath(context); @@ -1399,7 +1400,7 @@ namespace Microsoft.AspNet.Routing.Template constraints: null); var context = CreateVirtualPathContext( - values: new { action = "Index", controller = "Home", name = "products" , format = "xml"}); + values: new { action = "Index", controller = "Home", name = "products", format = "xml" }); // Act var path = route.GetVirtualPath(context); @@ -1419,7 +1420,7 @@ namespace Microsoft.AspNet.Routing.Template constraints: null); var context = CreateVirtualPathContext( - values: new { action = "Index", controller = "Home", name = "products"}); + values: new { action = "Index", controller = "Home", name = "products" }); // Act var path = route.GetVirtualPath(context); @@ -1459,7 +1460,7 @@ namespace Microsoft.AspNet.Routing.Template constraints: null); var context = CreateVirtualPathContext( - values: new { action = "Index", controller = "Home", name = "products"}); + values: new { action = "Index", controller = "Home", name = "products" }); // Act var path = route.GetVirtualPath(context); @@ -1479,7 +1480,7 @@ namespace Microsoft.AspNet.Routing.Template constraints: null); var context = CreateVirtualPathContext( - values: new { action = "Index", controller = "Home"}); + values: new { action = "Index", controller = "Home" }); // Act var path = route.GetVirtualPath(context); @@ -1499,7 +1500,7 @@ namespace Microsoft.AspNet.Routing.Template constraints: null); var context = CreateVirtualPathContext( - values: new { action = "Index", controller = "Home"}); + values: new { action = "Index", controller = "Home" }); // Act var path = route.GetVirtualPath(context); @@ -1519,7 +1520,7 @@ namespace Microsoft.AspNet.Routing.Template } private static VirtualPathContext CreateVirtualPathContext( - IDictionary values, + IDictionary values, IDictionary ambientValues) { var context = new Mock(MockBehavior.Strict); diff --git a/test/Microsoft.AspNet.Routing.Tests/TemplateParserDefaultValuesTests.cs b/test/Microsoft.AspNet.Routing.Tests/TemplateParserDefaultValuesTests.cs index 2db6f5440a..a87b0bf7cf 100644 --- a/test/Microsoft.AspNet.Routing.Tests/TemplateParserDefaultValuesTests.cs +++ b/test/Microsoft.AspNet.Routing.Tests/TemplateParserDefaultValuesTests.cs @@ -4,10 +4,7 @@ #if ASPNET50 using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using Microsoft.AspNet.Http; -using Microsoft.AspNet.Routing.Constraints; +using Microsoft.AspNet.Builder; using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.DependencyInjection.Fallback; using Microsoft.Framework.OptionsModel;