Example #1
0
        public void TestSha256Hash()
        {
            TeleSignAuthentication auth = new TeleSignAuthentication(this.GetCredential());
            string hash = auth.ComputeHash("HASH ME", AuthenticationMethod.HmacSha256);

            Assert.Greater(hash.Length, 0);
        }
Example #2
0
 public void TestConstructorThrowsOnNullInput()
 {
     Assert.Throws <ArgumentNullException>(delegate
     {
         TeleSignAuthentication auth = new TeleSignAuthentication(null);
     });
 }
 public void TestConstructorThrowsOnNullInput()
 {
     Assert.Throws<ArgumentNullException>(delegate
     {
         TeleSignAuthentication auth = new TeleSignAuthentication(null);
     });
 }
Example #4
0
        public void TestAuthStringConstructionThrowsOnEmptyStringToSign()
        {
            TeleSignAuthentication auth = new TeleSignAuthentication(this.GetCredential());

            Assert.Throws <ArgumentException>(delegate
            {
                auth.ConstructAuthorizationString(string.Empty, AuthenticationMethod.HmacSha1);
            });
        }
Example #5
0
        public void TestInvalidAuthMethodThrows()
        {
            TeleSignAuthentication auth = new TeleSignAuthentication(this.GetCredential());

            Assert.Throws <NotSupportedException>(delegate
            {
                auth.MapAuthenticationMethodToHeaderString(AuthenticationMethod.None);
            });
        }
        public void TestBasicFormatOfAuthorizationString()
        {
            TeleSignCredential credential = this.GetCredential();
            TeleSignAuthentication auth = new TeleSignAuthentication(credential);
            string authString = auth.ConstructAuthorizationString("FakeStringToSign", AuthenticationMethod.HmacSha1);

            string expectedStart = string.Format("TSA {0}:", credential.CustomerId);
            Assert.True(authString.StartsWith(expectedStart));
        }
        public void TestAuthStringConstructionThrowsOnEmptyStringToSign()
        {
            TeleSignAuthentication auth = new TeleSignAuthentication(this.GetCredential());

            Assert.Throws<ArgumentException>(delegate
            {
                auth.ConstructAuthorizationString(string.Empty, AuthenticationMethod.HmacSha1);
            });
        }
        public void TestInvalidAuthMethodThrows()
        {
            TeleSignAuthentication auth = new TeleSignAuthentication(this.GetCredential());

            Assert.Throws<NotSupportedException>(delegate
            {
                auth.MapAuthenticationMethodToHeaderString(AuthenticationMethod.None);
            });
        }
Example #9
0
        public void TestBasicFormatOfAuthorizationString()
        {
            TeleSignCredential     credential = this.GetCredential();
            TeleSignAuthentication auth       = new TeleSignAuthentication(credential);
            string authString = auth.ConstructAuthorizationString("FakeStringToSign", AuthenticationMethod.HmacSha1);

            string expectedStart = string.Format("TSA {0}:", credential.CustomerId);

            Assert.True(authString.StartsWith(expectedStart));
        }
 public void TestSha256Hash()
 {
     TeleSignAuthentication auth = new TeleSignAuthentication(this.GetCredential());
     string hash = auth.ComputeHash("HASH ME", AuthenticationMethod.HmacSha256);
     Assert.Greater(hash.Length, 0);
 }