|
1 |
| -// Copyright (c) .NET Foundation. All rights reserved. |
| 1 | +// Copyright (c) .NET Foundation. All rights reserved. |
2 | 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
3 | 3 |
|
4 | 4 | using System.Collections.Generic;
|
@@ -87,7 +87,7 @@ public void Compare_PrefersTemplate_IfOtherCriteriaIsSame()
|
87 | 87 | var result = comparer.Compare(endpoint1, endpoint2);
|
88 | 88 |
|
89 | 89 | // Assert
|
90 |
| - Assert.Equal(1, result); |
| 90 | + Assert.True(result > 0); |
91 | 91 | }
|
92 | 92 |
|
93 | 93 | [Fact]
|
@@ -218,6 +218,29 @@ public void Sort_MoreSpecific_FirstInList()
|
218 | 218 | e => Assert.Same(endpoint7, e));
|
219 | 219 | }
|
220 | 220 |
|
| 221 | + [Fact] |
| 222 | + public void Compare_PatternOrder_OrdinalIgnoreCaseSort() |
| 223 | + { |
| 224 | + // Arrange |
| 225 | + var endpoint1 = CreateEndpoint("/I", order: 0); |
| 226 | + var endpoint2 = CreateEndpoint("/i", order: 0); |
| 227 | + var endpoint3 = CreateEndpoint("/\u0131", order: 0); // Turkish lowercase i |
| 228 | + |
| 229 | + var list = new List<RouteEndpoint>() { endpoint1, endpoint2, endpoint3 }; |
| 230 | + |
| 231 | + var comparer = CreateComparer(); |
| 232 | + |
| 233 | + // Act |
| 234 | + list.Sort(comparer); |
| 235 | + |
| 236 | + // Assert |
| 237 | + Assert.Collection( |
| 238 | + list, |
| 239 | + e => Assert.Same(endpoint1, e), |
| 240 | + e => Assert.Same(endpoint2, e), |
| 241 | + e => Assert.Same(endpoint3, e)); |
| 242 | + } |
| 243 | + |
221 | 244 | private static RouteEndpoint CreateEndpoint(string template, int order, params object[] metadata)
|
222 | 245 | {
|
223 | 246 | return new RouteEndpoint(
|
|
0 commit comments