diff --git a/benchmarkapps/Benchmarks/Program.cs b/benchmarkapps/Benchmarks/Program.cs index 0bed5e0b3c..4e832df4a2 100644 --- a/benchmarkapps/Benchmarks/Program.cs +++ b/benchmarkapps/Benchmarks/Program.cs @@ -29,11 +29,11 @@ namespace Benchmarks .UseKestrel(); var scenario = config["scenarios"]?.ToLower(); - if (scenario == "plaintextdispatcher" || scenario == "plaintextglobalrouting") + if (scenario == "plaintextdispatcher" || scenario == "plaintextendpointrouting") { - webHostBuilder.UseStartup(); + webHostBuilder.UseStartup(); // for testing - webHostBuilder.UseSetting("Startup", nameof(StartupUsingGlobalRouting)); + webHostBuilder.UseSetting("Startup", nameof(StartupUsingEndpointRouting)); } else if (scenario == "plaintextrouting" || scenario == "plaintextrouter") { @@ -44,7 +44,7 @@ namespace Benchmarks else { throw new InvalidOperationException( - $"Invalid scenario '{scenario}'. Allowed scenarios are PlaintextGlobalRouting and PlaintextRouter"); + $"Invalid scenario '{scenario}'. Allowed scenarios are PlaintextEndpointRouting and PlaintextRouter"); } return webHostBuilder; diff --git a/benchmarkapps/Benchmarks/StartupUsingGlobalRouting.cs b/benchmarkapps/Benchmarks/StartupUsingEndpointRouting.cs similarity index 87% rename from benchmarkapps/Benchmarks/StartupUsingGlobalRouting.cs rename to benchmarkapps/Benchmarks/StartupUsingEndpointRouting.cs index f05d1b905b..c04f28decc 100644 --- a/benchmarkapps/Benchmarks/StartupUsingGlobalRouting.cs +++ b/benchmarkapps/Benchmarks/StartupUsingEndpointRouting.cs @@ -2,15 +2,15 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Text; -using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Internal; using Microsoft.AspNetCore.Routing; -using Microsoft.AspNetCore.Routing.Matchers; +using Microsoft.AspNetCore.Routing.Matching; using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.Extensions.DependencyInjection; namespace Benchmarks { - public class StartupUsingGlobalRouting + public class StartupUsingEndpointRouting { private static readonly byte[] _helloWorldPayload = Encoding.UTF8.GetBytes("Hello, World!"); @@ -41,9 +41,9 @@ namespace Benchmarks }); } - public void Configure(IApplicationBuilder app) + public void Configure(Microsoft.AspNetCore.Builder.IApplicationBuilder app) { - app.UseGlobalRouting(); + app.UseEndpointRouting(); app.UseEndpoint(); } diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/AsciiKeyedJumpTable.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/AsciiKeyedJumpTable.cs similarity index 99% rename from benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/AsciiKeyedJumpTable.cs rename to benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/AsciiKeyedJumpTable.cs index ef77524e72..2e99bd9faa 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/AsciiKeyedJumpTable.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/AsciiKeyedJumpTable.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { // An optimized jump table that trades a small amount of additional memory for // hash-table like performance. diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/CustomHashTableJumpTable.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/CustomHashTableJumpTable.cs similarity index 99% rename from benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/CustomHashTableJumpTable.cs rename to benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/CustomHashTableJumpTable.cs index 902373120f..d7bf028dbd 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/CustomHashTableJumpTable.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/CustomHashTableJumpTable.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { internal class CustomHashTableJumpTable : JumpTable { diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/DictionaryLookupJumpTable.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/DictionaryLookupJumpTable.cs similarity index 98% rename from benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/DictionaryLookupJumpTable.cs rename to benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/DictionaryLookupJumpTable.cs index 3e0f75716b..847d44e4ac 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/DictionaryLookupJumpTable.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/DictionaryLookupJumpTable.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { internal class DictionaryLookupJumpTable : JumpTable { diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/FastPathTokenizerBenchmarkBase.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/FastPathTokenizerBenchmarkBase.cs similarity index 96% rename from benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/FastPathTokenizerBenchmarkBase.cs rename to benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/FastPathTokenizerBenchmarkBase.cs index 9a32198438..e7470f690f 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/FastPathTokenizerBenchmarkBase.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/FastPathTokenizerBenchmarkBase.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public abstract class FastPathTokenizerBenchmarkBase { diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/FastPathTokenizerEmptyBenchmark.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/FastPathTokenizerEmptyBenchmark.cs similarity index 95% rename from benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/FastPathTokenizerEmptyBenchmark.cs rename to benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/FastPathTokenizerEmptyBenchmark.cs index f042b9a66d..6777205f59 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/FastPathTokenizerEmptyBenchmark.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/FastPathTokenizerEmptyBenchmark.cs @@ -4,7 +4,7 @@ using System; using BenchmarkDotNet.Attributes; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public class FastPathTokenizerEmptyBenchmark : FastPathTokenizerBenchmarkBase { diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/FastPathTokenizerLargeBenchmark.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/FastPathTokenizerLargeBenchmark.cs similarity index 96% rename from benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/FastPathTokenizerLargeBenchmark.cs rename to benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/FastPathTokenizerLargeBenchmark.cs index fdf8b6f103..edb5e427ab 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/FastPathTokenizerLargeBenchmark.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/FastPathTokenizerLargeBenchmark.cs @@ -4,7 +4,7 @@ using System; using BenchmarkDotNet.Attributes; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public class FastPathTokenizerLargeBenchmark : FastPathTokenizerBenchmarkBase { diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/FastPathTokenizerPlaintextBenchmark.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/FastPathTokenizerPlaintextBenchmark.cs similarity index 95% rename from benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/FastPathTokenizerPlaintextBenchmark.cs rename to benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/FastPathTokenizerPlaintextBenchmark.cs index 1be82d90dd..d3a5c14349 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/FastPathTokenizerPlaintextBenchmark.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/FastPathTokenizerPlaintextBenchmark.cs @@ -4,7 +4,7 @@ using System; using BenchmarkDotNet.Attributes; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public class FastPathTokenizerPlaintextBenchmark : FastPathTokenizerBenchmarkBase { diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/FastPathTokenizerSmallBenchmark.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/FastPathTokenizerSmallBenchmark.cs similarity index 95% rename from benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/FastPathTokenizerSmallBenchmark.cs rename to benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/FastPathTokenizerSmallBenchmark.cs index 737657824f..eeac746021 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/FastPathTokenizerSmallBenchmark.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/FastPathTokenizerSmallBenchmark.cs @@ -4,7 +4,7 @@ using System; using BenchmarkDotNet.Attributes; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public class FastPathTokenizerSmallBenchmark : FastPathTokenizerBenchmarkBase { diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/JumpTableMultipleEntryBenchmark.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/JumpTableMultipleEntryBenchmark.cs similarity index 99% rename from benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/JumpTableMultipleEntryBenchmark.cs rename to benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/JumpTableMultipleEntryBenchmark.cs index 731334c1c1..d34792ae5f 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/JumpTableMultipleEntryBenchmark.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/JumpTableMultipleEntryBenchmark.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Diagnostics; using BenchmarkDotNet.Attributes; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public class JumpTableMultipleEntryBenchmark { diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/JumpTableSingleEntryBenchmark.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/JumpTableSingleEntryBenchmark.cs similarity index 97% rename from benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/JumpTableSingleEntryBenchmark.cs rename to benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/JumpTableSingleEntryBenchmark.cs index 0ab4bf3380..ed59d796ed 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/JumpTableSingleEntryBenchmark.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/JumpTableSingleEntryBenchmark.cs @@ -4,7 +4,7 @@ using System; using BenchmarkDotNet.Attributes; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public class JumpTableSingleEntryBenchmark { diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/JumpTableZeroEntryBenchmark.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/JumpTableZeroEntryBenchmark.cs similarity index 97% rename from benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/JumpTableZeroEntryBenchmark.cs rename to benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/JumpTableZeroEntryBenchmark.cs index d14771e36f..337011de72 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/JumpTableZeroEntryBenchmark.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/JumpTableZeroEntryBenchmark.cs @@ -3,7 +3,7 @@ using BenchmarkDotNet.Attributes; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public class JumpTableZeroEntryBenchmark { diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcheFindCandidateSetSingleEntryBenchmark.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcheFindCandidateSetSingleEntryBenchmark.cs similarity index 97% rename from benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcheFindCandidateSetSingleEntryBenchmark.cs rename to benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcheFindCandidateSetSingleEntryBenchmark.cs index 18818df532..d4dc11a77a 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcheFindCandidateSetSingleEntryBenchmark.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcheFindCandidateSetSingleEntryBenchmark.cs @@ -5,7 +5,7 @@ using System; using BenchmarkDotNet.Attributes; using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public class MatcheFindCandidateSetSingleEntryBenchmark : MatcherBenchmarkBase { diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherAzureBenchmark.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherAzureBenchmark.cs similarity index 97% rename from benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherAzureBenchmark.cs rename to benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherAzureBenchmark.cs index 23e3948aad..1cd5b350f9 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherAzureBenchmark.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherAzureBenchmark.cs @@ -4,7 +4,7 @@ using System.Threading.Tasks; using BenchmarkDotNet.Attributes; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { // Generated from https://github.com/Azure/azure-rest-api-specs public partial class MatcherAzureBenchmark : MatcherBenchmarkBase diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherAzureBenchmark.generated.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherAzureBenchmark.generated.cs similarity index 99% rename from benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherAzureBenchmark.generated.cs rename to benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherAzureBenchmark.generated.cs index e45f4009f7..0a2c549bfd 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherAzureBenchmark.generated.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherAzureBenchmark.generated.cs @@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { // This code was generated by the Swaggatherer public partial class MatcherAzureBenchmark : MatcherBenchmarkBase diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherBenchmarkBase.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherBenchmarkBase.cs similarity index 98% rename from benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherBenchmarkBase.cs rename to benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherBenchmarkBase.cs index 8d428e8253..76802c758d 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherBenchmarkBase.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherBenchmarkBase.cs @@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Routing.Metadata; using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.Extensions.DependencyInjection; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public abstract class MatcherBenchmarkBase { diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherFindCandidateSetAzureBenchmark.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherFindCandidateSetAzureBenchmark.cs similarity index 98% rename from benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherFindCandidateSetAzureBenchmark.cs rename to benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherFindCandidateSetAzureBenchmark.cs index 7c346eca4a..84f6ac7dad 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherFindCandidateSetAzureBenchmark.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherFindCandidateSetAzureBenchmark.cs @@ -4,7 +4,7 @@ using System; using BenchmarkDotNet.Attributes; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { // Generated from https://github.com/Azure/azure-rest-api-specs public partial class MatcherFindCandidateSetAzureBenchmark : MatcherBenchmarkBase diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherFindCandidateSetAzureBenchmark.generated.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherFindCandidateSetAzureBenchmark.generated.cs similarity index 99% rename from benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherFindCandidateSetAzureBenchmark.generated.cs rename to benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherFindCandidateSetAzureBenchmark.generated.cs index c68f822fc2..b7ee1d1e64 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherFindCandidateSetAzureBenchmark.generated.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherFindCandidateSetAzureBenchmark.generated.cs @@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { // This code was generated by the Swaggatherer public partial class MatcherFindCandidateSetAzureBenchmark : MatcherBenchmarkBase diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherFindCandidateSetGithubBenchmark.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherFindCandidateSetGithubBenchmark.cs similarity index 97% rename from benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherFindCandidateSetGithubBenchmark.cs rename to benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherFindCandidateSetGithubBenchmark.cs index 7b13d8fddf..09f7fe7d6d 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherFindCandidateSetGithubBenchmark.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherFindCandidateSetGithubBenchmark.cs @@ -5,7 +5,7 @@ using System; using System.Threading.Tasks; using BenchmarkDotNet.Attributes; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { // Generated from https://github.com/APIs-guru/openapi-directory // Use https://editor2.swagger.io/ to convert from yaml to json- diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherFindCandidateSetGithubBenchmark.generated.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherFindCandidateSetGithubBenchmark.generated.cs similarity index 99% rename from benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherFindCandidateSetGithubBenchmark.generated.cs rename to benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherFindCandidateSetGithubBenchmark.generated.cs index 034547b9d2..8bc1316747 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherFindCandidateSetGithubBenchmark.generated.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherFindCandidateSetGithubBenchmark.generated.cs @@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { // This code was generated by the Swaggatherer public partial class MatcherFindCandidateSetGithubBenchmark : MatcherBenchmarkBase diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherFindCandidateSetSmallEntryCountBenchmark.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherFindCandidateSetSmallEntryCountBenchmark.cs similarity index 98% rename from benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherFindCandidateSetSmallEntryCountBenchmark.cs rename to benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherFindCandidateSetSmallEntryCountBenchmark.cs index 472ff9c2a8..ede760ea17 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherFindCandidateSetSmallEntryCountBenchmark.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherFindCandidateSetSmallEntryCountBenchmark.cs @@ -5,7 +5,7 @@ using System; using BenchmarkDotNet.Attributes; using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public class MatcherFindCandidateSetSmallEntryCountBenchmark : MatcherBenchmarkBase { diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherGithubBenchmark.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherGithubBenchmark.cs similarity index 97% rename from benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherGithubBenchmark.cs rename to benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherGithubBenchmark.cs index 2cdb76f11f..5444f94a0b 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherGithubBenchmark.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherGithubBenchmark.cs @@ -4,7 +4,7 @@ using System.Threading.Tasks; using BenchmarkDotNet.Attributes; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { // Generated from https://github.com/APIs-guru/openapi-directory // Use https://editor2.swagger.io/ to convert from yaml to json- diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherGithubBenchmark.generated.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherGithubBenchmark.generated.cs similarity index 99% rename from benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherGithubBenchmark.generated.cs rename to benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherGithubBenchmark.generated.cs index 1de9e9f993..0f5ecbc165 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherGithubBenchmark.generated.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherGithubBenchmark.generated.cs @@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { // This code was generated by the Swaggatherer public partial class MatcherGithubBenchmark : MatcherBenchmarkBase diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherSingleEntryBenchmark.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherSingleEntryBenchmark.cs similarity index 98% rename from benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherSingleEntryBenchmark.cs rename to benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherSingleEntryBenchmark.cs index 5125ffb169..a51c4af375 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/MatcherSingleEntryBenchmark.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/MatcherSingleEntryBenchmark.cs @@ -5,7 +5,7 @@ using System.Threading.Tasks; using BenchmarkDotNet.Attributes; using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { // Just like TechEmpower Plaintext public partial class MatcherSingleEntryBenchmark : MatcherBenchmarkBase diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/TrivialMatcher.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/TrivialMatcher.cs similarity index 97% rename from benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/TrivialMatcher.cs rename to benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/TrivialMatcher.cs index afdb27d0d9..d05ed2639d 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/TrivialMatcher.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/TrivialMatcher.cs @@ -5,7 +5,7 @@ using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { // A test-only matcher implementation - used as a baseline for simpler // perf tests. The idea with this matcher is that we can cheat on the requirements diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/TrivialMatcherBuilder.cs b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/TrivialMatcherBuilder.cs similarity index 92% rename from benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/TrivialMatcherBuilder.cs rename to benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/TrivialMatcherBuilder.cs index f327de28db..ffa3def965 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matchers/TrivialMatcherBuilder.cs +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Matching/TrivialMatcherBuilder.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Linq; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { internal class TrivialMatcherBuilder : MatcherBuilder { diff --git a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Microsoft.AspNetCore.Routing.Performance.csproj b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Microsoft.AspNetCore.Routing.Performance.csproj index e3ee4a1f6a..d1e25aa6f0 100644 --- a/benchmarks/Microsoft.AspNetCore.Routing.Performance/Microsoft.AspNetCore.Routing.Performance.csproj +++ b/benchmarks/Microsoft.AspNetCore.Routing.Performance/Microsoft.AspNetCore.Routing.Performance.csproj @@ -18,23 +18,23 @@ for perf comparisons. --> - - Matchers\BarebonesMatcher.cs + + Matching\BarebonesMatcher.cs - - Matchers\BarebonesMatcherBuilder.cs + + Matching\BarebonesMatcherBuilder.cs - - Matchers\RouteMatcher.cs + + Matching\RouteMatcher.cs - - Matchers\RouteMatcherBuilder.cs + + Matching\RouteMatcherBuilder.cs - - Matchers\TreeRouterMatcher.cs + + Matching\TreeRouterMatcher.cs - - Matchers\TreeRouterMatcherBuilder.cs + + Matching\TreeRouterMatcherBuilder.cs diff --git a/benchmarks/Swaggatherer/Template.cs b/benchmarks/Swaggatherer/Template.cs index 9c05aa5867..a48ecb7749 100644 --- a/benchmarks/Swaggatherer/Template.cs +++ b/benchmarks/Swaggatherer/Template.cs @@ -39,7 +39,7 @@ namespace Swaggatherer using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching {{ // This code was generated by the Swaggatherer public partial class GeneratedBenchmark : MatcherBenchmarkBase diff --git a/samples/RoutingSample.Web/EndsWithStringMatchProcessor.cs b/samples/RoutingSample.Web/EndsWithStringMatchProcessor.cs index 17fcb1f990..ea50812015 100644 --- a/samples/RoutingSample.Web/EndsWithStringMatchProcessor.cs +++ b/samples/RoutingSample.Web/EndsWithStringMatchProcessor.cs @@ -3,7 +3,7 @@ using System; using System.Globalization; -using Microsoft.AspNetCore.Routing.Matchers; +using Microsoft.AspNetCore.Routing.Matching; using Microsoft.Extensions.Logging; namespace RoutingSample.Web diff --git a/samples/RoutingSample.Web/Program.cs b/samples/RoutingSample.Web/Program.cs index 206e4bb0bf..5867596559 100644 --- a/samples/RoutingSample.Web/Program.cs +++ b/samples/RoutingSample.Web/Program.cs @@ -9,8 +9,8 @@ namespace RoutingSample.Web { public class Program { - public static readonly string GlobalRoutingScenario = "globalrouting"; - public static readonly string RouterScenario = "router"; + public const string EndpointRoutingScenario = "endpointrouting"; + public const string RouterScenario = "router"; public static void Main(string[] args) { @@ -25,7 +25,7 @@ namespace RoutingSample.Web if (args.Length == 0) { Console.WriteLine("Choose a sample to run:"); - Console.WriteLine($"1. {GlobalRoutingScenario}"); + Console.WriteLine($"1. {EndpointRoutingScenario}"); Console.WriteLine($"2. {RouterScenario}"); Console.WriteLine(); @@ -40,18 +40,18 @@ namespace RoutingSample.Web switch (scenario) { case "1": - case "globalrouting": - startupType = typeof(UseGlobalRoutingStartup); + case EndpointRoutingScenario: + startupType = typeof(UseEndpointRoutingStartup); break; case "2": - case "router": + case RouterScenario: startupType = typeof(UseRouterStartup); break; default: Console.WriteLine($"unknown scenario {scenario}"); - Console.WriteLine($"usage: dotnet run -- ({GlobalRoutingScenario}|{RouterScenario})"); + Console.WriteLine($"usage: dotnet run -- ({EndpointRoutingScenario}|{RouterScenario})"); throw new InvalidOperationException(); } diff --git a/samples/RoutingSample.Web/UseGlobalRoutingStartup.cs b/samples/RoutingSample.Web/UseEndpointRoutingStartup.cs similarity index 92% rename from samples/RoutingSample.Web/UseGlobalRoutingStartup.cs rename to samples/RoutingSample.Web/UseEndpointRoutingStartup.cs index 12cfd28640..06dab7eddb 100644 --- a/samples/RoutingSample.Web/UseGlobalRoutingStartup.cs +++ b/samples/RoutingSample.Web/UseEndpointRoutingStartup.cs @@ -3,18 +3,18 @@ using System; using System.Text; -using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Internal; using Microsoft.AspNetCore.Routing; -using Microsoft.AspNetCore.Routing.Matchers; +using Microsoft.AspNetCore.Routing.Matching; using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.Extensions.DependencyInjection; namespace RoutingSample.Web { - public class UseGlobalRoutingStartup + public class UseEndpointRoutingStartup { - private static readonly byte[] _homePayload = Encoding.UTF8.GetBytes("Global Routing sample endpoints:" + Environment.NewLine + "/plaintext"); + private static readonly byte[] _homePayload = Encoding.UTF8.GetBytes("Endpoint Routing sample endpoints:" + Environment.NewLine + "/plaintext"); private static readonly byte[] _helloWorldPayload = Encoding.UTF8.GetBytes("Hello, World!"); public void ConfigureServices(IServiceCollection services) @@ -86,9 +86,9 @@ namespace RoutingSample.Web }); } - public void Configure(IApplicationBuilder app) + public void Configure(Microsoft.AspNetCore.Builder.IApplicationBuilder app) { - app.UseGlobalRouting(); + app.UseEndpointRouting(); // Imagine some more stuff here... diff --git a/src/Microsoft.AspNetCore.Routing.Abstractions/EndpointMetadataCollection.cs b/src/Microsoft.AspNetCore.Routing.Abstractions/EndpointMetadataCollection.cs index 9829ab396c..405a5581d1 100644 --- a/src/Microsoft.AspNetCore.Routing.Abstractions/EndpointMetadataCollection.cs +++ b/src/Microsoft.AspNetCore.Routing.Abstractions/EndpointMetadataCollection.cs @@ -8,7 +8,7 @@ using System.Linq; namespace Microsoft.AspNetCore.Routing { - public class EndpointMetadataCollection : IReadOnlyList + public sealed class EndpointMetadataCollection : IReadOnlyList { public static readonly EndpointMetadataCollection Empty = new EndpointMetadataCollection(Array.Empty()); @@ -24,6 +24,11 @@ namespace Microsoft.AspNetCore.Routing _items = items.ToArray(); } + public EndpointMetadataCollection(params object[] items) + : this((IEnumerable)items) + { + } + public object this[int index] => _items[index]; public int Count => _items.Length; diff --git a/src/Microsoft.AspNetCore.Routing/Builder/EndpointRoutingApplicationBuilderExtensions.cs b/src/Microsoft.AspNetCore.Routing/Builder/EndpointRoutingApplicationBuilderExtensions.cs new file mode 100644 index 0000000000..428fae6ab1 --- /dev/null +++ b/src/Microsoft.AspNetCore.Routing/Builder/EndpointRoutingApplicationBuilderExtensions.cs @@ -0,0 +1,19 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.AspNetCore.Builder +{ + // TODO: Remove once MVC is updated + public static class EndpointRoutingApplicationBuilderExtensions + { + public static IApplicationBuilder UseGlobalRouting(this IApplicationBuilder builder) + { + return Internal.EndpointRoutingApplicationBuilderExtensions.UseEndpointRouting(builder); + } + + public static IApplicationBuilder UseEndpoint(this IApplicationBuilder builder) + { + return Internal.EndpointRoutingApplicationBuilderExtensions.UseEndpoint(builder); + } + } +} diff --git a/src/Microsoft.AspNetCore.Routing/CompositeEndpointDataSource.cs b/src/Microsoft.AspNetCore.Routing/CompositeEndpointDataSource.cs index c9673a33c3..e9157ea578 100644 --- a/src/Microsoft.AspNetCore.Routing/CompositeEndpointDataSource.cs +++ b/src/Microsoft.AspNetCore.Routing/CompositeEndpointDataSource.cs @@ -7,14 +7,14 @@ using System.Diagnostics; using System.Linq; using System.Text; using System.Threading; -using Microsoft.AspNetCore.Routing.Matchers; +using Microsoft.AspNetCore.Routing.Matching; using Microsoft.AspNetCore.Routing.Metadata; using Microsoft.Extensions.Primitives; namespace Microsoft.AspNetCore.Routing { [DebuggerDisplay("{DebuggerDisplayString,nq}")] - public class CompositeEndpointDataSource : EndpointDataSource + public sealed class CompositeEndpointDataSource : EndpointDataSource { private readonly EndpointDataSource[] _dataSources; private readonly object _lock; diff --git a/src/Microsoft.AspNetCore.Routing/DefaultEndpointDataSource.cs b/src/Microsoft.AspNetCore.Routing/DefaultEndpointDataSource.cs index d74369c8b7..b73b8fcc0b 100644 --- a/src/Microsoft.AspNetCore.Routing/DefaultEndpointDataSource.cs +++ b/src/Microsoft.AspNetCore.Routing/DefaultEndpointDataSource.cs @@ -8,9 +8,14 @@ using Microsoft.Extensions.Primitives; namespace Microsoft.AspNetCore.Routing { - public class DefaultEndpointDataSource : EndpointDataSource + public sealed class DefaultEndpointDataSource : EndpointDataSource { - private readonly List _endpoints; + private readonly List _endpoints; + + public DefaultEndpointDataSource(params Endpoint[] endpoints) + : this((IEnumerable) endpoints) + { + } public DefaultEndpointDataSource(IEnumerable endpoints) { diff --git a/src/Microsoft.AspNetCore.Routing/DefaultLinkGenerator.cs b/src/Microsoft.AspNetCore.Routing/DefaultLinkGenerator.cs index 0d7df72432..b515643139 100644 --- a/src/Microsoft.AspNetCore.Routing/DefaultLinkGenerator.cs +++ b/src/Microsoft.AspNetCore.Routing/DefaultLinkGenerator.cs @@ -6,7 +6,7 @@ using System.Linq; using System.Text.Encodings.Web; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing.Internal; -using Microsoft.AspNetCore.Routing.Matchers; +using Microsoft.AspNetCore.Routing.Matching; using Microsoft.AspNetCore.Routing.Template; using Microsoft.Extensions.Logging; using Microsoft.Extensions.ObjectPool; diff --git a/src/Microsoft.AspNetCore.Routing/DependencyInjection/RoutingServiceCollectionExtensions.cs b/src/Microsoft.AspNetCore.Routing/DependencyInjection/RoutingServiceCollectionExtensions.cs index ab4c29b702..42433f64c0 100644 --- a/src/Microsoft.AspNetCore.Routing/DependencyInjection/RoutingServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNetCore.Routing/DependencyInjection/RoutingServiceCollectionExtensions.cs @@ -3,10 +3,8 @@ using System; using Microsoft.AspNetCore.Routing; -using Microsoft.AspNetCore.Routing.Constraints; -using Microsoft.AspNetCore.Routing.EndpointFinders; using Microsoft.AspNetCore.Routing.Internal; -using Microsoft.AspNetCore.Routing.Matchers; +using Microsoft.AspNetCore.Routing.Matching; using Microsoft.AspNetCore.Routing.Tree; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Logging; @@ -70,7 +68,7 @@ namespace Microsoft.Extensions.DependencyInjection // Link generation related services services.TryAddSingleton, NameBasedEndpointFinder>(); - services.TryAddSingleton, RouteValuesBasedEndpointFinder>(); + services.TryAddSingleton, RouteValuesBasedEndpointFinder>(); services.TryAddSingleton(); // diff --git a/src/Microsoft.AspNetCore.Routing/EndpointMiddleware.cs b/src/Microsoft.AspNetCore.Routing/EndpointMiddleware.cs index 243c97d262..8ef2bcdb3d 100644 --- a/src/Microsoft.AspNetCore.Routing/EndpointMiddleware.cs +++ b/src/Microsoft.AspNetCore.Routing/EndpointMiddleware.cs @@ -34,8 +34,8 @@ namespace Microsoft.AspNetCore.Routing var feature = httpContext.Features.Get(); if (feature == null) { - var message = $"Unable to execute an endpoint because the {nameof(GlobalRoutingMiddleware)} was not run for this request. " + - $"Ensure {nameof(GlobalRoutingMiddleware)} is added to the request execution pipeline before {nameof(EndpointMiddleware)} in application startup code."; + var message = $"Unable to execute an endpoint because the {nameof(EndpointRoutingMiddleware)} was not run for this request. " + + $"Ensure {nameof(EndpointRoutingMiddleware)} is added to the request execution pipeline before {nameof(EndpointMiddleware)} in application startup code."; throw new InvalidOperationException(message); } diff --git a/src/Microsoft.AspNetCore.Routing/GlobalRoutingMiddleware.cs b/src/Microsoft.AspNetCore.Routing/EndpointRoutingMiddleware.cs similarity index 95% rename from src/Microsoft.AspNetCore.Routing/GlobalRoutingMiddleware.cs rename to src/Microsoft.AspNetCore.Routing/EndpointRoutingMiddleware.cs index 994b2e6295..e38175d165 100644 --- a/src/Microsoft.AspNetCore.Routing/GlobalRoutingMiddleware.cs +++ b/src/Microsoft.AspNetCore.Routing/EndpointRoutingMiddleware.cs @@ -5,13 +5,13 @@ using System; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing.Matchers; +using Microsoft.AspNetCore.Routing.Matching; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; namespace Microsoft.AspNetCore.Routing { - internal sealed class GlobalRoutingMiddleware + internal sealed class EndpointRoutingMiddleware { private readonly MatcherFactory _matcherFactory; private readonly ILogger _logger; @@ -20,10 +20,10 @@ namespace Microsoft.AspNetCore.Routing private Task _initializationTask; - public GlobalRoutingMiddleware( + public EndpointRoutingMiddleware( MatcherFactory matcherFactory, CompositeEndpointDataSource endpointDataSource, - ILogger logger, + ILogger logger, RequestDelegate next) { if (matcherFactory == null) diff --git a/src/Microsoft.AspNetCore.Routing.Abstractions/IEndpointFinderOfT.cs b/src/Microsoft.AspNetCore.Routing/IEndpointFinderOfT.cs similarity index 100% rename from src/Microsoft.AspNetCore.Routing.Abstractions/IEndpointFinderOfT.cs rename to src/Microsoft.AspNetCore.Routing/IEndpointFinderOfT.cs diff --git a/src/Microsoft.AspNetCore.Routing.Abstractions/INameMetadata.cs b/src/Microsoft.AspNetCore.Routing/INameMetadata.cs similarity index 99% rename from src/Microsoft.AspNetCore.Routing.Abstractions/INameMetadata.cs rename to src/Microsoft.AspNetCore.Routing/INameMetadata.cs index 97de9aaa2f..c38ae7f0e5 100644 --- a/src/Microsoft.AspNetCore.Routing.Abstractions/INameMetadata.cs +++ b/src/Microsoft.AspNetCore.Routing/INameMetadata.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - namespace Microsoft.AspNetCore.Routing { public interface INameMetadata diff --git a/src/Microsoft.AspNetCore.Routing.Abstractions/IRouteNameMetadata.cs b/src/Microsoft.AspNetCore.Routing/IRouteNameMetadata.cs similarity index 99% rename from src/Microsoft.AspNetCore.Routing.Abstractions/IRouteNameMetadata.cs rename to src/Microsoft.AspNetCore.Routing/IRouteNameMetadata.cs index eba962c285..efc1136904 100644 --- a/src/Microsoft.AspNetCore.Routing.Abstractions/IRouteNameMetadata.cs +++ b/src/Microsoft.AspNetCore.Routing/IRouteNameMetadata.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - namespace Microsoft.AspNetCore.Routing { public interface IRouteNameMetadata diff --git a/src/Microsoft.AspNetCore.Routing.Abstractions/ISuppressLinkGenerationMetadata.cs b/src/Microsoft.AspNetCore.Routing/ISuppressLinkGenerationMetadata.cs similarity index 100% rename from src/Microsoft.AspNetCore.Routing.Abstractions/ISuppressLinkGenerationMetadata.cs rename to src/Microsoft.AspNetCore.Routing/ISuppressLinkGenerationMetadata.cs diff --git a/src/Microsoft.AspNetCore.Routing/Builder/GlobalRoutingApplicationBuilderExtensions.cs b/src/Microsoft.AspNetCore.Routing/Internal/EndpointRoutingApplicationBuilderExtensions.cs similarity index 57% rename from src/Microsoft.AspNetCore.Routing/Builder/GlobalRoutingApplicationBuilderExtensions.cs rename to src/Microsoft.AspNetCore.Routing/Internal/EndpointRoutingApplicationBuilderExtensions.cs index 1e231c2255..03dd6b4247 100644 --- a/src/Microsoft.AspNetCore.Routing/Builder/GlobalRoutingApplicationBuilderExtensions.cs +++ b/src/Microsoft.AspNetCore.Routing/Internal/EndpointRoutingApplicationBuilderExtensions.cs @@ -2,33 +2,38 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Routing.Internal; using Microsoft.Extensions.DependencyInjection; -namespace Microsoft.AspNetCore.Builder +namespace Microsoft.AspNetCore.Internal { - public static class GlobalRoutingApplicationBuilderExtensions + public static class EndpointRoutingApplicationBuilderExtensions { + // TODO: Remove once MVC is updated private const string GlobalRoutingRegisteredKey = "__GlobalRoutingMiddlewareRegistered"; - public static IApplicationBuilder UseGlobalRouting(this IApplicationBuilder builder) + private const string EndpointRoutingRegisteredKey = "__EndpointRoutingMiddlewareRegistered"; + + public static IApplicationBuilder UseEndpointRouting(this IApplicationBuilder builder) { VerifyRoutingIsRegistered(builder); + builder.Properties[EndpointRoutingRegisteredKey] = true; builder.Properties[GlobalRoutingRegisteredKey] = true; - return builder.UseMiddleware(); + return builder.UseMiddleware(); } public static IApplicationBuilder UseEndpoint(this IApplicationBuilder builder) { VerifyRoutingIsRegistered(builder); - if (!builder.Properties.TryGetValue(GlobalRoutingRegisteredKey, out _)) + if (!builder.Properties.TryGetValue(EndpointRoutingRegisteredKey, out _)) { - var message = $"{nameof(GlobalRoutingMiddleware)} must be added to the request execution pipeline before {nameof(EndpointMiddleware)}. " + - $"Please add {nameof(GlobalRoutingMiddleware)} by calling '{nameof(IApplicationBuilder)}.{nameof(UseGlobalRouting)}' inside the call to 'Configure(...)' in the application startup code."; + var message = $"{nameof(EndpointRoutingMiddleware)} must be added to the request execution pipeline before {nameof(EndpointMiddleware)}. " + + $"Please add {nameof(EndpointRoutingMiddleware)} by calling '{nameof(IApplicationBuilder)}.{nameof(UseEndpointRouting)}' inside the call to 'Configure(...)' in the application startup code."; throw new InvalidOperationException(message); } @@ -38,7 +43,7 @@ namespace Microsoft.AspNetCore.Builder private static void VerifyRoutingIsRegistered(IApplicationBuilder app) { - // Verify if AddRouting was done before calling UseGlobalRouting/UseEndpoint + // Verify if AddRouting was done before calling UseEndpointRouting/UseEndpoint // We use the RoutingMarkerService to make sure if all the services were added. if (app.ApplicationServices.GetService(typeof(RoutingMarkerService)) == null) { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/AmbiguousMatchException.cs b/src/Microsoft.AspNetCore.Routing/Matching/AmbiguousMatchException.cs similarity index 93% rename from src/Microsoft.AspNetCore.Routing/Matchers/AmbiguousMatchException.cs rename to src/Microsoft.AspNetCore.Routing/Matching/AmbiguousMatchException.cs index e0d7a75397..1afed0e103 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/AmbiguousMatchException.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/AmbiguousMatchException.cs @@ -4,7 +4,7 @@ using System; using System.Runtime.Serialization; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { /// /// An exception which indicates multiple matches in endpoint selection. diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/Candidate.cs b/src/Microsoft.AspNetCore.Routing/Matching/Candidate.cs similarity index 98% rename from src/Microsoft.AspNetCore.Routing/Matchers/Candidate.cs rename to src/Microsoft.AspNetCore.Routing/Matching/Candidate.cs index 5b6459b386..939ac369ca 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/Candidate.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/Candidate.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using Microsoft.AspNetCore.Routing.Patterns; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { internal readonly struct Candidate { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/CandidateSet.cs b/src/Microsoft.AspNetCore.Routing/Matching/CandidateSet.cs similarity index 99% rename from src/Microsoft.AspNetCore.Routing/Matchers/CandidateSet.cs rename to src/Microsoft.AspNetCore.Routing/Matching/CandidateSet.cs index 9f89b765a2..dc51752923 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/CandidateSet.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/CandidateSet.cs @@ -4,7 +4,7 @@ using System; using System.Runtime.CompilerServices; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public sealed class CandidateSet { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/CandidateState.cs b/src/Microsoft.AspNetCore.Routing/Matching/CandidateState.cs similarity index 67% rename from src/Microsoft.AspNetCore.Routing/Matchers/CandidateState.cs rename to src/Microsoft.AspNetCore.Routing/Matching/CandidateState.cs index b302b23bf2..4cb525bfac 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/CandidateState.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/CandidateState.cs @@ -1,17 +1,11 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public struct CandidateState { - // Provided for testability - public CandidateState(MatcherEndpoint endpoint) - : this(endpoint, score: 0) - { - } - - public CandidateState(MatcherEndpoint endpoint, int score) + internal CandidateState(MatcherEndpoint endpoint, int score) { Endpoint = endpoint; Score = score; diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/DataSourceDependentMatcher.cs b/src/Microsoft.AspNetCore.Routing/Matching/DataSourceDependentMatcher.cs similarity index 97% rename from src/Microsoft.AspNetCore.Routing/Matchers/DataSourceDependentMatcher.cs rename to src/Microsoft.AspNetCore.Routing/Matching/DataSourceDependentMatcher.cs index 07f9361a16..5ff901b96d 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/DataSourceDependentMatcher.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/DataSourceDependentMatcher.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { internal class DataSourceDependentMatcher : Matcher { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/DefaultEndpointSelector.cs b/src/Microsoft.AspNetCore.Routing/Matching/DefaultEndpointSelector.cs similarity index 98% rename from src/Microsoft.AspNetCore.Routing/Matchers/DefaultEndpointSelector.cs rename to src/Microsoft.AspNetCore.Routing/Matching/DefaultEndpointSelector.cs index 2d3e6d5026..59418b10c1 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/DefaultEndpointSelector.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/DefaultEndpointSelector.cs @@ -7,7 +7,7 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { internal class DefaultEndpointSelector : EndpointSelector { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/DefaultMatchProcessorFactory.cs b/src/Microsoft.AspNetCore.Routing/Matching/DefaultMatchProcessorFactory.cs similarity index 98% rename from src/Microsoft.AspNetCore.Routing/Matchers/DefaultMatchProcessorFactory.cs rename to src/Microsoft.AspNetCore.Routing/Matching/DefaultMatchProcessorFactory.cs index d515df57da..26e374a580 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/DefaultMatchProcessorFactory.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/DefaultMatchProcessorFactory.cs @@ -5,7 +5,7 @@ using System; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { internal class DefaultMatchProcessorFactory : MatchProcessorFactory { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/DfaMatcher.cs b/src/Microsoft.AspNetCore.Routing/Matching/DfaMatcher.cs similarity index 99% rename from src/Microsoft.AspNetCore.Routing/Matchers/DfaMatcher.cs rename to src/Microsoft.AspNetCore.Routing/Matching/DfaMatcher.cs index a7908e1662..e4982950f1 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/DfaMatcher.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/DfaMatcher.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing.Patterns; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { internal sealed class DfaMatcher : Matcher { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/DfaMatcherBuilder.cs b/src/Microsoft.AspNetCore.Routing/Matching/DfaMatcherBuilder.cs similarity index 99% rename from src/Microsoft.AspNetCore.Routing/Matchers/DfaMatcherBuilder.cs rename to src/Microsoft.AspNetCore.Routing/Matching/DfaMatcherBuilder.cs index c5f75cee4e..3157672ea1 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/DfaMatcherBuilder.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/DfaMatcherBuilder.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Routing.Patterns; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { internal class DfaMatcherBuilder : MatcherBuilder { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/DfaMatcherFactory.cs b/src/Microsoft.AspNetCore.Routing/Matching/DfaMatcherFactory.cs similarity index 95% rename from src/Microsoft.AspNetCore.Routing/Matchers/DfaMatcherFactory.cs rename to src/Microsoft.AspNetCore.Routing/Matching/DfaMatcherFactory.cs index 2e5dc8a3f2..c4b932d3df 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/DfaMatcherFactory.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/DfaMatcherFactory.cs @@ -4,7 +4,7 @@ using System; using Microsoft.Extensions.DependencyInjection; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { internal class DfaMatcherFactory : MatcherFactory { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/DfaNode.cs b/src/Microsoft.AspNetCore.Routing/Matching/DfaNode.cs similarity index 98% rename from src/Microsoft.AspNetCore.Routing/Matchers/DfaNode.cs rename to src/Microsoft.AspNetCore.Routing/Matching/DfaNode.cs index 5508f0f460..59b334509a 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/DfaNode.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/DfaNode.cs @@ -7,7 +7,7 @@ using System.Diagnostics; using System.Linq; using System.Text; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { // Intermediate data structure used to build the DFA. Not used at runtime. [DebuggerDisplay("{DebuggerToString(),nq}")] diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/DfaState.cs b/src/Microsoft.AspNetCore.Routing/Matching/DfaState.cs similarity index 95% rename from src/Microsoft.AspNetCore.Routing/Matchers/DfaState.cs rename to src/Microsoft.AspNetCore.Routing/Matching/DfaState.cs index a854fdbc6f..1e7b9a16bf 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/DfaState.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/DfaState.cs @@ -3,7 +3,7 @@ using System.Diagnostics; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { [DebuggerDisplay("{DebuggerToString(),nq}")] internal readonly struct DfaState diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/DictionaryJumpTable.cs b/src/Microsoft.AspNetCore.Routing/Matching/DictionaryJumpTable.cs similarity index 97% rename from src/Microsoft.AspNetCore.Routing/Matchers/DictionaryJumpTable.cs rename to src/Microsoft.AspNetCore.Routing/Matching/DictionaryJumpTable.cs index 2fe734ed3f..27445737e9 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/DictionaryJumpTable.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/DictionaryJumpTable.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { internal class DictionaryJumpTable : JumpTable { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/EndpointMetadataComparer.cs b/src/Microsoft.AspNetCore.Routing/Matching/EndpointMetadataComparer.cs similarity index 97% rename from src/Microsoft.AspNetCore.Routing/Matchers/EndpointMetadataComparer.cs rename to src/Microsoft.AspNetCore.Routing/Matching/EndpointMetadataComparer.cs index 7a742fecba..6c617f5d03 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/EndpointMetadataComparer.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/EndpointMetadataComparer.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public abstract class EndpointMetadataComparer : IComparer where TMetadata : class { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/EndpointSelector.cs b/src/Microsoft.AspNetCore.Routing/Matching/EndpointSelector.cs similarity index 90% rename from src/Microsoft.AspNetCore.Routing/Matchers/EndpointSelector.cs rename to src/Microsoft.AspNetCore.Routing/Matching/EndpointSelector.cs index 6f8e420a59..0af172bdca 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/EndpointSelector.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/EndpointSelector.cs @@ -4,7 +4,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public abstract class EndpointSelector { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/FastPathTokenizer.cs b/src/Microsoft.AspNetCore.Routing/Matching/FastPathTokenizer.cs similarity index 97% rename from src/Microsoft.AspNetCore.Routing/Matchers/FastPathTokenizer.cs rename to src/Microsoft.AspNetCore.Routing/Matching/FastPathTokenizer.cs index f561ae0ee2..0781fbfb94 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/FastPathTokenizer.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/FastPathTokenizer.cs @@ -3,7 +3,7 @@ using System; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { // Low level implementation of our path tokenization algorithm. Alternative // to PathTokenizer. diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/HttpMethodMatcherPolicy.cs b/src/Microsoft.AspNetCore.Routing/Matching/HttpMethodMatcherPolicy.cs similarity index 99% rename from src/Microsoft.AspNetCore.Routing/Matchers/HttpMethodMatcherPolicy.cs rename to src/Microsoft.AspNetCore.Routing/Matching/HttpMethodMatcherPolicy.cs index e593713bb6..315c3d8409 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/HttpMethodMatcherPolicy.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/HttpMethodMatcherPolicy.cs @@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.Extensions.Internal; using Microsoft.Extensions.Primitives; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public sealed class HttpMethodMatcherPolicy : MatcherPolicy, IEndpointComparerPolicy, INodeBuilderPolicy { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/IEndpointComparerPolicy.cs b/src/Microsoft.AspNetCore.Routing/Matching/IEndpointComparerPolicy.cs similarity index 86% rename from src/Microsoft.AspNetCore.Routing/Matchers/IEndpointComparerPolicy.cs rename to src/Microsoft.AspNetCore.Routing/Matching/IEndpointComparerPolicy.cs index abd16e5e9a..9c187a6fec 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/IEndpointComparerPolicy.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/IEndpointComparerPolicy.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public interface IEndpointComparerPolicy { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/IEndpointSelectorPolicy.cs b/src/Microsoft.AspNetCore.Routing/Matching/IEndpointSelectorPolicy.cs similarity index 87% rename from src/Microsoft.AspNetCore.Routing/Matchers/IEndpointSelectorPolicy.cs rename to src/Microsoft.AspNetCore.Routing/Matching/IEndpointSelectorPolicy.cs index cc6fe09d9c..63fe7dd8fd 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/IEndpointSelectorPolicy.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/IEndpointSelectorPolicy.cs @@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public interface IEndpointSelectorPolicy { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/INodeBuilderPolicy.cs b/src/Microsoft.AspNetCore.Routing/Matching/INodeBuilderPolicy.cs similarity index 91% rename from src/Microsoft.AspNetCore.Routing/Matchers/INodeBuilderPolicy.cs rename to src/Microsoft.AspNetCore.Routing/Matching/INodeBuilderPolicy.cs index 5dab03ceb8..3c32b20aec 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/INodeBuilderPolicy.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/INodeBuilderPolicy.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public interface INodeBuilderPolicy { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/JumpTable.cs b/src/Microsoft.AspNetCore.Routing/Matching/JumpTable.cs similarity index 90% rename from src/Microsoft.AspNetCore.Routing/Matchers/JumpTable.cs rename to src/Microsoft.AspNetCore.Routing/Matching/JumpTable.cs index 781ae4d0d9..860ca80417 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/JumpTable.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/JumpTable.cs @@ -3,7 +3,7 @@ using System.Diagnostics; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { [DebuggerDisplay("{DebuggerToString(),nq}")] internal abstract class JumpTable diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/JumpTableBuilder.cs b/src/Microsoft.AspNetCore.Routing/Matching/JumpTableBuilder.cs similarity index 97% rename from src/Microsoft.AspNetCore.Routing/Matchers/JumpTableBuilder.cs rename to src/Microsoft.AspNetCore.Routing/Matching/JumpTableBuilder.cs index bf2b4ca340..2800b5eca8 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/JumpTableBuilder.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/JumpTableBuilder.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { internal class JumpTableBuilder { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/LinearSearchJumpTable.cs b/src/Microsoft.AspNetCore.Routing/Matching/LinearSearchJumpTable.cs similarity index 97% rename from src/Microsoft.AspNetCore.Routing/Matchers/LinearSearchJumpTable.cs rename to src/Microsoft.AspNetCore.Routing/Matching/LinearSearchJumpTable.cs index 015c168d19..58f8b3d01d 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/LinearSearchJumpTable.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/LinearSearchJumpTable.cs @@ -5,7 +5,7 @@ using System; using System.Linq; using System.Text; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { internal class LinearSearchJumpTable : JumpTable { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/MatchProcessor.cs b/src/Microsoft.AspNetCore.Routing/Matching/MatchProcessor.cs similarity index 92% rename from src/Microsoft.AspNetCore.Routing/Matchers/MatchProcessor.cs rename to src/Microsoft.AspNetCore.Routing/Matching/MatchProcessor.cs index 065ccd8e9b..847ea29793 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/MatchProcessor.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/MatchProcessor.cs @@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public abstract class MatchProcessor { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/MatchProcessorBase.cs b/src/Microsoft.AspNetCore.Routing/Matching/MatchProcessorBase.cs similarity index 96% rename from src/Microsoft.AspNetCore.Routing/Matchers/MatchProcessorBase.cs rename to src/Microsoft.AspNetCore.Routing/Matching/MatchProcessorBase.cs index d3f9db3811..9ac2196671 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/MatchProcessorBase.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/MatchProcessorBase.cs @@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public abstract class MatchProcessorBase : MatchProcessor { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/MatchProcessorFactory.cs b/src/Microsoft.AspNetCore.Routing/Matching/MatchProcessorFactory.cs similarity index 97% rename from src/Microsoft.AspNetCore.Routing/Matchers/MatchProcessorFactory.cs rename to src/Microsoft.AspNetCore.Routing/Matching/MatchProcessorFactory.cs index e21d3bd6ea..5669d75f06 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/MatchProcessorFactory.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/MatchProcessorFactory.cs @@ -5,7 +5,7 @@ using System; using System.Diagnostics; using Microsoft.AspNetCore.Routing.Patterns; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { internal abstract class MatchProcessorFactory { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/Matcher.cs b/src/Microsoft.AspNetCore.Routing/Matching/Matcher.cs similarity index 90% rename from src/Microsoft.AspNetCore.Routing/Matchers/Matcher.cs rename to src/Microsoft.AspNetCore.Routing/Matching/Matcher.cs index d62f8546e1..4a0928d1c6 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/Matcher.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/Matcher.cs @@ -4,11 +4,11 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { /// /// An interface for components that can select an given the current request, as part - /// of the execution of . + /// of the execution of . /// internal abstract class Matcher { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/MatcherBuilder.cs b/src/Microsoft.AspNetCore.Routing/Matching/MatcherBuilder.cs similarity index 87% rename from src/Microsoft.AspNetCore.Routing/Matchers/MatcherBuilder.cs rename to src/Microsoft.AspNetCore.Routing/Matching/MatcherBuilder.cs index 8953f09e75..84c22c59eb 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/MatcherBuilder.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/MatcherBuilder.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { internal abstract class MatcherBuilder { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/MatcherEndpoint.cs b/src/Microsoft.AspNetCore.Routing/Matching/MatcherEndpoint.cs similarity index 97% rename from src/Microsoft.AspNetCore.Routing/Matchers/MatcherEndpoint.cs rename to src/Microsoft.AspNetCore.Routing/Matching/MatcherEndpoint.cs index 4311a28ee7..9dc34cac6a 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/MatcherEndpoint.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/MatcherEndpoint.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing.Patterns; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public sealed class MatcherEndpoint : Endpoint { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/MatcherEndpointComparer.cs b/src/Microsoft.AspNetCore.Routing/Matching/MatcherEndpointComparer.cs similarity index 98% rename from src/Microsoft.AspNetCore.Routing/Matchers/MatcherEndpointComparer.cs rename to src/Microsoft.AspNetCore.Routing/Matching/MatcherEndpointComparer.cs index fb5f087297..a03e81076d 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/MatcherEndpointComparer.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/MatcherEndpointComparer.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Diagnostics; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { // Use to sort and group MatcherEndpoints. // diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/MatcherFactory.cs b/src/Microsoft.AspNetCore.Routing/Matching/MatcherFactory.cs similarity index 86% rename from src/Microsoft.AspNetCore.Routing/Matchers/MatcherFactory.cs rename to src/Microsoft.AspNetCore.Routing/Matching/MatcherFactory.cs index 3975443b0e..b6da9f0915 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/MatcherFactory.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/MatcherFactory.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { internal abstract class MatcherFactory { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/MatcherPolicy.cs b/src/Microsoft.AspNetCore.Routing/Matching/MatcherPolicy.cs similarity index 100% rename from src/Microsoft.AspNetCore.Routing/Matchers/MatcherPolicy.cs rename to src/Microsoft.AspNetCore.Routing/Matching/MatcherPolicy.cs diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/OptionalMatchProcessor.cs b/src/Microsoft.AspNetCore.Routing/Matching/OptionalMatchProcessor.cs similarity index 96% rename from src/Microsoft.AspNetCore.Routing/Matchers/OptionalMatchProcessor.cs rename to src/Microsoft.AspNetCore.Routing/Matching/OptionalMatchProcessor.cs index 9d445e1a44..c40df6ec8e 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/OptionalMatchProcessor.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/OptionalMatchProcessor.cs @@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { internal class OptionalMatchProcessor : MatchProcessor { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/PathSegment.cs b/src/Microsoft.AspNetCore.Routing/Matching/PathSegment.cs similarity index 95% rename from src/Microsoft.AspNetCore.Routing/Matchers/PathSegment.cs rename to src/Microsoft.AspNetCore.Routing/Matching/PathSegment.cs index 24ef150863..a5f570f8b5 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/PathSegment.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/PathSegment.cs @@ -3,7 +3,7 @@ using System; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { internal readonly struct PathSegment : IEquatable { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/PolicyJumpTable.cs b/src/Microsoft.AspNetCore.Routing/Matching/PolicyJumpTable.cs similarity index 90% rename from src/Microsoft.AspNetCore.Routing/Matchers/PolicyJumpTable.cs rename to src/Microsoft.AspNetCore.Routing/Matching/PolicyJumpTable.cs index 0aecc7de6c..e7c5a8f582 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/PolicyJumpTable.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/PolicyJumpTable.cs @@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public abstract class PolicyJumpTable { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/PolicyJumpTableBuilder.cs b/src/Microsoft.AspNetCore.Routing/Matching/PolicyJumpTableBuilder.cs similarity index 95% rename from src/Microsoft.AspNetCore.Routing/Matchers/PolicyJumpTableBuilder.cs rename to src/Microsoft.AspNetCore.Routing/Matching/PolicyJumpTableBuilder.cs index c4e07b1715..f533a9813c 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/PolicyJumpTableBuilder.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/PolicyJumpTableBuilder.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { internal class PolicyJumpTableBuilder { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/PolicyJumpTableEdge.cs b/src/Microsoft.AspNetCore.Routing/Matching/PolicyJumpTableEdge.cs similarity index 91% rename from src/Microsoft.AspNetCore.Routing/Matchers/PolicyJumpTableEdge.cs rename to src/Microsoft.AspNetCore.Routing/Matching/PolicyJumpTableEdge.cs index 62482bb22c..002ffae583 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/PolicyJumpTableEdge.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/PolicyJumpTableEdge.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public readonly struct PolicyJumpTableEdge { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/PolicyNodeEdge.cs b/src/Microsoft.AspNetCore.Routing/Matching/PolicyNodeEdge.cs similarity index 93% rename from src/Microsoft.AspNetCore.Routing/Matchers/PolicyNodeEdge.cs rename to src/Microsoft.AspNetCore.Routing/Matching/PolicyNodeEdge.cs index bde491fa94..2607b33d7e 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/PolicyNodeEdge.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/PolicyNodeEdge.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public readonly struct PolicyNodeEdge { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/RouteConstraintMatchProcessor.cs b/src/Microsoft.AspNetCore.Routing/Matching/RouteConstraintMatchProcessor.cs similarity index 97% rename from src/Microsoft.AspNetCore.Routing/Matchers/RouteConstraintMatchProcessor.cs rename to src/Microsoft.AspNetCore.Routing/Matching/RouteConstraintMatchProcessor.cs index 16fd9d0a84..ad1ddaf7ae 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/RouteConstraintMatchProcessor.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/RouteConstraintMatchProcessor.cs @@ -4,7 +4,7 @@ using System; using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { internal class RouteConstraintMatchProcessor : MatchProcessor { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/SingleEntryJumpTable.cs b/src/Microsoft.AspNetCore.Routing/Matching/SingleEntryJumpTable.cs similarity index 97% rename from src/Microsoft.AspNetCore.Routing/Matchers/SingleEntryJumpTable.cs rename to src/Microsoft.AspNetCore.Routing/Matching/SingleEntryJumpTable.cs index d49513c509..3901807ce5 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/SingleEntryJumpTable.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/SingleEntryJumpTable.cs @@ -3,7 +3,7 @@ using System; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { internal class SingleEntryJumpTable : JumpTable { diff --git a/src/Microsoft.AspNetCore.Routing/Matchers/ZeroEntryJumpTable.cs b/src/Microsoft.AspNetCore.Routing/Matching/ZeroEntryJumpTable.cs similarity index 94% rename from src/Microsoft.AspNetCore.Routing/Matchers/ZeroEntryJumpTable.cs rename to src/Microsoft.AspNetCore.Routing/Matching/ZeroEntryJumpTable.cs index 2c5e271a29..a2100662e1 100644 --- a/src/Microsoft.AspNetCore.Routing/Matchers/ZeroEntryJumpTable.cs +++ b/src/Microsoft.AspNetCore.Routing/Matching/ZeroEntryJumpTable.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { internal class ZeroEntryJumpTable : JumpTable { diff --git a/src/Microsoft.AspNetCore.Routing/NameBasedEndpointFinder.cs b/src/Microsoft.AspNetCore.Routing/NameBasedEndpointFinder.cs index c7879b19ee..b10c2b7934 100644 --- a/src/Microsoft.AspNetCore.Routing/NameBasedEndpointFinder.cs +++ b/src/Microsoft.AspNetCore.Routing/NameBasedEndpointFinder.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; -using Microsoft.AspNetCore.Routing.Matchers; +using Microsoft.AspNetCore.Routing.Matching; using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Routing diff --git a/src/Microsoft.AspNetCore.Routing/Patterns/RoutePatternConstraintReference.cs b/src/Microsoft.AspNetCore.Routing/Patterns/RoutePatternConstraintReference.cs index 0d8c9810bc..088bdce200 100644 --- a/src/Microsoft.AspNetCore.Routing/Patterns/RoutePatternConstraintReference.cs +++ b/src/Microsoft.AspNetCore.Routing/Patterns/RoutePatternConstraintReference.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Diagnostics; -using Microsoft.AspNetCore.Routing.Matchers; +using Microsoft.AspNetCore.Routing.Matching; namespace Microsoft.AspNetCore.Routing.Patterns { @@ -38,7 +38,7 @@ namespace Microsoft.AspNetCore.Routing.Patterns public IRouteConstraint Constraint { get; } /// - /// Gets a pre-existing that was used to construct this reference. + /// Gets a pre-existing that was used to construct this reference. /// public MatchProcessor MatchProcessor { get; } diff --git a/src/Microsoft.AspNetCore.Routing/Patterns/RoutePatternFactory.cs b/src/Microsoft.AspNetCore.Routing/Patterns/RoutePatternFactory.cs index de0b11e889..b0bd70c488 100644 --- a/src/Microsoft.AspNetCore.Routing/Patterns/RoutePatternFactory.cs +++ b/src/Microsoft.AspNetCore.Routing/Patterns/RoutePatternFactory.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Routing.Constraints; -using Microsoft.AspNetCore.Routing.Matchers; +using Microsoft.AspNetCore.Routing.Matching; namespace Microsoft.AspNetCore.Routing.Patterns { diff --git a/src/Microsoft.AspNetCore.Routing/Patterns/RoutePatternMatcher.cs b/src/Microsoft.AspNetCore.Routing/Patterns/RoutePatternMatcher.cs index 6855b8a518..f875b472be 100644 --- a/src/Microsoft.AspNetCore.Routing/Patterns/RoutePatternMatcher.cs +++ b/src/Microsoft.AspNetCore.Routing/Patterns/RoutePatternMatcher.cs @@ -11,7 +11,7 @@ using Microsoft.Extensions.Primitives; namespace Microsoft.AspNetCore.Routing { - public class RoutePatternMatcher + internal class RoutePatternMatcher { private const string SeparatorString = "/"; private const char SeparatorChar = '/'; diff --git a/src/Microsoft.AspNetCore.Routing/Patterns/RoutePatternParameterPart.cs b/src/Microsoft.AspNetCore.Routing/Patterns/RoutePatternParameterPart.cs index 0f9c632fb9..afe2be3096 100644 --- a/src/Microsoft.AspNetCore.Routing/Patterns/RoutePatternParameterPart.cs +++ b/src/Microsoft.AspNetCore.Routing/Patterns/RoutePatternParameterPart.cs @@ -8,7 +8,7 @@ using System.Text; namespace Microsoft.AspNetCore.Routing.Patterns { [DebuggerDisplay("{DebuggerToString()}")] - public class RoutePatternParameterPart : RoutePatternPart + public sealed class RoutePatternParameterPart : RoutePatternPart { internal RoutePatternParameterPart( string parameterName, diff --git a/src/Microsoft.AspNetCore.Routing/RouteValuesBasedEndpointFinderContext.cs b/src/Microsoft.AspNetCore.Routing/RouteValuesAddress.cs similarity index 76% rename from src/Microsoft.AspNetCore.Routing/RouteValuesBasedEndpointFinderContext.cs rename to src/Microsoft.AspNetCore.Routing/RouteValuesAddress.cs index ccc64ee5c6..fd910c3ead 100644 --- a/src/Microsoft.AspNetCore.Routing/RouteValuesBasedEndpointFinderContext.cs +++ b/src/Microsoft.AspNetCore.Routing/RouteValuesAddress.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Routing.EndpointFinders +namespace Microsoft.AspNetCore.Routing { - public class RouteValuesBasedEndpointFinderContext + public class RouteValuesAddress { public string RouteName { get; set; } diff --git a/src/Microsoft.AspNetCore.Routing/RouteValuesBasedEndpointFinder.cs b/src/Microsoft.AspNetCore.Routing/RouteValuesBasedEndpointFinder.cs index e4fc5c16a7..19a24fe439 100644 --- a/src/Microsoft.AspNetCore.Routing/RouteValuesBasedEndpointFinder.cs +++ b/src/Microsoft.AspNetCore.Routing/RouteValuesBasedEndpointFinder.cs @@ -4,16 +4,15 @@ using System; using System.Collections.Generic; using System.Linq; -using Microsoft.AspNetCore.Routing.EndpointFinders; using Microsoft.AspNetCore.Routing.Internal; -using Microsoft.AspNetCore.Routing.Matchers; +using Microsoft.AspNetCore.Routing.Matching; using Microsoft.AspNetCore.Routing.Template; using Microsoft.AspNetCore.Routing.Tree; using Microsoft.Extensions.ObjectPool; namespace Microsoft.AspNetCore.Routing { - internal class RouteValuesBasedEndpointFinder : IEndpointFinder + internal class RouteValuesBasedEndpointFinder : IEndpointFinder { private readonly CompositeEndpointDataSource _endpointDataSource; private readonly ObjectPool _objectPool; @@ -36,16 +35,16 @@ namespace Microsoft.AspNetCore.Routing HandleChange); } - public IEnumerable FindEndpoints(RouteValuesBasedEndpointFinderContext context) + public IEnumerable FindEndpoints(RouteValuesAddress address) { IEnumerable matchResults = null; - if (string.IsNullOrEmpty(context.RouteName)) + if (string.IsNullOrEmpty(address.RouteName)) { matchResults = _allMatchesLinkGenerationTree.GetMatches( - context.ExplicitValues, - context.AmbientValues); + address.ExplicitValues, + address.AmbientValues); } - else if (_namedMatchResults.TryGetValue(context.RouteName, out var namedMatchResults)) + else if (_namedMatchResults.TryGetValue(address.RouteName, out var namedMatchResults)) { matchResults = namedMatchResults; } diff --git a/src/Microsoft.AspNetCore.Routing/Tree/InboundRouteEntry.cs b/src/Microsoft.AspNetCore.Routing/Tree/InboundRouteEntry.cs index 63ea99be2f..7c4a5f0abc 100644 --- a/src/Microsoft.AspNetCore.Routing/Tree/InboundRouteEntry.cs +++ b/src/Microsoft.AspNetCore.Routing/Tree/InboundRouteEntry.cs @@ -52,8 +52,5 @@ namespace Microsoft.AspNetCore.Routing.Tree /// Gets or sets the . /// public RouteTemplate RouteTemplate { get; set; } - - // REVIEW: temporary change to enable reusing the tree router - public object Tag { get; set; } } } diff --git a/test/Microsoft.AspNetCore.Mvc.Routing.Abstractions.Tests/EndpointMetadataCollectionTests.cs b/test/Microsoft.AspNetCore.Mvc.Routing.Abstractions.Tests/EndpointMetadataCollectionTests.cs new file mode 100644 index 0000000000..a7e645c047 --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Routing.Abstractions.Tests/EndpointMetadataCollectionTests.cs @@ -0,0 +1,48 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Text; +using Xunit; + +namespace Microsoft.AspNetCore.Routing +{ + public class EndpointMetadataCollectionTests + { + [Fact] + public void Constructor_Enumeration_ContainsValues() + { + // Arrange & Act + var metadata = new EndpointMetadataCollection(new List + { + 1, + 2, + 3, + }); + + // Assert + Assert.Equal(3, metadata.Count); + + Assert.Collection(metadata, + value => Assert.Equal(1, value), + value => Assert.Equal(2, value), + value => Assert.Equal(3, value)); + } + + [Fact] + public void Constructor_ParamsArray_ContainsValues() + { + // Arrange & Act + var metadata = new EndpointMetadataCollection(1, 2, 3); + + // Assert + Assert.Equal(3, metadata.Count); + + Assert.Collection(metadata, + value => Assert.Equal(1, value), + value => Assert.Equal(2, value), + value => Assert.Equal(3, value)); + } + } +} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Routing.FunctionalTests/Benchmarks/GlobalRoutingBenchmarkTest.cs b/test/Microsoft.AspNetCore.Routing.FunctionalTests/Benchmarks/EndpointRoutingBenchmarkTest.cs similarity index 87% rename from test/Microsoft.AspNetCore.Routing.FunctionalTests/Benchmarks/GlobalRoutingBenchmarkTest.cs rename to test/Microsoft.AspNetCore.Routing.FunctionalTests/Benchmarks/EndpointRoutingBenchmarkTest.cs index 54b8d75073..2e39f5846c 100644 --- a/test/Microsoft.AspNetCore.Routing.FunctionalTests/Benchmarks/GlobalRoutingBenchmarkTest.cs +++ b/test/Microsoft.AspNetCore.Routing.FunctionalTests/Benchmarks/EndpointRoutingBenchmarkTest.cs @@ -11,20 +11,20 @@ using Xunit; namespace Microsoft.AspNetCore.Routing.FunctionalTests { - public class GlobalRoutingBenchmarkTest : IDisposable + public class EndpointRoutingBenchmarkTest : IDisposable { private readonly HttpClient _client; private readonly TestServer _testServer; - public GlobalRoutingBenchmarkTest() + public EndpointRoutingBenchmarkTest() { // This switch and value are set by benchmark server when running the app for profiling. - var args = new[] { "--scenarios", "PlaintextGlobalRouting" }; + var args = new[] { "--scenarios", "PlaintextEndpointRouting" }; var webHostBuilder = Benchmarks.Program.GetWebHostBuilder(args); // Make sure we are using the right startup var startupName = webHostBuilder.GetSetting("Startup"); - Assert.Equal(nameof(Benchmarks.StartupUsingGlobalRouting), startupName); + Assert.Equal(nameof(Benchmarks.StartupUsingEndpointRouting), startupName); _testServer = new TestServer(webHostBuilder); _client = _testServer.CreateClient(); diff --git a/test/Microsoft.AspNetCore.Routing.FunctionalTests/GlobalRoutingSampleTest.cs b/test/Microsoft.AspNetCore.Routing.FunctionalTests/EndpointRoutingSampleTest.cs similarity index 94% rename from test/Microsoft.AspNetCore.Routing.FunctionalTests/GlobalRoutingSampleTest.cs rename to test/Microsoft.AspNetCore.Routing.FunctionalTests/EndpointRoutingSampleTest.cs index 1ea832e806..5f059cae60 100644 --- a/test/Microsoft.AspNetCore.Routing.FunctionalTests/GlobalRoutingSampleTest.cs +++ b/test/Microsoft.AspNetCore.Routing.FunctionalTests/EndpointRoutingSampleTest.cs @@ -11,14 +11,14 @@ using Xunit; namespace Microsoft.AspNetCore.Routing.FunctionalTests { - public class GlobalRoutingSampleTest : IDisposable + public class EndpointRoutingSampleTest : IDisposable { private readonly HttpClient _client; private readonly TestServer _testServer; - public GlobalRoutingSampleTest() + public EndpointRoutingSampleTest() { - var webHostBuilder = Program.GetWebHostBuilder(new[] { Program.GlobalRoutingScenario, }); + var webHostBuilder = Program.GetWebHostBuilder(new[] { Program.EndpointRoutingScenario, }); _testServer = new TestServer(webHostBuilder); _client = _testServer.CreateClient(); _client.BaseAddress = new Uri("http://localhost"); @@ -29,7 +29,7 @@ namespace Microsoft.AspNetCore.Routing.FunctionalTests { // Arrange var expectedContentType = "text/plain"; - var expectedContent = "Global Routing sample endpoints:" + Environment.NewLine + "/plaintext"; + var expectedContent = "Endpoint Routing sample endpoints:" + Environment.NewLine + "/plaintext"; // Act var response = await _client.GetAsync("/"); diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Builder/GlobalRoutingBuilderExtensionsTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/Builder/EndpointRoutingBuilderExtensionsTest.cs similarity index 82% rename from test/Microsoft.AspNetCore.Routing.Tests/Builder/GlobalRoutingBuilderExtensionsTest.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Builder/EndpointRoutingBuilderExtensionsTest.cs index 410be22666..dd85fb11f6 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Builder/GlobalRoutingBuilderExtensionsTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Builder/EndpointRoutingBuilderExtensionsTest.cs @@ -5,6 +5,7 @@ using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder.Internal; using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Internal; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; using Moq; @@ -12,16 +13,16 @@ using Xunit; namespace Microsoft.AspNetCore.Builder { - public class GlobalRoutingBuilderExtensionsTest + public class EndpointRoutingBuilderExtensionsTest { [Fact] - public void UseGlobalRouting_ServicesNotRegistered_Throws() + public void UseEndpointRouting_ServicesNotRegistered_Throws() { // Arrange var app = new ApplicationBuilder(Mock.Of()); // Act - var ex = Assert.Throws(() => app.UseGlobalRouting()); + var ex = Assert.Throws(() => app.UseEndpointRouting()); // Assert Assert.Equal( @@ -49,14 +50,14 @@ namespace Microsoft.AspNetCore.Builder } [Fact] - public async Task UseGlobalRouting_ServicesRegistered_SetsFeature() + public async Task UseEndpointRouting_ServicesRegistered_SetsFeature() { // Arrange var services = CreateServices(); var app = new ApplicationBuilder(services); - app.UseGlobalRouting(); + app.UseEndpointRouting(); var appFunc = app.Build(); var httpContext = new DefaultHttpContext(); @@ -81,21 +82,21 @@ namespace Microsoft.AspNetCore.Builder // Assert Assert.Equal( - "GlobalRoutingMiddleware must be added to the request execution pipeline before EndpointMiddleware. " + - "Please add GlobalRoutingMiddleware by calling 'IApplicationBuilder.UseGlobalRouting' " + + "EndpointRoutingMiddleware must be added to the request execution pipeline before EndpointMiddleware. " + + "Please add EndpointRoutingMiddleware by calling 'IApplicationBuilder.UseEndpointRouting' " + "inside the call to 'Configure(...)' in the application startup code.", ex.Message); } [Fact] - public async Task UseEndpoint_ServicesRegisteredAndGlobalRoutingRegistered_SetsFeature() + public async Task UseEndpoint_ServicesRegisteredAndEndpointRoutingRegistered_SetsFeature() { // Arrange var services = CreateServices(); var app = new ApplicationBuilder(services); - app.UseGlobalRouting(); + app.UseEndpointRouting(); app.UseEndpoint(); var appFunc = app.Build(); diff --git a/test/Microsoft.AspNetCore.Routing.Tests/CompositeEndpointDataSourceTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/CompositeEndpointDataSourceTest.cs index 0e18453df9..dad43417ab 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/CompositeEndpointDataSourceTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/CompositeEndpointDataSourceTest.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -using Microsoft.AspNetCore.Routing.Matchers; +using Microsoft.AspNetCore.Routing.Matching; using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.AspNetCore.Routing.TestObjects; using Microsoft.Extensions.Primitives; diff --git a/test/Microsoft.AspNetCore.Routing.Tests/DefaultEndpointDataSourceTests.cs b/test/Microsoft.AspNetCore.Routing.Tests/DefaultEndpointDataSourceTests.cs new file mode 100644 index 0000000000..6e46dea578 --- /dev/null +++ b/test/Microsoft.AspNetCore.Routing.Tests/DefaultEndpointDataSourceTests.cs @@ -0,0 +1,45 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.AspNetCore.Routing.TestObjects; +using System; +using System.Collections.Generic; +using System.Text; +using Xunit; + +namespace Microsoft.AspNetCore.Routing +{ + public class DefaultEndpointDataSourceTests + { + [Fact] + public void Constructor_Params_EndpointsInitialized() + { + // Arrange & Act + var dataSource = new DefaultEndpointDataSource( + new TestEndpoint(EndpointMetadataCollection.Empty, "1"), + new TestEndpoint(EndpointMetadataCollection.Empty, "2") + ); + + // Assert + Assert.Collection(dataSource.Endpoints, + endpoint => Assert.Equal("1", endpoint.DisplayName), + endpoint => Assert.Equal("2", endpoint.DisplayName)); + } + + [Fact] + public void Constructor_Enumerable_EndpointsInitialized() + { + // Arrange & Act + var dataSource = new DefaultEndpointDataSource(new List + { + new TestEndpoint(EndpointMetadataCollection.Empty, "1"), + new TestEndpoint(EndpointMetadataCollection.Empty, "2") + }); + + // Assert + Assert.Collection(dataSource.Endpoints, + endpoint => Assert.Equal("1", endpoint.DisplayName), + endpoint => Assert.Equal("2", endpoint.DisplayName)); + } + } +} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Routing.Tests/DefaultLinkGeneratorTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/DefaultLinkGeneratorTest.cs index d74d2eff48..6c5a47116e 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/DefaultLinkGeneratorTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/DefaultLinkGeneratorTest.cs @@ -6,9 +6,8 @@ using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing.Constraints; -using Microsoft.AspNetCore.Routing.EndpointFinders; using Microsoft.AspNetCore.Routing.Internal; -using Microsoft.AspNetCore.Routing.Matchers; +using Microsoft.AspNetCore.Routing.Matching; using Microsoft.AspNetCore.Routing.TestObjects; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.ObjectPool; @@ -26,15 +25,15 @@ namespace Microsoft.AspNetCore.Routing // Arrange var endpoint = EndpointFactory.CreateMatcherEndpoint("{controller}"); var linkGenerator = CreateLinkGenerator(); - var context = CreateRouteValuesContext(new { controller = "Home" }); + var address = CreateRouteValuesAddress(new { controller = "Home" }); // Act var link = linkGenerator.GetLink( new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -48,7 +47,7 @@ namespace Microsoft.AspNetCore.Routing var expectedMessage = "Could not find a matching endpoint to generate a link."; var endpoint = EndpointFactory.CreateMatcherEndpoint("{controller}/{action}"); var linkGenerator = CreateLinkGenerator(); - var context = CreateRouteValuesContext(new { controller = "Home" }); + var address = CreateRouteValuesAddress(new { controller = "Home" }); // Act & Assert var exception = Assert.Throws( @@ -56,8 +55,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues })); Assert.Equal(expectedMessage, exception.Message); } @@ -68,15 +67,15 @@ namespace Microsoft.AspNetCore.Routing // Arrange var endpoint = EndpointFactory.CreateMatcherEndpoint("{controller}/{action}"); var linkGenerator = CreateLinkGenerator(); - var context = CreateRouteValuesContext(new { controller = "Home" }); + var address = CreateRouteValuesAddress(new { controller = "Home" }); // Act var canGenerateLink = linkGenerator.TryGetLink( new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }, out var link); @@ -93,15 +92,15 @@ namespace Microsoft.AspNetCore.Routing var endpoint2 = EndpointFactory.CreateMatcherEndpoint("{controller}/{action}"); var endpoint3 = EndpointFactory.CreateMatcherEndpoint("{controller}"); var linkGenerator = CreateLinkGenerator(); - var context = CreateRouteValuesContext(new { controller = "Home", action = "Index", id = "10" }); + var address = CreateRouteValuesAddress(new { controller = "Home", action = "Index", id = "10" }); // Act var link = linkGenerator.GetLink( new LinkGeneratorContext { Endpoints = new[] { endpoint1, endpoint2, endpoint3 }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -116,15 +115,15 @@ namespace Microsoft.AspNetCore.Routing var endpoint2 = EndpointFactory.CreateMatcherEndpoint("{controller}/{action}"); var endpoint3 = EndpointFactory.CreateMatcherEndpoint("{controller}"); var linkGenerator = CreateLinkGenerator(); - var context = CreateRouteValuesContext(new { controller = "Home", action = "Index" }); + var address = CreateRouteValuesAddress(new { controller = "Home", action = "Index" }); // Act var link = linkGenerator.GetLink( new LinkGeneratorContext { Endpoints = new[] { endpoint1, endpoint2, endpoint3 }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -137,7 +136,7 @@ namespace Microsoft.AspNetCore.Routing // Arrange var endpoint = EndpointFactory.CreateMatcherEndpoint("{controller}/{action}"); var linkGenerator = CreateLinkGenerator(); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { name = "name with %special #characters" }, ambientValues: new { controller = "Home", action = "Index" }); @@ -146,8 +145,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -160,7 +159,7 @@ namespace Microsoft.AspNetCore.Routing // Arrange var endpoint = EndpointFactory.CreateMatcherEndpoint("{controller}/{action}"); var linkGenerator = CreateLinkGenerator(); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( new { color = new List { "red", "green", "blue" } }, new { controller = "Home", action = "Index" }); @@ -169,8 +168,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -183,7 +182,7 @@ namespace Microsoft.AspNetCore.Routing // Arrange var endpoint = EndpointFactory.CreateMatcherEndpoint("{controller}/{action}"); var linkGenerator = CreateLinkGenerator(); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( new { items = new List { 10, 20, 30 } }, new { controller = "Home", action = "Index" }); @@ -192,8 +191,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -206,7 +205,7 @@ namespace Microsoft.AspNetCore.Routing // Arrange var endpoint = EndpointFactory.CreateMatcherEndpoint("{controller}/{action}"); var linkGenerator = CreateLinkGenerator(); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( new { color = new List { } }, new { controller = "Home", action = "Index" }); @@ -215,8 +214,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -229,7 +228,7 @@ namespace Microsoft.AspNetCore.Routing // Arrange var endpoint = EndpointFactory.CreateMatcherEndpoint("{controller}/{action}"); var linkGenerator = CreateLinkGenerator(); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( new { page = 1, color = new List { "red", "green", "blue" }, message = "textfortest" }, new { controller = "Home", action = "Index" }); @@ -238,8 +237,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -252,7 +251,7 @@ namespace Microsoft.AspNetCore.Routing // Arrange var endpoint = EndpointFactory.CreateMatcherEndpoint("{controller}/{action}"); var linkGenerator = CreateLinkGenerator(); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "Index" }, ambientValues: new { controller = "Home" }); @@ -261,8 +260,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -275,7 +274,7 @@ namespace Microsoft.AspNetCore.Routing // Arrange var endpoint = EndpointFactory.CreateMatcherEndpoint("{controller}/{action}"); var linkGenerator = CreateLinkGenerator(new RouteOptions() { LowercaseUrls = true }); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "Index" }, ambientValues: new { controller = "Home" }); @@ -284,8 +283,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -299,7 +298,7 @@ namespace Microsoft.AspNetCore.Routing var endpoint = EndpointFactory.CreateMatcherEndpoint("{controller}/{action}"); var linkGenerator = CreateLinkGenerator( new RouteOptions() { LowercaseUrls = true, LowercaseQueryStrings = true }); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "Index", ShowStatus = "True", INFO = "DETAILED" }, ambientValues: new { controller = "Home" }); @@ -308,8 +307,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -323,7 +322,7 @@ namespace Microsoft.AspNetCore.Routing var endpoint = EndpointFactory.CreateMatcherEndpoint("{controller}/{action}"); var linkGenerator = CreateLinkGenerator( new RouteOptions() { LowercaseUrls = false, LowercaseQueryStrings = true }); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "Index", ShowStatus = "True", INFO = "DETAILED" }, ambientValues: new { controller = "Home" }); @@ -332,8 +331,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -346,7 +345,7 @@ namespace Microsoft.AspNetCore.Routing // Arrange var endpoint = EndpointFactory.CreateMatcherEndpoint("{controller}/{action}"); var linkGenerator = CreateLinkGenerator(new RouteOptions() { AppendTrailingSlash = true }); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "Index" }, ambientValues: new { controller = "Home" }); @@ -355,8 +354,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -370,7 +369,7 @@ namespace Microsoft.AspNetCore.Routing var endpoint = EndpointFactory.CreateMatcherEndpoint("{controller}/{action}"); var linkGenerator = CreateLinkGenerator( new RouteOptions() { LowercaseUrls = true, LowercaseQueryStrings = true, AppendTrailingSlash = true }); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "Index", ShowStatus = "True", INFO = "DETAILED" }, ambientValues: new { controller = "Home" }); @@ -379,8 +378,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -393,7 +392,7 @@ namespace Microsoft.AspNetCore.Routing // Arrange var endpoint = EndpointFactory.CreateMatcherEndpoint("{controller}/{action}"); var linkGenerator = CreateLinkGenerator(new RouteOptions() { LowercaseUrls = true }); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "InDex" }, ambientValues: new { controller = "HoMe" }); @@ -402,8 +401,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues, + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues, LowercaseUrls = false }); @@ -417,7 +416,7 @@ namespace Microsoft.AspNetCore.Routing // Arrange var endpoint = EndpointFactory.CreateMatcherEndpoint("{controller}/{action}"); var linkGenerator = CreateLinkGenerator(new RouteOptions() { LowercaseUrls = false }); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "InDex" }, ambientValues: new { controller = "HoMe" }); @@ -426,8 +425,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues, + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues, LowercaseUrls = true }); @@ -442,7 +441,7 @@ namespace Microsoft.AspNetCore.Routing var endpoint = EndpointFactory.CreateMatcherEndpoint("{controller}/{action}"); var linkGenerator = CreateLinkGenerator( new RouteOptions() { LowercaseUrls = true, LowercaseQueryStrings = true }); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "Index", ShowStatus = "True", INFO = "DETAILED" }, ambientValues: new { controller = "Home" }); @@ -451,8 +450,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues, + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues, LowercaseUrls = false, LowercaseQueryStrings = false }); @@ -468,7 +467,7 @@ namespace Microsoft.AspNetCore.Routing var endpoint = EndpointFactory.CreateMatcherEndpoint("{controller}/{action}"); var linkGenerator = CreateLinkGenerator( new RouteOptions() { LowercaseUrls = false, LowercaseQueryStrings = false }); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "Index", ShowStatus = "True", INFO = "DETAILED" }, ambientValues: new { controller = "Home" }); @@ -477,8 +476,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues, + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues, LowercaseUrls = true, LowercaseQueryStrings = true }); @@ -493,7 +492,7 @@ namespace Microsoft.AspNetCore.Routing // Arrange var endpoint = EndpointFactory.CreateMatcherEndpoint("{controller}/{action}"); var linkGenerator = CreateLinkGenerator(new RouteOptions() { AppendTrailingSlash = false }); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "Index" }, ambientValues: new { controller = "Home" }); @@ -502,8 +501,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues, + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues, AppendTrailingSlash = true }); @@ -515,7 +514,7 @@ namespace Microsoft.AspNetCore.Routing public void RouteGenerationRejectsConstraints() { // Arrange - var context = CreateRouteValuesContext(new { p1 = "abcd" }); + var address = CreateRouteValuesAddress(new { p1 = "abcd" }); var linkGenerator = CreateLinkGenerator(); var endpoint = EndpointFactory.CreateMatcherEndpoint( @@ -529,8 +528,8 @@ namespace Microsoft.AspNetCore.Routing { HttpContext = new DefaultHttpContext(), Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }, out var link); @@ -542,7 +541,7 @@ namespace Microsoft.AspNetCore.Routing public void RouteGenerationAcceptsConstraints() { // Arrange - var context = CreateRouteValuesContext(new { p1 = "hello", p2 = "1234" }); + var address = CreateRouteValuesAddress(new { p1 = "hello", p2 = "1234" }); var linkGenerator = CreateLinkGenerator(); var endpoint = EndpointFactory.CreateMatcherEndpoint( @@ -556,8 +555,8 @@ namespace Microsoft.AspNetCore.Routing { HttpContext = new DefaultHttpContext(), Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }, out var link); @@ -570,7 +569,7 @@ namespace Microsoft.AspNetCore.Routing public void RouteWithCatchAllRejectsConstraints() { // Arrange - var context = CreateRouteValuesContext(new { p1 = "abcd" }); + var address = CreateRouteValuesAddress(new { p1 = "abcd" }); var linkGenerator = CreateLinkGenerator(); var endpoint = EndpointFactory.CreateMatcherEndpoint( @@ -584,8 +583,8 @@ namespace Microsoft.AspNetCore.Routing { HttpContext = new DefaultHttpContext(), Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }, out var link); @@ -597,7 +596,7 @@ namespace Microsoft.AspNetCore.Routing public void RouteWithCatchAllAcceptsConstraints() { // Arrange - var context = CreateRouteValuesContext(new { p1 = "hello", p2 = "1234" }); + var address = CreateRouteValuesAddress(new { p1 = "hello", p2 = "1234" }); var linkGenerator = CreateLinkGenerator(); var endpoint = EndpointFactory.CreateMatcherEndpoint( @@ -611,8 +610,8 @@ namespace Microsoft.AspNetCore.Routing { HttpContext = new DefaultHttpContext(), Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }, out var link); @@ -625,7 +624,7 @@ namespace Microsoft.AspNetCore.Routing public void GetLinkWithNonParameterConstraintReturnsUrlWithoutQueryString() { // Arrange - var context = CreateRouteValuesContext(new { p1 = "hello", p2 = "1234" }); + var address = CreateRouteValuesAddress(new { p1 = "hello", p2 = "1234" }); var linkGenerator = CreateLinkGenerator(); var target = new Mock(); target @@ -650,8 +649,8 @@ namespace Microsoft.AspNetCore.Routing { HttpContext = new DefaultHttpContext(), Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }, out var link); @@ -674,7 +673,7 @@ namespace Microsoft.AspNetCore.Routing defaults: new { controller = "Home", action = "Store" }, constraints: new { c = constraint }); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "Store" }, ambientValues: new { controller = "Home", action = "Blog", extra = "42" }); @@ -687,8 +686,8 @@ namespace Microsoft.AspNetCore.Routing { HttpContext = new DefaultHttpContext(), Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }, out var link); @@ -711,7 +710,7 @@ namespace Microsoft.AspNetCore.Routing defaults: new { controller = "Home", action = "Store", otherthing = "17" }, constraints: new { c = constraint }); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "Store" }, ambientValues: new { controller = "Home", action = "Blog" }); @@ -724,8 +723,8 @@ namespace Microsoft.AspNetCore.Routing { HttpContext = new DefaultHttpContext(), Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -745,7 +744,7 @@ namespace Microsoft.AspNetCore.Routing defaults: new { action = "Index" }, constraints: new { c = constraint, }); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { controller = "Shopping" }, ambientValues: new { controller = "Home", action = "Blog" }); @@ -758,8 +757,8 @@ namespace Microsoft.AspNetCore.Routing { HttpContext = new DefaultHttpContext(), Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -780,7 +779,7 @@ namespace Microsoft.AspNetCore.Routing defaults: new { controller = "Home", action = "Store", otherthing = "17", thirdthing = "13" }, constraints: new { c = constraint, }); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "Store", thirdthing = "13" }, ambientValues: new { controller = "Home", action = "Blog", otherthing = "17" }); @@ -793,8 +792,8 @@ namespace Microsoft.AspNetCore.Routing { HttpContext = new DefaultHttpContext(), Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -812,7 +811,7 @@ namespace Microsoft.AspNetCore.Routing defaults: new { controller = "Home", action = "Index" }, constraints: new { }); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "Index", controller = "Home", id = 4 }); // Act @@ -821,8 +820,8 @@ namespace Microsoft.AspNetCore.Routing { HttpContext = new DefaultHttpContext(), Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -839,7 +838,7 @@ namespace Microsoft.AspNetCore.Routing defaults: new { controller = "Home", action = "Index" }, constraints: new { id = "int" }); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "Index", controller = "Home", id = "not-an-integer" }); // Act @@ -848,8 +847,8 @@ namespace Microsoft.AspNetCore.Routing { HttpContext = new DefaultHttpContext(), Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }, out var link); @@ -866,7 +865,7 @@ namespace Microsoft.AspNetCore.Routing template: "Home/Index/{id:int?}", defaults: new { controller = "Home", action = "Index" }, constraints: new { }); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "Index", controller = "Home", id = 98 }); // Act @@ -875,8 +874,8 @@ namespace Microsoft.AspNetCore.Routing { HttpContext = new DefaultHttpContext(), Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -893,7 +892,7 @@ namespace Microsoft.AspNetCore.Routing defaults: new { controller = "Home", action = "Index" }, constraints: new { id = "int" }); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "Index", controller = "Home" }); // Act @@ -902,8 +901,8 @@ namespace Microsoft.AspNetCore.Routing { HttpContext = new DefaultHttpContext(), Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -920,7 +919,7 @@ namespace Microsoft.AspNetCore.Routing defaults: new { controller = "Home", action = "Index" }, constraints: new { id = "int" }); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "Index", controller = "Home", id = "not-an-integer" }); // Act @@ -929,8 +928,8 @@ namespace Microsoft.AspNetCore.Routing { HttpContext = new DefaultHttpContext(), Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }, out var link); @@ -948,7 +947,7 @@ namespace Microsoft.AspNetCore.Routing defaults: new { controller = "Home", action = "Index" }, constraints: new { }); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "Index", controller = "Home", id = 14 }); // Act @@ -957,8 +956,8 @@ namespace Microsoft.AspNetCore.Routing { HttpContext = new DefaultHttpContext(), Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -975,7 +974,7 @@ namespace Microsoft.AspNetCore.Routing defaults: new { controller = "Home", action = "Index" }, constraints: new { }); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "Index", controller = "Home", id = 50 }); // Act @@ -984,8 +983,8 @@ namespace Microsoft.AspNetCore.Routing { HttpContext = new DefaultHttpContext(), Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }, out var link); @@ -1004,7 +1003,7 @@ namespace Microsoft.AspNetCore.Routing defaults: new { controller = "Home", action = "Index" }, constraints: new { name = constraint }); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "Index", controller = "Home", name = "products" }); // Act @@ -1013,8 +1012,8 @@ namespace Microsoft.AspNetCore.Routing { HttpContext = new DefaultHttpContext(), Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -1027,7 +1026,7 @@ namespace Microsoft.AspNetCore.Routing // Arrange var endpoint = EndpointFactory.CreateMatcherEndpoint("{controller}/{action}/{name?}"); var linkGenerator = CreateLinkGenerator(); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "Index", controller = "Home", name = "products" }); // Act @@ -1035,8 +1034,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -1049,7 +1048,7 @@ namespace Microsoft.AspNetCore.Routing // Arrange var endpoint = EndpointFactory.CreateMatcherEndpoint("{controller}/{action}/{name?}"); var linkGenerator = CreateLinkGenerator(); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "Index", controller = "Home" }); // Act @@ -1057,8 +1056,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -1073,7 +1072,7 @@ namespace Microsoft.AspNetCore.Routing template: "{controller}/{action}/{name}", defaults: new { name = "default-products" }); var linkGenerator = CreateLinkGenerator(); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "Index", controller = "Home", name = "products" }); // Act @@ -1081,8 +1080,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -1097,7 +1096,7 @@ namespace Microsoft.AspNetCore.Routing template: "{controller}/{action}/{name}", defaults: new { name = "products" }); var linkGenerator = CreateLinkGenerator(); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "Index", controller = "Home" }); // Act @@ -1105,8 +1104,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -1119,7 +1118,7 @@ namespace Microsoft.AspNetCore.Routing // Arrange var endpoint = EndpointFactory.CreateMatcherEndpoint("{controller}/{action}/{name}"); var linkGenerator = CreateLinkGenerator(); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "Index", controller = "Home", name = "products", format = "json" }); // Act @@ -1127,8 +1126,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -1143,7 +1142,7 @@ namespace Microsoft.AspNetCore.Routing var endpoint = EndpointFactory.CreateMatcherEndpoint( template: "{controller}/{action}/.{name?}"); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "Index", controller = "Home", name = "products" }); // Act @@ -1152,8 +1151,8 @@ namespace Microsoft.AspNetCore.Routing { HttpContext = new DefaultHttpContext(), Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -1167,7 +1166,7 @@ namespace Microsoft.AspNetCore.Routing var linkGenerator = CreateLinkGenerator(); var endpoint = EndpointFactory.CreateMatcherEndpoint("{controller}/{action}/.{name?}"); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "Index", controller = "Home" }); // Act @@ -1176,8 +1175,8 @@ namespace Microsoft.AspNetCore.Routing { HttpContext = new DefaultHttpContext(), Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -1190,7 +1189,7 @@ namespace Microsoft.AspNetCore.Routing // Arrange var endpoint = EndpointFactory.CreateMatcherEndpoint("{controller}/{action}/{name?}"); var linkGenerator = CreateLinkGenerator(); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { action = "Index", controller = "Home" }); // Act @@ -1198,8 +1197,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -1212,7 +1211,7 @@ namespace Microsoft.AspNetCore.Routing // Arrange var endpoint = EndpointFactory.CreateMatcherEndpoint("a/{b=15}/{c?}/{d?}"); var linkGenerator = CreateLinkGenerator(); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { }, ambientValues: new { c = "17" }); @@ -1221,8 +1220,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -1235,7 +1234,7 @@ namespace Microsoft.AspNetCore.Routing // Arrange var endpoint = EndpointFactory.CreateMatcherEndpoint("a/{b=15}/{c?}"); var linkGenerator = CreateLinkGenerator(); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { }, ambientValues: new { c = "17" }); @@ -1244,8 +1243,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -1258,7 +1257,7 @@ namespace Microsoft.AspNetCore.Routing // Arrange var endpoint = EndpointFactory.CreateMatcherEndpoint("a/{b=15}/{c?}/{d?}"); var linkGenerator = CreateLinkGenerator(); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { }, ambientValues: new { d = "17" }); @@ -1267,8 +1266,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }); // Assert @@ -1362,7 +1361,7 @@ namespace Microsoft.AspNetCore.Routing requiredValues: requiredValues, defaults: defaults); var linkGenerator = CreateLinkGenerator(); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: explicitValues, ambientValues: ambientValues); @@ -1371,8 +1370,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }, out var link); @@ -1392,7 +1391,7 @@ namespace Microsoft.AspNetCore.Routing requiredValues: new { c = "Products", a = "Edit" }, defaults: new { c = "Products", a = "Edit" }); var linkGenerator = CreateLinkGenerator(); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { c = "Products", a = "Edit" }, ambientValues: new { c = "Products", a = "Edit", id = 10 }); @@ -1401,8 +1400,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }, out var link); @@ -1422,7 +1421,7 @@ namespace Microsoft.AspNetCore.Routing requiredValues: new { c = "Products", a = "Edit" }, defaults: new { c = "Products", a = "Edit" }); var linkGenerator = CreateLinkGenerator(); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: new { c = "Products", a = "List" }, ambientValues: new { c = "Products", a = "Edit", id = 10 }); @@ -1431,8 +1430,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }, out var link); @@ -1534,7 +1533,7 @@ namespace Microsoft.AspNetCore.Routing requiredValues: requiredValues, defaults: defaults); var linkGenerator = CreateLinkGenerator(); - var context = CreateRouteValuesContext( + var address = CreateRouteValuesAddress( explicitValues: explicitValues, ambientValues: ambientValues); @@ -1543,8 +1542,8 @@ namespace Microsoft.AspNetCore.Routing new LinkGeneratorContext { Endpoints = new[] { endpoint }, - ExplicitValues = context.ExplicitValues, - AmbientValues = context.AmbientValues + ExplicitValues = address.ExplicitValues, + AmbientValues = address.AmbientValues }, out var link); @@ -1553,14 +1552,14 @@ namespace Microsoft.AspNetCore.Routing Assert.Null(link); } - private RouteValuesBasedEndpointFinderContext CreateRouteValuesContext( + private RouteValuesAddress CreateRouteValuesAddress( object explicitValues, object ambientValues = null) { - var context = new RouteValuesBasedEndpointFinderContext(); - context.ExplicitValues = new RouteValueDictionary(explicitValues); - context.AmbientValues = new RouteValueDictionary(ambientValues); - return context; + var address = new RouteValuesAddress(); + address.ExplicitValues = new RouteValueDictionary(explicitValues); + address.AmbientValues = new RouteValueDictionary(ambientValues); + return address; } private LinkGenerator CreateLinkGenerator(RouteOptions routeOptions = null) diff --git a/test/Microsoft.AspNetCore.Routing.Tests/EndpointFactory.cs b/test/Microsoft.AspNetCore.Routing.Tests/EndpointFactory.cs index 6286e2781f..6711ff64d6 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/EndpointFactory.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/EndpointFactory.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using Microsoft.AspNetCore.Routing.Matchers; +using Microsoft.AspNetCore.Routing.Matching; using Microsoft.AspNetCore.Routing.Patterns; namespace Microsoft.AspNetCore.Routing diff --git a/test/Microsoft.AspNetCore.Routing.Tests/EndpointMiddlewareTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/EndpointMiddlewareTest.cs index 0d861dd218..1cb5427736 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/EndpointMiddlewareTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/EndpointMiddlewareTest.cs @@ -35,8 +35,8 @@ namespace Microsoft.AspNetCore.Routing var ex = await Assert.ThrowsAsync(async () => await invokeTask); Assert.Equal( - "Unable to execute an endpoint because the GlobalRoutingMiddleware was not run for this request. " + - "Ensure GlobalRoutingMiddleware is added to the request execution pipeline before EndpointMiddleware " + + "Unable to execute an endpoint because the EndpointRoutingMiddleware was not run for this request. " + + "Ensure EndpointRoutingMiddleware is added to the request execution pipeline before EndpointMiddleware " + "in application startup code.", ex.Message); } diff --git a/test/Microsoft.AspNetCore.Routing.Tests/GlobalRoutingMiddlewareTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/EndpointRoutingMiddlewareTest.cs similarity index 85% rename from test/Microsoft.AspNetCore.Routing.Tests/GlobalRoutingMiddlewareTest.cs rename to test/Microsoft.AspNetCore.Routing.Tests/EndpointRoutingMiddlewareTest.cs index bc34547aff..df5c8d831c 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/GlobalRoutingMiddlewareTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/EndpointRoutingMiddlewareTest.cs @@ -13,7 +13,7 @@ using Xunit; namespace Microsoft.AspNetCore.Routing { - public class GlobalRoutingMiddlewareTest + public class EndpointRoutingMiddlewareTest { [Fact] public async Task Invoke_OnCall_SetsEndpointFeature() @@ -39,14 +39,14 @@ namespace Microsoft.AspNetCore.Routing var expectedMessage = "Request matched endpoint 'Test endpoint'."; var sink = new TestSink( - TestSink.EnableWithTypeName, - TestSink.EnableWithTypeName); + TestSink.EnableWithTypeName, + TestSink.EnableWithTypeName); var loggerFactory = new TestLoggerFactory(sink, enabled: true); var httpContext = new DefaultHttpContext(); httpContext.RequestServices = new TestServiceProvider(); - var logger = new Logger(loggerFactory); + var logger = new Logger(loggerFactory); var middleware = CreateMiddleware(logger); // Act @@ -82,15 +82,15 @@ namespace Microsoft.AspNetCore.Routing Assert.Equal("testValue", endpointFeature.Values["testKey"]); } - private GlobalRoutingMiddleware CreateMiddleware(Logger logger = null) + private EndpointRoutingMiddleware CreateMiddleware(Logger logger = null) { RequestDelegate next = (c) => Task.FromResult(null); - logger = logger ?? new Logger(NullLoggerFactory.Instance); + logger = logger ?? new Logger(NullLoggerFactory.Instance); var options = Options.Create(new EndpointOptions()); var matcherFactory = new TestMatcherFactory(true); - var middleware = new GlobalRoutingMiddleware( + var middleware = new EndpointRoutingMiddleware( matcherFactory, new CompositeEndpointDataSource(Array.Empty()), logger, diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/BarebonesMatcher.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/BarebonesMatcher.cs similarity index 98% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/BarebonesMatcher.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/BarebonesMatcher.cs index 1d94447c06..df2d7b2a76 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/BarebonesMatcher.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/BarebonesMatcher.cs @@ -5,7 +5,7 @@ using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { // A test-only matcher implementation - used as a baseline for more compilated // perf tests. The idea with this matcher is that we can cheat on the requirements diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/BarebonesMatcherBuilder.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/BarebonesMatcherBuilder.cs similarity index 91% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/BarebonesMatcherBuilder.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/BarebonesMatcherBuilder.cs index efd9c588ce..0cde404142 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/BarebonesMatcherBuilder.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/BarebonesMatcherBuilder.cs @@ -5,9 +5,9 @@ using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.AspNetCore.Routing.Template; -using static Microsoft.AspNetCore.Routing.Matchers.BarebonesMatcher; +using static Microsoft.AspNetCore.Routing.Matching.BarebonesMatcher; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { internal class BarebonesMatcherBuilder : MatcherBuilder { diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/BarebonesMatcherConformanceTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/BarebonesMatcherConformanceTest.cs similarity index 97% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/BarebonesMatcherConformanceTest.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/BarebonesMatcherConformanceTest.cs index cc5d8768fb..c3f2b28968 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/BarebonesMatcherConformanceTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/BarebonesMatcherConformanceTest.cs @@ -5,7 +5,7 @@ using System; using System.Threading.Tasks; using Xunit; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public class BarebonesMatcherConformanceTest : MatcherConformanceTest { diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/CandidateSetTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/CandidateSetTest.cs similarity index 98% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/CandidateSetTest.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/CandidateSetTest.cs index 7b75859884..54db9ca02d 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/CandidateSetTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/CandidateSetTest.cs @@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Routing.Patterns; using Moq; using Xunit; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public class CandidateSetTest { diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/DataSourceDependentMatcherTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/DataSourceDependentMatcherTest.cs similarity index 98% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/DataSourceDependentMatcherTest.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/DataSourceDependentMatcherTest.cs index 9eb4fa48a7..e88c707217 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/DataSourceDependentMatcherTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/DataSourceDependentMatcherTest.cs @@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.AspNetCore.Routing.TestObjects; using Xunit; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public class DataSourceDependentMatcherTest { diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/DefaultEndpointSelectorTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/DefaultEndpointSelectorTest.cs similarity index 99% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/DefaultEndpointSelectorTest.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/DefaultEndpointSelectorTest.cs index a1a71cccd8..d8586f23d6 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/DefaultEndpointSelectorTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/DefaultEndpointSelectorTest.cs @@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Routing.Patterns; using Moq; using Xunit; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public class DefaultEndpointSelectorTest { diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/DefaultMatchProcessorFactoryTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/DefaultMatchProcessorFactoryTest.cs similarity index 99% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/DefaultMatchProcessorFactoryTest.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/DefaultMatchProcessorFactoryTest.cs index bcacb1a007..1be24950b1 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/DefaultMatchProcessorFactoryTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/DefaultMatchProcessorFactoryTest.cs @@ -10,7 +10,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Xunit; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public class DefaultMatchProcessorFactoryTest { diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/DfaMatcherBuilderTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/DfaMatcherBuilderTest.cs similarity index 99% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/DfaMatcherBuilderTest.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/DfaMatcherBuilderTest.cs index 71318fd943..e712210e44 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/DfaMatcherBuilderTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/DfaMatcherBuilderTest.cs @@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Routing.Patterns; using Moq; using Xunit; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public class DfaMatcherBuilderTest { diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/DfaMatcherConformanceTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/DfaMatcherConformanceTest.cs similarity index 96% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/DfaMatcherConformanceTest.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/DfaMatcherConformanceTest.cs index de5815f7c7..2aa04fb882 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/DfaMatcherConformanceTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/DfaMatcherConformanceTest.cs @@ -4,7 +4,7 @@ using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public class DfaMatcherConformanceTest : FullFeaturedMatcherConformanceTest { diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/DfaMatcherTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/DfaMatcherTest.cs similarity index 99% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/DfaMatcherTest.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/DfaMatcherTest.cs index 4b9f4a721d..7e80607008 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/DfaMatcherTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/DfaMatcherTest.cs @@ -9,7 +9,7 @@ using Microsoft.Extensions.DependencyInjection; using Moq; using Xunit; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { // Many of these are integration tests that exercise the system end to end, // so we're reusing the services here. diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/DictionaryJumpTableTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/DictionaryJumpTableTest.cs similarity index 91% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/DictionaryJumpTableTest.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/DictionaryJumpTableTest.cs index 17ac621637..d04ca502c7 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/DictionaryJumpTableTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/DictionaryJumpTableTest.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public class DictionaryJumpTableTest : MultipleEntryJumpTableTest { diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/EndpointMetadataComparerTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/EndpointMetadataComparerTest.cs similarity index 98% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/EndpointMetadataComparerTest.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/EndpointMetadataComparerTest.cs index 4a6ca5babd..f36ce81cba 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/EndpointMetadataComparerTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/EndpointMetadataComparerTest.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using Microsoft.AspNetCore.Routing.TestObjects; using Xunit; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public class EndpointMetadataComparerTest { diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/FastPathTokenizerTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/FastPathTokenizerTest.cs similarity index 98% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/FastPathTokenizerTest.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/FastPathTokenizerTest.cs index 121ed45b0e..51e2489ee4 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/FastPathTokenizerTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/FastPathTokenizerTest.cs @@ -4,7 +4,7 @@ using System; using Xunit; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public class FastPathTokenizerTest { diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/FullFeaturedMatcherConformanceTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/FullFeaturedMatcherConformanceTest.cs similarity index 99% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/FullFeaturedMatcherConformanceTest.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/FullFeaturedMatcherConformanceTest.cs index 61a8f3f9bf..4048c7827e 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/FullFeaturedMatcherConformanceTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/FullFeaturedMatcherConformanceTest.cs @@ -6,7 +6,7 @@ using System.Linq; using System.Threading.Tasks; using Xunit; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { // This class includes features that we have not yet implemented in the DFA // and instruction matchers. diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/HttpMethodMatcherPolicyIntegrationTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/HttpMethodMatcherPolicyIntegrationTest.cs similarity index 99% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/HttpMethodMatcherPolicyIntegrationTest.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/HttpMethodMatcherPolicyIntegrationTest.cs index 2f48332732..d3ae78485b 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/HttpMethodMatcherPolicyIntegrationTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/HttpMethodMatcherPolicyIntegrationTest.cs @@ -9,9 +9,9 @@ using Microsoft.AspNetCore.Routing.Metadata; using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.Extensions.DependencyInjection; using Xunit; -using static Microsoft.AspNetCore.Routing.Matchers.HttpMethodMatcherPolicy; +using static Microsoft.AspNetCore.Routing.Matching.HttpMethodMatcherPolicy; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { // End-to-end tests for the HTTP method matching functionality public class HttpMethodMatcherPolicyIntegrationTest diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/HttpMethodMatcherPolicyTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/HttpMethodMatcherPolicyTest.cs similarity index 99% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/HttpMethodMatcherPolicyTest.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/HttpMethodMatcherPolicyTest.cs index 9c977341a3..f302bebb10 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/HttpMethodMatcherPolicyTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/HttpMethodMatcherPolicyTest.cs @@ -7,9 +7,9 @@ using System.Linq; using Microsoft.AspNetCore.Routing.Metadata; using Microsoft.AspNetCore.Routing.Patterns; using Xunit; -using static Microsoft.AspNetCore.Routing.Matchers.HttpMethodMatcherPolicy; +using static Microsoft.AspNetCore.Routing.Matching.HttpMethodMatcherPolicy; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public class HttpMethodMatcherPolicyTest { diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/LinearSearchJumpTableTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/LinearSearchJumpTableTest.cs similarity index 92% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/LinearSearchJumpTableTest.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/LinearSearchJumpTableTest.cs index aa32a9b6e9..b7557488a4 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/LinearSearchJumpTableTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/LinearSearchJumpTableTest.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public class LinearSearchJumpTableTest : MultipleEntryJumpTableTest { diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/MatcherAssert.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/MatcherAssert.cs similarity index 98% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/MatcherAssert.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/MatcherAssert.cs index 0f9364c8db..5917ab4619 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/MatcherAssert.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/MatcherAssert.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Linq; using Xunit.Sdk; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { internal static class MatcherAssert { diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/MatcherConformanceTest.MultipleEndpoint.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/MatcherConformanceTest.MultipleEndpoint.cs similarity index 83% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/MatcherConformanceTest.MultipleEndpoint.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/MatcherConformanceTest.MultipleEndpoint.cs index 0784a2ebb5..5379da2938 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/MatcherConformanceTest.MultipleEndpoint.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/MatcherConformanceTest.MultipleEndpoint.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public abstract partial class MatcherConformanceTest { diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/MatcherConformanceTest.SingleEndpoint.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/MatcherConformanceTest.SingleEndpoint.cs similarity index 99% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/MatcherConformanceTest.SingleEndpoint.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/MatcherConformanceTest.SingleEndpoint.cs index caeaf1a7e8..580494b49c 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/MatcherConformanceTest.SingleEndpoint.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/MatcherConformanceTest.SingleEndpoint.cs @@ -4,7 +4,7 @@ using System.Threading.Tasks; using Xunit; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public abstract partial class MatcherConformanceTest { diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/MatcherConformanceTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/MatcherConformanceTest.cs similarity index 97% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/MatcherConformanceTest.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/MatcherConformanceTest.cs index 3b352a6ae6..9e4986c543 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/MatcherConformanceTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/MatcherConformanceTest.cs @@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.Extensions.DependencyInjection; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public abstract partial class MatcherConformanceTest { diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/MatcherEndpointComparerTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/MatcherEndpointComparerTest.cs similarity index 99% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/MatcherEndpointComparerTest.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/MatcherEndpointComparerTest.cs index 383a2153e3..87bbc0c877 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/MatcherEndpointComparerTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/MatcherEndpointComparerTest.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using Microsoft.AspNetCore.Routing.Patterns; using Xunit; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public class MatcherEndpointComparerTest { diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/MultipleEntryJumpTableTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/MultipleEntryJumpTableTest.cs similarity index 97% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/MultipleEntryJumpTableTest.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/MultipleEntryJumpTableTest.cs index 81351c3c54..1a1a00de2a 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/MultipleEntryJumpTableTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/MultipleEntryJumpTableTest.cs @@ -3,7 +3,7 @@ using Xunit; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public abstract class MultipleEntryJumpTableTest { diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/RouteConstraintMatchProcessorTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/RouteConstraintMatchProcessorTest.cs similarity index 97% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/RouteConstraintMatchProcessorTest.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/RouteConstraintMatchProcessorTest.cs index 4bc013baa4..915b483234 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/RouteConstraintMatchProcessorTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/RouteConstraintMatchProcessorTest.cs @@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Http; using Moq; using Xunit; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public class RouteConstraintMatchProcessorTest { diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/RouteMatcher.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/RouteMatcher.cs similarity index 96% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/RouteMatcher.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/RouteMatcher.cs index eefbaa68b1..e7f3cb7711 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/RouteMatcher.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/RouteMatcher.cs @@ -5,7 +5,7 @@ using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { // This is an adapter to use Route in the conformance tests internal class RouteMatcher : Matcher diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/RouteMatcherBuilder.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/RouteMatcherBuilder.cs similarity index 98% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/RouteMatcherBuilder.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/RouteMatcherBuilder.cs index a1c621826f..57394517bf 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/RouteMatcherBuilder.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/RouteMatcherBuilder.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.Extensions.Options; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { internal class RouteMatcherBuilder : MatcherBuilder { diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/RouteMatcherConformanceTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/RouteMatcherConformanceTest.cs similarity index 92% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/RouteMatcherConformanceTest.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/RouteMatcherConformanceTest.cs index 68589c36c4..8c3233e4cf 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/RouteMatcherConformanceTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/RouteMatcherConformanceTest.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public class RouteMatcherConformanceTest : FullFeaturedMatcherConformanceTest { diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/SingleEntryJumpTableTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/SingleEntryJumpTableTest.cs similarity index 97% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/SingleEntryJumpTableTest.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/SingleEntryJumpTableTest.cs index b9015e0a48..e21e8918cd 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/SingleEntryJumpTableTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/SingleEntryJumpTableTest.cs @@ -3,7 +3,7 @@ using Xunit; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public class SingleEntryJumpTableTest { diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/TreeRouterMatcher.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/TreeRouterMatcher.cs similarity index 96% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/TreeRouterMatcher.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/TreeRouterMatcher.cs index eab0bdc532..7e27f454c1 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/TreeRouterMatcher.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/TreeRouterMatcher.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing.Tree; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { // This is an adapter to use TreeRouter in the conformance tests internal class TreeRouterMatcher : Matcher diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/TreeRouterMatcherBuilder.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/TreeRouterMatcherBuilder.cs similarity index 98% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/TreeRouterMatcherBuilder.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/TreeRouterMatcherBuilder.cs index 6b19d353cf..e9c5b7ddc5 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/TreeRouterMatcherBuilder.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/TreeRouterMatcherBuilder.cs @@ -12,7 +12,7 @@ using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.ObjectPool; using Microsoft.Extensions.Options; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { internal class TreeRouterMatcherBuilder : MatcherBuilder { diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/TreeRouterMatcherConformanceTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/TreeRouterMatcherConformanceTest.cs similarity index 95% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/TreeRouterMatcherConformanceTest.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/TreeRouterMatcherConformanceTest.cs index 238a68f294..f4c346edd4 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/TreeRouterMatcherConformanceTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/TreeRouterMatcherConformanceTest.cs @@ -4,7 +4,7 @@ using System.Threading.Tasks; using Xunit; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public class TreeRouterMatcherConformanceTest : FullFeaturedMatcherConformanceTest { diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/ZeroEntryJumpTableTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/Matching/ZeroEntryJumpTableTest.cs similarity index 95% rename from test/Microsoft.AspNetCore.Routing.Tests/Matchers/ZeroEntryJumpTableTest.cs rename to test/Microsoft.AspNetCore.Routing.Tests/Matching/ZeroEntryJumpTableTest.cs index 1da7f33f84..036fef0c03 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Matchers/ZeroEntryJumpTableTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Matching/ZeroEntryJumpTableTest.cs @@ -3,7 +3,7 @@ using Xunit; -namespace Microsoft.AspNetCore.Routing.Matchers +namespace Microsoft.AspNetCore.Routing.Matching { public class ZeroEntryJumpTableTest { diff --git a/test/Microsoft.AspNetCore.Routing.Tests/Patterns/RoutePatternFactoryTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/Patterns/RoutePatternFactoryTest.cs index d16512d56d..ad985e17a2 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/Patterns/RoutePatternFactoryTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/Patterns/RoutePatternFactoryTest.cs @@ -4,7 +4,7 @@ using System; using System.Linq; using Microsoft.AspNetCore.Routing.Constraints; -using Microsoft.AspNetCore.Routing.Matchers; +using Microsoft.AspNetCore.Routing.Matching; using Moq; using Xunit; diff --git a/test/Microsoft.AspNetCore.Routing.Tests/RouteValueBasedEndpointFinderTest.cs b/test/Microsoft.AspNetCore.Routing.Tests/RouteValueBasedEndpointFinderTest.cs index fab9c41600..c18b0f5f2f 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/RouteValueBasedEndpointFinderTest.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/RouteValueBasedEndpointFinderTest.cs @@ -4,9 +4,8 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Microsoft.AspNetCore.Routing.EndpointFinders; using Microsoft.AspNetCore.Routing.Internal; -using Microsoft.AspNetCore.Routing.Matchers; +using Microsoft.AspNetCore.Routing.Matching; using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.AspNetCore.Routing.TestObjects; using Microsoft.AspNetCore.Routing.Tree; @@ -183,7 +182,7 @@ namespace Microsoft.AspNetCore.Routing // Act var foundEndpoints = finder.FindEndpoints( - new RouteValuesBasedEndpointFinderContext + new RouteValuesAddress { ExplicitValues = new RouteValueDictionary(new { id = 10 }), AmbientValues = new RouteValueDictionary(new { controller = "Home", action = "Index" }), @@ -212,7 +211,7 @@ namespace Microsoft.AspNetCore.Routing // Act var foundEndpoints = finder.FindEndpoints( - new RouteValuesBasedEndpointFinderContext + new RouteValuesAddress { ExplicitValues = new RouteValueDictionary(), AmbientValues = new RouteValueDictionary(), diff --git a/test/Microsoft.AspNetCore.Routing.Tests/TestObjects/TestMatcher.cs b/test/Microsoft.AspNetCore.Routing.Tests/TestObjects/TestMatcher.cs index 4994cdd008..d3d5544292 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/TestObjects/TestMatcher.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/TestObjects/TestMatcher.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing.Matchers; +using Microsoft.AspNetCore.Routing.Matching; namespace Microsoft.AspNetCore.Routing.TestObjects { diff --git a/test/Microsoft.AspNetCore.Routing.Tests/TestObjects/TestMatcherFactory.cs b/test/Microsoft.AspNetCore.Routing.Tests/TestObjects/TestMatcherFactory.cs index 18d1f5d27a..17fd346132 100644 --- a/test/Microsoft.AspNetCore.Routing.Tests/TestObjects/TestMatcherFactory.cs +++ b/test/Microsoft.AspNetCore.Routing.Tests/TestObjects/TestMatcherFactory.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using Microsoft.AspNetCore.Routing.Matchers; +using Microsoft.AspNetCore.Routing.Matching; namespace Microsoft.AspNetCore.Routing.TestObjects {