diff options
author | Stephen Jennings <Stephen.G.Jennings@gmail.com> | 2011-10-17 01:27:09 -0700 |
---|---|---|
committer | Stephen Jennings <Stephen.G.Jennings@gmail.com> | 2011-10-17 01:27:09 -0700 |
commit | ff56822ac3eccc989b3f8a06d25f4518b275123d (patch) | |
tree | da6ed657fd07cbd7c3a9f14f2684ddbabece12ad | |
parent | b602a618f01b904f11dc54234f7e67b5ea0456ad (diff) | |
download | OATH.Net-ff56822ac3eccc989b3f8a06d25f4518b275123d.zip OATH.Net-ff56822ac3eccc989b3f8a06d25f4518b275123d.tar.gz OATH.Net-ff56822ac3eccc989b3f8a06d25f4518b275123d.tar.bz2 |
Add two more CounterBasedOtp tests for Google Authenticator.v0.1.0
-rw-r--r-- | OATH.Net.Test/CounterBasedOtpTests.cs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/OATH.Net.Test/CounterBasedOtpTests.cs b/OATH.Net.Test/CounterBasedOtpTests.cs index d0b0212..7720d01 100644 --- a/OATH.Net.Test/CounterBasedOtpTests.cs +++ b/OATH.Net.Test/CounterBasedOtpTests.cs @@ -245,6 +245,30 @@ namespace OathNet.Test Assert.AreEqual(expected, result); } + [Test] + public void ComputeOtp_test_with_Google_Authenticator_1() + { + var str = "DEADBEEF48656C6C6F21"; // Base-32: 32W3532IMVWGY3ZB + + var counter = 1; + var expected = "092093"; + + var result = this.TestWithStringKey(str, 6, counter); + Assert.AreEqual(expected, result); + } + + [Test] + public void ComputeOtp_test_with_Google_Authenticator_2() + { + var str = "DEADBEEF48656C6C6F21"; // Base-32: 32W3532IMVWGY3ZB + + var counter = 11; + var expected = "266262"; + + var result = this.TestWithStringKey(str, 6, counter); + Assert.AreEqual(expected, result); + } + private string TestWithByteArrayKey(byte[] key, int digits, int counter) { var otp = new CounterBasedOtp(key, digits); |