V15: Adding tests for INavigationQueryService.TryGetLevel() (#17375)

* Fixing implementation to return null as level when it cannot retrieve it

* Adding unit tests
This commit is contained in:
Elitsa Marinovska
2024-10-28 09:15:43 +02:00
committed by GitHub
parent 64b6c8a47e
commit 853e605665
4 changed files with 53 additions and 5 deletions

View File

@@ -64,12 +64,13 @@ internal abstract class ContentNavigationServiceBase
public bool TryGetSiblingsKeysInBin(Guid key, out IEnumerable<Guid> siblingsKeys)
=> TryGetSiblingsKeysFromStructure(_recycleBinNavigationStructure, key, out siblingsKeys);
public bool TryGetLevel(Guid contentKey, out int level)
public bool TryGetLevel(Guid contentKey, out int? level)
{
level = 1;
Guid? parentKey;
if (TryGetParentKey(contentKey, out parentKey) is false)
{
level = null;
return false;
}
@@ -77,6 +78,7 @@ internal abstract class ContentNavigationServiceBase
{
if (TryGetParentKey(parentKey.Value, out parentKey) is false)
{
level = null;
return false;
}