summaryrefslogtreecommitdiffstats
path: root/TwoStepsAuthenticator.UnitTests/CounterAuthenticatorTests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'TwoStepsAuthenticator.UnitTests/CounterAuthenticatorTests.cs')
-rw-r--r--TwoStepsAuthenticator.UnitTests/CounterAuthenticatorTests.cs23
1 files changed, 3 insertions, 20 deletions
diff --git a/TwoStepsAuthenticator.UnitTests/CounterAuthenticatorTests.cs b/TwoStepsAuthenticator.UnitTests/CounterAuthenticatorTests.cs
index 3a81a90..f834178 100644
--- a/TwoStepsAuthenticator.UnitTests/CounterAuthenticatorTests.cs
+++ b/TwoStepsAuthenticator.UnitTests/CounterAuthenticatorTests.cs
@@ -9,27 +9,10 @@ namespace TwoStepsAuthenticator.UnitTests {
[TestFixture]
public class CounterAuthenticatorTests {
- private MockUsedCodesManager mockUsedCodesManager { get; set; }
-
- [SetUp]
- public void SetUp() {
- this.mockUsedCodesManager = new MockUsedCodesManager();
- }
-
- [Test]
- public void Uses_usedCodesManager() {
- var authenticator = new CounterAuthenticator(usedCodeManager: mockUsedCodesManager);
- var secret = Authenticator.GenerateKey();
- var code = authenticator.GetCode(secret, 42uL);
-
- authenticator.CheckCode(secret, code, 42uL);
- Assert.AreEqual(mockUsedCodesManager.LastChallenge, 42uL);
- Assert.AreEqual(mockUsedCodesManager.LastCode, code);
- }
[Test]
public void CreateKey() {
- var authenticator = new CounterAuthenticator(usedCodeManager: mockUsedCodesManager);
+ var authenticator = new CounterAuthenticator();
var secret = Authenticator.GenerateKey();
var code = authenticator.GetCode(secret, 0uL);
@@ -48,7 +31,7 @@ namespace TwoStepsAuthenticator.UnitTests {
[TestCase("12345678901234567890", 8uL, "399871")]
[TestCase("12345678901234567890", 9uL, "520489")]
public void VerifyKeys(string secret, ulong counter, string code) {
- var authenticator = new CounterAuthenticator(usedCodeManager: mockUsedCodesManager);
+ var authenticator = new CounterAuthenticator();
var base32Secret = Base32Encoding.ToString(Encoding.ASCII.GetBytes(secret));
Assert.IsTrue(authenticator.CheckCode(base32Secret, code, counter));
@@ -57,7 +40,7 @@ namespace TwoStepsAuthenticator.UnitTests {
[Test]
public void VerifyUsedCounter() {
- var authenticator = new CounterAuthenticator(usedCodeManager: mockUsedCodesManager);
+ var authenticator = new CounterAuthenticator();
// Test Values from http://www.ietf.org/rfc/rfc4226.txt - Appendix D
var base32Secret = Base32Encoding.ToString(Encoding.ASCII.GetBytes("12345678901234567890"));