public void GetAuthenticationHeaderValue()
        {
            byte[] encodedValues             = Encoding.ASCII.GetBytes(string.Concat("admin", ":", "password"));
            AuthenticationHeaderValue header = new AuthenticationHeaderValue("Authorization", Convert.ToBase64String(encodedValues));

            AuthenticationHeader authToSend = new AuthenticationHeader("admin", "password");

            Assert.IsNotNull(authToSend.GetHeader());
            Assert.AreEqual(header, authToSend.GetHeader());
        }
예제 #2
0
 /// <summary>
 /// Gets the authentication header to be sent with the request
 /// </summary>
 /// <returns>A authentication header with the supplied username and password</returns>
 public AuthenticationHeaderValue GetHeader()
 {
     if (authentication == null)
     {
         return(null);
     }
     return(authentication.GetHeader());
 }
        public void PassNullPassword()
        {
            AuthenticationHeader authToSend = new AuthenticationHeader("username", string.Empty);

            Assert.IsNull(authToSend.GetHeader());
        }
        public void PassNullUsername()
        {
            AuthenticationHeader authToSend = new AuthenticationHeader(string.Empty, "password");

            Assert.IsNull(authToSend.GetHeader());
        }