summaryrefslogtreecommitdiffstats
path: root/TwoStepsAuthenticator.UnitTests/TimeAuthenticatorTests.cs
diff options
context:
space:
mode:
authorGuillaume Lacasa <guillaume.lacasa@ucaya.com>2013-12-06 16:16:13 +0100
committerGuillaume Lacasa <guillaume.lacasa@ucaya.com>2013-12-06 16:16:13 +0100
commit93adb5b673c1cf6d3abdb287d349ffad11ed7665 (patch)
tree3a996fd51e7b388e3c331478823efc926da9f148 /TwoStepsAuthenticator.UnitTests/TimeAuthenticatorTests.cs
parent50beaba8291c1e777d5a63bb19400a260712f837 (diff)
downloadTwoStepsAuthenticator-93adb5b673c1cf6d3abdb287d349ffad11ed7665.zip
TwoStepsAuthenticator-93adb5b673c1cf6d3abdb287d349ffad11ed7665.tar.gz
TwoStepsAuthenticator-93adb5b673c1cf6d3abdb287d349ffad11ed7665.tar.bz2
Documentation update
Code review
Diffstat (limited to 'TwoStepsAuthenticator.UnitTests/TimeAuthenticatorTests.cs')
-rw-r--r--TwoStepsAuthenticator.UnitTests/TimeAuthenticatorTests.cs31
1 files changed, 19 insertions, 12 deletions
diff --git a/TwoStepsAuthenticator.UnitTests/TimeAuthenticatorTests.cs b/TwoStepsAuthenticator.UnitTests/TimeAuthenticatorTests.cs
index 1a1ffc6..55be883 100644
--- a/TwoStepsAuthenticator.UnitTests/TimeAuthenticatorTests.cs
+++ b/TwoStepsAuthenticator.UnitTests/TimeAuthenticatorTests.cs
@@ -4,20 +4,24 @@ using System.Linq;
using System.Text;
using NUnit.Framework;
-namespace TwoStepsAuthenticator.UnitTests {
-
+namespace TwoStepsAuthenticator.UnitTests
+{
+
[TestFixture]
- public class TimeAuthenticatorTests {
+ public class TimeAuthenticatorTests
+ {
private MockUsedCodesManager mockUsedCodesManager { get; set; }
[SetUp]
- public void SetUp() {
+ public void SetUp()
+ {
this.mockUsedCodesManager = new MockUsedCodesManager();
}
[Test]
- public void CreateKey() {
- var authenticator = new TimeAuthenticator(usedCodeManager: mockUsedCodesManager);
+ public void CreateKey()
+ {
+ var authenticator = new TimeAuthenticator(mockUsedCodesManager);
var secret = Authenticator.GenerateKey();
var code = authenticator.GetCode(secret);
@@ -25,9 +29,10 @@ namespace TwoStepsAuthenticator.UnitTests {
}
[Test]
- public void Uses_usedCodesManager() {
+ public void Uses_usedCodesManager()
+ {
var date = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
- var authenticator = new TimeAuthenticator(() => date, usedCodeManager: mockUsedCodesManager);
+ var authenticator = new TimeAuthenticator(mockUsedCodesManager, () => date);
var secret = Authenticator.GenerateKey();
var code = authenticator.GetCode(secret);
@@ -41,18 +46,20 @@ namespace TwoStepsAuthenticator.UnitTests {
[TestCase("DRMK64PPMMC7TDZF", "2013-12-04 18:33:01 +0100", "661188")]
[TestCase("EQOGSM3XZUH6SE2Y", "2013-12-04 18:34:56 +0100", "256804")]
[TestCase("4VU7EQACVDMFJSBG", "2013-12-04 18:36:16 +0100", "800872")]
- public void VerifyKeys(string secret, string timeString, string code) {
+ public void VerifyKeys(string secret, string timeString, string code)
+ {
var date = DateTime.Parse(timeString);
- var authenticator = new TimeAuthenticator(() => date, usedCodeManager: mockUsedCodesManager);
+ var authenticator = new TimeAuthenticator(mockUsedCodesManager, () => date);
Assert.IsTrue(authenticator.CheckCode(secret, code));
}
[Test]
- public void VerifyUsedTime() {
+ public void VerifyUsedTime()
+ {
var date = DateTime.Parse("2013-12-05 17:23:50 +0100");
- var authenticator = new TimeAuthenticator(() => date, usedCodeManager: mockUsedCodesManager);
+ var authenticator = new TimeAuthenticator(mockUsedCodesManager, () => date);
DateTime usedTime;