Microsoft.Protocols.TestSuites.MS_SITESS.MS_SITESSAdapter.SetLoginUser C# (CSharp) Méthode

SetLoginUser() private méthode

Select associated user account to login the server according to different user authentications.
private SetLoginUser ( UserAuthenticationOption userAuthentication ) : void
userAuthentication UserAuthenticationOption Assign the authentication information of web service.
Résultat void
        private void SetLoginUser(UserAuthenticationOption userAuthentication)
        {
            string domain = string.Empty;
            string userName = string.Empty;
            string userPassword = string.Empty;

            switch (userAuthentication)
            {
                case UserAuthenticationOption.Authenticated:
                    domain = Common.GetConfigurationPropertyValue(Constants.Domain, this.Site);
                    userName = Common.GetConfigurationPropertyValue(Constants.UserName, this.Site);
                    userPassword = Common.GetConfigurationPropertyValue(Constants.Password, this.Site);
                    break;
                case UserAuthenticationOption.Unauthenticated:
                    domain = Common.GetConfigurationPropertyValue(Constants.UnauthorizedUserDomain, this.Site);
                    userName = Common.GetConfigurationPropertyValue(Constants.UnauthorizedUserName, this.Site);
                    userPassword = Common.GetConfigurationPropertyValue(Constants.UnauthorizedUserPassword, this.Site);
                    break;
            }

            this.service.Credentials = new NetworkCredential(userName, userPassword, domain);
        }
    }