Microsoft.Protocols.TestSuites.MS_ASAIRS.TestSuiteBase.SwitchUser C# (CSharp) Method

SwitchUser() protected method

Change user to call active sync operations and resynchronize the collection hierarchy.
protected SwitchUser ( UserInformation userInformation, bool isFolderSyncNeeded ) : void
userInformation UserInformation The information of the user that will switch to.
isFolderSyncNeeded bool A boolean value indicates whether needs to synchronize the folder hierarchy.
return void
        protected void SwitchUser(UserInformation userInformation, bool isFolderSyncNeeded)
        {
            this.ASAIRSAdapter.SwitchUser(userInformation.UserName, userInformation.UserPassword, userInformation.UserDomain);

            if (isFolderSyncNeeded)
            {
                FolderSyncResponse folderSyncResponse = this.FolderSync();

                // Get the folder collectionId of User1
                if (userInformation.UserName == this.User1Information.UserName)
                {
                    if (string.IsNullOrEmpty(this.User1Information.InboxCollectionId))
                    {
                        this.User1Information.InboxCollectionId = Common.GetDefaultFolderServerId(folderSyncResponse, FolderType.Inbox, this.Site);
                    }

                    if (string.IsNullOrEmpty(this.User1Information.ContactsCollectionId))
                    {
                        this.User1Information.ContactsCollectionId = Common.GetDefaultFolderServerId(folderSyncResponse, FolderType.Contacts, this.Site);
                    }

                    if (string.IsNullOrEmpty(this.User1Information.CalendarCollectionId))
                    {
                        this.User1Information.CalendarCollectionId = Common.GetDefaultFolderServerId(folderSyncResponse, FolderType.Calendar, this.Site);
                    }
                }

                // Get the folder collectionId of User2
                if (userInformation.UserName == this.User2Information.UserName)
                {
                    if (string.IsNullOrEmpty(this.User2Information.InboxCollectionId))
                    {
                        this.User2Information.InboxCollectionId = Common.GetDefaultFolderServerId(folderSyncResponse, FolderType.Inbox, this.Site);
                    }

                    if (string.IsNullOrEmpty(this.User2Information.CalendarCollectionId))
                    {
                        this.User2Information.CalendarCollectionId = Common.GetDefaultFolderServerId(folderSyncResponse, FolderType.Calendar, this.Site);
                    }
                }
            }
        }
        #endregion