示例#1
0
        public void AcceptGroupMemberRequest()
        {
            var groupMemberName = "AcceptGroupMemberRequest";

            var requestor = CreateUser(groupMemberName + " Requestor");
            var acceptor  = CreateGroup(groupMemberName + " Acceptor");

            var newMember = CreateRelationshipRequest(requestor.Id, acceptor.Id);

            _relationshipController.UpdateRequest(newMember, true);

            var groupRequests = _relationshipController.GetRelationRequestorActors(newMember.AcceptorId, ActorType.User);

            var matches = groupRequests.Count(g => g.Name == groupMemberName + " Requestor");

            Assert.Equal(matches, 0);

            var groupMembers = _relationshipController.GetRelatedActors(newMember.AcceptorId, ActorType.User);

            matches = groupMembers.Count(g => g.Name == groupMemberName + " Requestor");

            Assert.Equal(matches, 1);

            var userGroups = _relationshipController.GetRelatedActors(newMember.RequestorId, ActorType.Group);

            matches = userGroups.Count(g => g.Name == groupMemberName + " Acceptor");

            Assert.Equal(matches, 1);
        }
示例#2
0
        public void RejectUserFriendRequest()
        {
            var userFriendName = "RejectUserFriendRequest";

            var requestor = Helpers.CreateUser(userFriendName + " Requestor");
            var acceptor  = Helpers.CreateUser(userFriendName + " Acceptor");

            var newFriend = CreateRelationshipRequest(requestor.Id, acceptor.Id);

            _relationshipController.UpdateRequest(newFriend, false);

            var userRequests = _relationshipController.GetRelationRequestorActors(newFriend.AcceptorId, ActorType.User);

            var matches = userRequests.Count(g => g.Name == userFriendName + " Requestor");

            Assert.Equal(matches, 0);

            var userFriends = _relationshipController.GetRelatedActors(newFriend.RequestorId, ActorType.User);

            matches = userFriends.Count(g => g.Name == userFriendName + " Acceptor");

            Assert.Equal(matches, 0);
        }