From 241fbb214424da21ec1b8690061621c1017ed58e Mon Sep 17 00:00:00 2001 From: Shannon Date: Mon, 28 Aug 2017 23:06:31 +1000 Subject: [PATCH] combine start node tests --- .../Models/UserExtensionsTests.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/Umbraco.Tests/Models/UserExtensionsTests.cs b/src/Umbraco.Tests/Models/UserExtensionsTests.cs index 1e6c7664de..bf5eebf39c 100644 --- a/src/Umbraco.Tests/Models/UserExtensionsTests.cs +++ b/src/Umbraco.Tests/Models/UserExtensionsTests.cs @@ -14,6 +14,30 @@ namespace Umbraco.Tests.Models [TestFixture] public class UserExtensionsTests { + [Test] + public void Determines_Path_Access_To_Content_Two_Groups() + { + var paths = new Dictionary + { + { 1234, "-1,1234" } + }; + + var esmock = new Mock(); + esmock + .Setup(x => x.GetAllPaths(It.IsAny(), It.IsAny())) + .Returns( + (type, ids) => paths.Where(x => ids.Contains(x.Key)).Select(x => new EntityPath { Id = x.Key, Path = x.Value })); + + var combined = UserExtensions.CombineStartNodes( + UmbracoObjectTypes.Document, + new[] {1234, -1}, + new[] {1234}, + esmock.Object); + + Assert.AreEqual(1, combined.Length); + Assert.AreEqual(1234, combined[0]); + } + [TestCase(-1, "-1", "-1,1,2,3,4,5", true)] // below root start node [TestCase(2, "-1,1,2", "-1,1,2,3,4,5", true)] // below start node [TestCase(5, "-1,1,2,3,4,5", "-1,1,2,3,4,5", true)] // at start node