public void Filter_On_Start_Node()
        {
            var userMock = new Mock <IUser>();

            userMock.Setup(u => u.Id).Returns(9);
            userMock.Setup(u => u.StartContentIds).Returns(new[] { 5 });
            var user              = userMock.Object;
            var userServiceMock   = new Mock <IUserService>();
            var userService       = userServiceMock.Object;
            var entityServiceMock = new Mock <IEntityService>();

            entityServiceMock.Setup(x => x.GetAllPaths(It.IsAny <UmbracoObjectTypes>(), It.IsAny <int[]>()))
            .Returns(new[] { Mock.Of <EntityPath>(entity => entity.Id == 5 && entity.Path == "-1,5") });
            var entityService = entityServiceMock.Object;

            var att  = new FilterAllowedOutgoingContentAttribute(typeof(IEnumerable <ContentItemBasic>), userService, entityService);
            var list = new List <dynamic>();
            var path = "";

            for (var i = 0; i < 10; i++)
            {
                if (i > 0 && path.EndsWith(",") == false)
                {
                    path += ",";
                }
                path += i.ToInvariantString();
                list.Add(new ContentItemBasic {
                    Id = i, Name = "Test" + i, ParentId = i, Path = path
                });
            }

            att.FilterBasedOnStartNode(list, user);

            Assert.AreEqual(5, list.Count);
        }
        public void Filter_On_Start_Node()
        {
            var att  = new FilterAllowedOutgoingContentAttribute(typeof(IEnumerable <ContentItemBasic>));
            var list = new List <dynamic>();
            var path = "";

            for (var i = 0; i < 10; i++)
            {
                if (i > 0 && path.EndsWith(",") == false)
                {
                    path += ",";
                }
                path += i.ToInvariantString();
                list.Add(new ContentItemBasic {
                    Id = i, Name = "Test" + i, ParentId = i, Path = path
                });
            }

            var userMock = new Mock <IUser>();

            userMock.Setup(u => u.Id).Returns(9);
            userMock.Setup(u => u.StartContentId).Returns(5);
            var user = userMock.Object;

            att.FilterBasedOnStartNode(list, user);

            Assert.AreEqual(5, list.Count);
        }