summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Jennings <Stephen.G.Jennings@gmail.com>2011-10-17 01:27:09 -0700
committerStephen Jennings <Stephen.G.Jennings@gmail.com>2011-10-17 01:27:09 -0700
commitff56822ac3eccc989b3f8a06d25f4518b275123d (patch)
treeda6ed657fd07cbd7c3a9f14f2684ddbabece12ad
parentb602a618f01b904f11dc54234f7e67b5ea0456ad (diff)
downloadOATH.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.cs24
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);