summaryrefslogtreecommitdiffstats
path: root/TwoStepsAuthenticator.UnitTests/UsedCodesManagerTests.cs
diff options
context:
space:
mode:
authorGuillaume Lacasa <guillaume.lacasa@ucaya.com>2013-12-06 15:32:54 +0100
committerGuillaume Lacasa <guillaume.lacasa@ucaya.com>2013-12-06 15:32:54 +0100
commit50beaba8291c1e777d5a63bb19400a260712f837 (patch)
tree46b14ab6b93d813e9f40aae760f4b3902e380800 /TwoStepsAuthenticator.UnitTests/UsedCodesManagerTests.cs
parent33c70541ca1e0ea27ac6a9ba5bbee799f03f9de8 (diff)
parent41cb13ee263104981850a73d4abf4a583df31941 (diff)
downloadTwoStepsAuthenticator-50beaba8291c1e777d5a63bb19400a260712f837.zip
TwoStepsAuthenticator-50beaba8291c1e777d5a63bb19400a260712f837.tar.gz
TwoStepsAuthenticator-50beaba8291c1e777d5a63bb19400a260712f837.tar.bz2
Merge branch 'master' of https://github.com/dusk0r/TwoStepsAuthenticator
Diffstat (limited to 'TwoStepsAuthenticator.UnitTests/UsedCodesManagerTests.cs')
-rw-r--r--TwoStepsAuthenticator.UnitTests/UsedCodesManagerTests.cs37
1 files changed, 37 insertions, 0 deletions
diff --git a/TwoStepsAuthenticator.UnitTests/UsedCodesManagerTests.cs b/TwoStepsAuthenticator.UnitTests/UsedCodesManagerTests.cs
new file mode 100644
index 0000000..1138f54
--- /dev/null
+++ b/TwoStepsAuthenticator.UnitTests/UsedCodesManagerTests.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using NUnit.Framework;
+
+namespace TwoStepsAuthenticator.UnitTests {
+
+ [TestFixture]
+ public class UsedCodesManagerTests {
+
+ [Test]
+ public void Can_add_codes() {
+ var manager = new UsedCodesManager();
+
+ Assert.IsFalse(manager.IsCodeUsed(42uL, "def"));
+ manager.AddCode(42uL, "def");
+ Assert.IsTrue(manager.IsCodeUsed(42uL, "def"));
+ }
+
+ }
+
+ internal class MockUsedCodesManager : IUsedCodesManager {
+ public ulong? LastChallenge { get; private set; }
+ public string LastCode { get; private set; }
+
+ public void AddCode(ulong challenge, string code) {
+ this.LastChallenge = challenge;
+ this.LastCode = code;
+ }
+
+ public bool IsCodeUsed(ulong challenge, string code) {
+ return false;
+ }
+ }
+}