Пример #1
0
        private async Task <GroupMemberCollection> GetTargetMembersAsync(GrouperDocument document)
        {
            var include = new GroupMemberCollection();
            var exclude = new GroupMemberCollection();

            foreach (GrouperDocumentMember member in document.Members)
            {
                var           memberCollection = member.Action == GroupMemberActions.Exclude ? exclude : include;
                IMemberSource source           = GetMemberSource(member);
                await source.GetMembersFromSourceAsync(memberCollection, member);
            }
            include.ExceptWith(exclude);
            return(include);
        }
        public void TestExceptWith()
        {
            GroupMemberCollection collection1 = new GroupMemberCollection();
            GroupMemberCollection collection2 = new GroupMemberCollection();

            collection1.Add(azureMember1);
            collection1.Add(azureMember2);
            collection2.Add(azureMember2);
            collection1.ExceptWith(collection2);
            Assert.Equal(1, collection1.Count);
            Exception exception = Record.Exception(() => collection1.AsEnumerable().First(m => m.Id == azureMember1.Id));

            Assert.Null(exception);
        }
Пример #3
0
        private async Task <GroupMemberCollection> GetTargetMembersAsync(GrouperDocument document, GroupMemberCollection currentMembers)
        {
            var include = new GroupMemberCollection();
            var exclude = new GroupMemberCollection();

            if (!(document.Members.Any(m => m.Action == GroupMemberActions.Include)))
            {
                include.Add(currentMembers);
            }
            foreach (GrouperDocumentMember member in document.Members)
            {
                var           memberCollection = member.Action == GroupMemberActions.Exclude ? exclude : include;
                IMemberSource source           = GetMemberSource(member);
                await source.GetMembersFromSourceAsync(memberCollection, member, document.MemberType);
            }
            include.ExceptWith(exclude);
            return(include);
        }