Add initial test fix for SimilarNodeName when a node has no name.

This commit is contained in:
Mike
2018-01-08 17:30:11 +00:00
parent 3e8fb11abd
commit dc7b83ca6c
2 changed files with 8 additions and 1 deletions

View File

@@ -20,6 +20,12 @@ namespace Umbraco.Core.Persistence.Repositories
var name = Name;
// cater for instances where node has no name.
if(name.Length == 0)
{
return _numPos;
}
if (name[name.Length - 1] != ')')
return _numPos = -1;

View File

@@ -24,7 +24,8 @@ namespace Umbraco.Tests.Persistence.Repositories
[TestCase("Alpha (10)", "Alpha (2)", +1)] // this is the real stuff
[TestCase("Kilo", "Golf (2)", +1)]
[TestCase("Kilo (1)", "Golf (2)", +1)]
public void ComparerTest(string name1, string name2, int expected)
[TestCase("", "", 0)]
public void ComparerTest(string name1, string name2, int expected)
{
var comparer = new SimilarNodeName.Comparer();