Make RoutePartsEqual public.
This commit is contained in:
parent
038802ee45
commit
3eb6c22330
|
|
@ -292,7 +292,14 @@ namespace Microsoft.AspNet.Routing.Template
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool RoutePartsEqual(object a, object b)
|
|
||||||
|
/// <summary>
|
||||||
|
/// Compares two objects for equality as parts of a case-insensitive path.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="a">An object to compare.</param>
|
||||||
|
/// <param name="b">An object to compare.</param>
|
||||||
|
/// <returns>True if the object are equal, otherwise false.</returns>
|
||||||
|
public static bool RoutePartsEqual(object a, object b)
|
||||||
{
|
{
|
||||||
var sa = a as string;
|
var sa = a as string;
|
||||||
var sb = b as string;
|
var sb = b as string;
|
||||||
|
|
|
||||||
|
|
@ -1032,6 +1032,25 @@ namespace Microsoft.AspNet.Routing.Template.Tests
|
||||||
expected);
|
expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData(null, null, true)]
|
||||||
|
[InlineData("blog", null, false)]
|
||||||
|
[InlineData(null, "store", false)]
|
||||||
|
[InlineData("Cool", "cool", true)]
|
||||||
|
[InlineData("Co0l", "cool", false)]
|
||||||
|
public void RoutePartsEqualTest(object left, object right, bool expected)
|
||||||
|
{
|
||||||
|
// Arrange & Act & Assert
|
||||||
|
if (expected)
|
||||||
|
{
|
||||||
|
Assert.True(TemplateBinder.RoutePartsEqual(left, right));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Assert.False(TemplateBinder.RoutePartsEqual(left, right));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static IInlineConstraintResolver GetInlineConstraintResolver()
|
private static IInlineConstraintResolver GetInlineConstraintResolver()
|
||||||
{
|
{
|
||||||
var services = new ServiceCollection { OptionsServices.GetDefaultServices() };
|
var services = new ServiceCollection { OptionsServices.GetDefaultServices() };
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue