예제 #1
0
        public async Task RemoveFriendsFromFriendsListsOneByOneAsync()
        {
            Storage pStoStorage = new Storage("TableStorageRootURL",
                                              "AzureWebJobsStorage",
                                              "Test");

            foreach (CreateUserArgs curUser in cLisUsers)
            {
                FriendsList pFLtFriends = null;
                User        pUsrUser    = await pStoStorage.GetUserAsync(GetTestUserPrincipal(curUser.Email));

                foreach (CreateUserArgs curFriend in curUser.Friends)
                {
                    System.Diagnostics.Debug.WriteLine(String.Format("Removing friend '{0}' from user '{1}'.", curFriend.UserName, curUser.UserName));

                    User pUsrFriend = await pStoStorage.GetUserAsync(GetTestUserPrincipal(curFriend.Email));

                    pFLtFriends = pUsrUser.GetFriends(pStoStorage);
                    Int32  pIntPreRemovalCount = pFLtFriends.Friends.Count;
                    Friend pFrdFriend          = pFLtFriends.GetFriendByUserName(curFriend.UserName);
                    Assert.IsTrue(pFLtFriends.RemoveFriend(pStoStorage, pFrdFriend));
                    FriendsList pFLtFriendsPostRemoval = pUsrUser.GetFriends(pStoStorage);
                    pFrdFriend = pFLtFriendsPostRemoval.GetFriendByUserName(curFriend.UserName);
                    Assert.IsNull(pFrdFriend);
                }
            }
        }